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

Side by Side Diff: chrome/test/data/webui/settings/site_list_tests.js

Issue 2769863006: [MD settings] unit test for incognito activation (Closed)
Patch Set: set upstream Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 7 /**
8 * An example pref with 2 blocked location items and 2 allowed. This pref 8 * An example pref with 2 blocked location items and 2 allowed. This pref
9 * is also used for the All Sites category and therefore needs values for 9 * is also used for the All Sites category and therefore needs values for
10 * all types, even though some might be blank. 10 * all types, even though some might be blank.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 midiDevices: [], 52 midiDevices: [],
53 notifications: [], 53 notifications: [],
54 plugins: [], 54 plugins: [],
55 protectedContent: [], 55 protectedContent: [],
56 popups: [], 56 popups: [],
57 unsandboxed_plugins: [], 57 unsandboxed_plugins: [],
58 } 58 }
59 }; 59 };
60 60
61 /** 61 /**
62 * An example of prefs controlleBy policy.
63 * @type {SiteSettingsPref}
64 */
65 var prefsControlled = {
66 exceptions: {
67 plugins: [
68 {
69 category: 'plugins',
70 embeddingOrigin: 'http://foo-block.com',
71 origin: 'http://foo-block.com',
72 setting: 'block',
73 source: 'policy',
74 },
75 ]
76 }
77 };
78
79 /**
62 * An example pref with mixed schemes (present and absent). 80 * An example pref with mixed schemes (present and absent).
63 * @type {SiteSettingsPref} 81 * @type {SiteSettingsPref}
64 */ 82 */
65 var prefsMixedSchemes = { 83 var prefsMixedSchemes = {
66 exceptions: { 84 exceptions: {
67 geolocation: [ 85 geolocation: [
68 { 86 {
69 category: 'geolocation', 87 category: 'geolocation',
70 embeddingOrigin: 'https://foo-allow.com', 88 embeddingOrigin: 'https://foo-allow.com',
71 origin: 'https://foo-allow.com', 89 origin: 'https://foo-allow.com',
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 testElement.sites[0].origin); 605 testElement.sites[0].origin);
588 606
589 Polymer.dom.flush(); // Populates action menu. 607 Polymer.dom.flush(); // Populates action menu.
590 openActionMenu(0); 608 openActionMenu(0);
591 assertMenu(['Allow', 'Block', 'Edit', 'Remove'], testElement); 609 assertMenu(['Allow', 'Block', 'Edit', 'Remove'], testElement);
592 610
593 assertFalse(testElement.$.category.hidden); 611 assertFalse(testElement.$.category.hidden);
594 }); 612 });
595 }); 613 });
596 614
615 test('update lists for incognito', function() {
616 var contentType = settings.ContentSettingsTypes.PLUGINS;
617 var categorySubtype = settings.PermissionValues.BLOCK;
618 setUpCategory(contentType, categorySubtype, prefsControlled);
619 return browserProxy.whenCalled('getExceptionList').then(
620 function(actualContentType) {
621 assertEquals(1, testElement.sites.length);
622 browserProxy.setIncognito(true);
623 return browserProxy.whenCalled('getExceptionList');
dpapad 2017/03/23 21:31:45 Are you waiting on a new call to getExceptionList(
dschuyler 2017/03/23 22:13:50 Done.
624 }).then(function() {
625 assertEquals(2, testElement.sites.length);
dpapad 2017/03/23 21:31:45 Asserting that the |sites| Polymer property has a
dschuyler 2017/03/23 22:13:51 We can; I've switched it. I'm concerned that this
626 browserProxy.setIncognito(false);
627 return browserProxy.whenCalled('getExceptionList');
628 }).then(function() {
629 assertEquals(1, testElement.sites.length);
630 browserProxy.setIncognito(true);
631 return browserProxy.whenCalled('getExceptionList');
632 }).then(function() {
633 assertEquals(2, testElement.sites.length);
634 });
635 });
636
597 test('initial INCOGNITO BLOCK state is correct', function() { 637 test('initial INCOGNITO BLOCK state is correct', function() {
598 var contentType = settings.ContentSettingsTypes.COOKIES; 638 var contentType = settings.ContentSettingsTypes.COOKIES;
599 var categorySubtype = settings.PermissionValues.BLOCK; 639 var categorySubtype = settings.PermissionValues.BLOCK;
600 setUpCategory(contentType, categorySubtype, prefsIncognito); 640 setUpCategory(contentType, categorySubtype, prefsIncognito);
601 return browserProxy.whenCalled('getExceptionList').then( 641 return browserProxy.whenCalled('getExceptionList').then(
602 function(actualContentType) { 642 function(actualContentType) {
603 assertEquals(contentType, actualContentType); 643 assertEquals(contentType, actualContentType);
604 assertEquals(categorySubtype, testElement.categorySubtype); 644 assertEquals(categorySubtype, testElement.categorySubtype);
605 645
606 assertEquals(1, testElement.sites.length); 646 assertEquals(1, testElement.sites.length);
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 1063
1024 assertFalse(dialog.$.dialog.open); 1064 assertFalse(dialog.$.dialog.open);
1025 }); 1065 });
1026 }); 1066 });
1027 }); 1067 });
1028 1068
1029 return { 1069 return {
1030 registerTests: registerTests, 1070 registerTests: registerTests,
1031 }; 1071 };
1032 }); 1072 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698