Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js

Issue 1376523006: Revert of permissions: add layout tests for multiple requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-sharedworker.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js
deleted file mode 100644
index 5ae4119b00c4652657cdea0775013d92c56964b6..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js
+++ /dev/null
@@ -1,235 +0,0 @@
-if (self.importScripts) {
- importScripts('../../resources/helpers.js');
- importScripts('testrunner-helpers.js');
-
- if (get_current_scope() == 'ServiceWorker')
- importScripts('../../../serviceworker/resources/worker-testharness.js');
- else
- importScripts('../../../resources/testharness.js');
-}
-
-var tests = [
-{
- test: async_test('Test empty array in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([]).then(function(result) {
- assert_array_equals(result, []);
- callback();
- }, function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}, {
- test: async_test('Test single permission with update in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([{name:'geolocation'}]).then(function(result) {
- assert_equals(result.length, 1);
- assert_true(result[0] instanceof PermissionStatus);
- assert_equals(result[0].state, 'denied');
- return setPermission('geolocation', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}]);
- }).then(function(result) {
- assert_equals(result.length, 1);
- assert_true(result[0] instanceof PermissionStatus);
- assert_equals(result[0].state, 'granted');
- // Set back to denied to cleanup.
- return setPermission('geolocation', 'denied', location.origin, location.origin);
- })
- .then(callback)
- .catch(function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}, {
- test: async_test('Test two permissions with update in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}]).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'denied');
- }
- return setPermission('geolocation', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}]);
- }).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++)
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[0].state, 'granted');
- assert_equals(result[1].state, 'denied');
- return setPermission('notifications', 'prompt', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}]);
- }).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++)
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[0].state, 'granted');
- assert_equals(result[1].state, 'prompt');
- // Set back to denied to cleanup.
- return setPermission('geolocation', 'denied', location.origin, location.origin);
- }).then(function() {
- return setPermission('notifications', 'denied', location.origin, location.origin);
- })
- .then(callback)
- .catch(function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}, {
- test: async_test('Test two permissions (inverted) with update in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([{name:'notifications'}, {name:'geolocation'}]).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'denied');
- }
- return setPermission('notifications', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'notifications'}, {name:'geolocation'}]);
- }).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++)
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[0].state, 'granted');
- assert_equals(result[1].state, 'denied');
- return setPermission('geolocation', 'prompt', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'notifications'}, {name:'geolocation'}]);
- }).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++)
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[0].state, 'granted');
- assert_equals(result[1].state, 'prompt');
- // Set back to denied to cleanup.
- return setPermission('geolocation', 'denied', location.origin, location.origin);
- }).then(function() {
- return setPermission('notifications', 'denied', location.origin, location.origin);
- })
- .then(callback)
- .catch(function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}, {
- test: async_test('Test duplicate permissions with update in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}]).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'denied');
- }
- return setPermission('geolocation', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}]);
- }).then(function(result) {
- assert_equals(result.length, 2);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'granted');
- }
- // Set back to denied to cleanup.
- return setPermission('geolocation', 'denied', location.origin, location.origin);
- })
- .then(callback)
- .catch(function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}, {
- test: async_test('Test duplicate permissions (2) with update in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}, {name:'notifications'}, {name:'notifications'}]).then(function(result) {
- assert_equals(result.length, 4);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'denied');
- }
- return setPermission('geolocation', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}, {name:'notifications'}, {name:'notifications'}]);
- }).then(function(result) {
- assert_equals(result.length, 4);
- for (var i = 0; i < 2; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'granted');
- }
- for (var i = 2; i < 4; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'denied');
- }
- // Set back to denied to cleanup.
- return setPermission('geolocation', 'denied', location.origin, location.origin);
- })
- .then(callback)
- .catch(function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}, {
- test: async_test('Test duplicate permissions (3) with update in ' + get_current_scope() + ' scope.'),
- fn: function(callback) {
- navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}, {name:'geolocation'}, {name:'notifications'}]).then(function(result) {
- assert_equals(result.length, 4);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'denied');
- }
- return setPermission('geolocation', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}, {name:'geolocation'}, {name:'notifications'}]);
- }).then(function(result) {
- assert_equals(result.length, 4);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- }
- assert_equals(result[0].state, 'granted');
- assert_equals(result[1].state, 'denied');
- assert_equals(result[2].state, 'granted');
- assert_equals(result[3].state, 'denied');
- return setPermission('notifications', 'granted', location.origin, location.origin);
- }).then(function() {
- return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}, {name:'geolocation'}, {name:'notifications'}]);
- }).then(function(result) {
- assert_equals(result.length, 4);
- for (var i = 0; i < result.length; i++) {
- assert_true(result[i] instanceof PermissionStatus);
- assert_equals(result[i].state, 'granted');
- }
- // Set back to denied to cleanup.
- return setPermission('geolocation', 'denied', location.origin, location.origin);
- }).then(function() {
- return setPermission('notifications', 'denied', location.origin, location.origin);
- })
- .then(callback)
- .catch(function(error) {
- assert_unreached(error);
- callback();
- });
- }
-}];
-
-function runTest(i) {
- tests[i].test.step(function() {
- tests[i].fn(function() {
- tests[i].test.done();
- if (i + 1 < tests.length) {
- runTest(i + 1);
- } else {
- done();
- }
- });
- });
-}
-runTest(0);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-sharedworker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698