OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** @fileoverview Suite of tests for site-list. */ | 5 /** @fileoverview Suite of tests for site-list. */ |
6 cr.define('site_list', function() { | 6 cr.define('site_list', function() { |
7 function registerTests() { | 7 function registerTests() { |
8 suite('SiteList', function() { | 8 suite('SiteList', function() { |
9 /** | 9 /** |
10 * A site list element created before each test. | 10 * A site list element created before each test. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 embeddingOrigin: '', | 275 embeddingOrigin: '', |
276 incognito: true, | 276 incognito: true, |
277 origin: 'http://bar.com', | 277 origin: 'http://bar.com', |
278 setting: 'allow', | 278 setting: 'allow', |
279 source: 'preference', | 279 source: 'preference', |
280 }, | 280 }, |
281 ] | 281 ] |
282 } | 282 } |
283 }; | 283 }; |
284 | 284 |
285 /** | |
286 * An example Javascript pref with a chrome-extension:// scheme. | |
287 * @type {SiteSettingsPref} | |
288 */ | |
289 var prefsChromeExtension = { | |
290 exceptions: { | |
291 javascript: [ | |
292 { | |
293 embeddingOrigin: '', | |
294 origin: 'chrome-extension://cfhgfbfpcbnnbibfphagcjmgjfjmojfa/', | |
295 setting: 'block', | |
296 source: 'preference', | |
297 }, | |
298 ] | |
299 } | |
300 }; | |
301 | |
285 // Import necessary html before running suite. | 302 // Import necessary html before running suite. |
286 suiteSetup(function() { | 303 suiteSetup(function() { |
287 CrSettingsPrefs.setInitialized(); | 304 CrSettingsPrefs.setInitialized(); |
288 return PolymerTest.importHtml( | 305 return PolymerTest.importHtml( |
289 'chrome://md-settings/site_settings/site_list.html'); | 306 'chrome://md-settings/site_settings/site_list.html'); |
290 }); | 307 }); |
291 | 308 |
292 suiteTeardown(function() { | 309 suiteTeardown(function() { |
293 CrSettingsPrefs.resetForTesting(); | 310 CrSettingsPrefs.resetForTesting(); |
294 }); | 311 }); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 settings.PermissionValues.ALLOW, prefs); | 778 settings.PermissionValues.ALLOW, prefs); |
762 return browserProxy.whenCalled('getExceptionList').then(function( | 779 return browserProxy.whenCalled('getExceptionList').then(function( |
763 contentType) { | 780 contentType) { |
764 Polymer.dom.flush(); | 781 Polymer.dom.flush(); |
765 var menuItems = getMenuItems(testElement.$.listContainer, 0); | 782 var menuItems = getMenuItems(testElement.$.listContainer, 0); |
766 assertTrue(!!menuItems); | 783 assertTrue(!!menuItems); |
767 MockInteractions.tap(menuItems[0]); | 784 MockInteractions.tap(menuItems[0]); |
768 return browserProxy.whenCalled('setCategoryPermissionForOrigin'); | 785 return browserProxy.whenCalled('setCategoryPermissionForOrigin'); |
769 }); | 786 }); |
770 }); | 787 }); |
788 | |
789 test('Chrome Extension scheme', function() { | |
790 setupCategory(settings.ContentSettingsTypes.JAVASCRIPT, | |
791 settings.PermissionValues.BLOCK, prefsChromeExtension); | |
792 return browserProxy.whenCalled('getExceptionList').then(function( | |
793 contentType) { | |
794 Polymer.dom.flush(); | |
795 assertMenu(['Allow', 'Remove'], testElement); | |
796 | |
797 var menuItems = getMenuItems(testElement.$.listContainer, 0); | |
798 assertTrue(!!menuItems); | |
799 MockInteractions.tap(menuItems[0]); // Action: Allow. | |
800 return browserProxy.whenCalled('setCategoryPermissionForOrigin'); | |
801 }).then(function(arguments) { | |
dschuyler
2016/09/28 19:13:40
|arguments| is a special value, like |this|.
So ar
| |
802 assertEquals('chrome-extension://cfhgfbfpcbnnbibfphagcjmgjfjmojfa/', | |
803 arguments[0]); | |
804 assertEquals('', arguments[1]); | |
805 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, arguments[2]); | |
806 assertEquals('allow', arguments[3]); | |
807 }); | |
808 }); | |
771 }); | 809 }); |
772 } | 810 } |
773 return { | 811 return { |
774 registerTests: registerTests, | 812 registerTests: registerTests, |
775 }; | 813 }; |
776 }); | 814 }); |
OLD | NEW |