From 83f4baf8c6470511aab40082d09d3c45c8674e26 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Sun, 14 Sep 2014 09:35:41 -0500 Subject: [PATCH] Port the test to check for plugin non-existence. https://github.com/ariya/phantomjs/issues/12439 --- test/module/webpage/no-plugin.js | 17 +++++++++++++++++ test/run-tests.py | 1 + test/webpage-spec.js | 6 ------ 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 test/module/webpage/no-plugin.js diff --git a/test/module/webpage/no-plugin.js b/test/module/webpage/no-plugin.js new file mode 100644 index 00000000..12de769b --- /dev/null +++ b/test/module/webpage/no-plugin.js @@ -0,0 +1,17 @@ +var assert = require('../../assert'); +var webpage = require('webpage'); + +var page = webpage.create(); + +var pluginLength = page.evaluate(function() { + return window.navigator.plugins.length; +}); +assert.equal(pluginLength, 0); + +page.open('http://localhost:9180/hello.html', function (status) { + assert.equal(status, 'success'); + var pluginLength = page.evaluate(function() { + return window.navigator.plugins.length; + }); + assert.equal(pluginLength, 0); +}); diff --git a/test/run-tests.py b/test/run-tests.py index 85ac6f63..b31d515e 100755 --- a/test/run-tests.py +++ b/test/run-tests.py @@ -38,6 +38,7 @@ TESTS = [ 'module/webpage/abort-network-request.js', 'module/webpage/resource-request-error.js', 'module/webpage/resource-received-error.js', + 'module/webpage/no-plugin.js', 'module/system/system.js', 'module/system/args.js', 'module/system/os.js', diff --git a/test/webpage-spec.js b/test/webpage-spec.js index 584c9591..8dc3e9de 100644 --- a/test/webpage-spec.js +++ b/test/webpage-spec.js @@ -641,12 +641,6 @@ describe("WebPage object", function() { }); }); - it("should not load any NPAPI plugins (e.g. Flash)", function() { - runs(function() { - expect(page.evaluate(function () { return window.navigator.plugins.length; })).toEqual(0); - }); - }); - it("reports unhandled errors", function() { var lastError = null;