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

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

Issue 2769453002: MD Settings: Allow deleting read-only content setting exceptions. (Closed)
Patch Set: 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
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 settings.resetRouteForTesting(); 381 settings.resetRouteForTesting();
382 }); 382 });
383 383
384 /** 384 /**
385 * Opens the action menu for a particular element in the list. 385 * Opens the action menu for a particular element in the list.
386 * @param {number} index The index of the child element (which site) to 386 * @param {number} index The index of the child element (which site) to
387 * open the action menu for. 387 * open the action menu for.
388 */ 388 */
389 function openActionMenu(index) { 389 function openActionMenu(index) {
390 var item = testElement.$.listContainer.children[index]; 390 var item = testElement.$.listContainer.children[index];
391 var dots = item.querySelector('paper-icon-button'); 391 var dots = item.querySelector('#actionMenuButton');
392 MockInteractions.tap(dots); 392 MockInteractions.tap(dots);
393 Polymer.dom.flush(); 393 Polymer.dom.flush();
394 } 394 }
395 395
396 /** Closes the action menu. */ 396 /** Closes the action menu. */
397 function closeActionMenu() { 397 function closeActionMenu() {
398 var menu = testElement.$$('dialog[is=cr-action-menu]'); 398 var menu = testElement.$$('dialog[is=cr-action-menu]');
399 if (menu.open) 399 if (menu.open)
400 menu.close(); 400 menu.close();
401 } 401 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return browserProxy.whenCalled( 640 return browserProxy.whenCalled(
641 'resetCategoryPermissionForOrigin'); 641 'resetCategoryPermissionForOrigin');
642 }).then(function(args) { 642 }).then(function(args) {
643 assertEquals('http://foo.com', args[0]); 643 assertEquals('http://foo.com', args[0]);
644 assertEquals('http://foo.com', args[1]); 644 assertEquals('http://foo.com', args[1]);
645 assertEquals(contentType, args[2]); 645 assertEquals(contentType, args[2]);
646 assertTrue(args[3]); // Incognito. 646 assertTrue(args[3]); // Incognito.
647 }); 647 });
648 }); 648 });
649 649
650 test('reset button works for read-only content types', function() {
651 testElement.readOnlyList = true;
652 Polymer.dom.flush();
653
654 var contentType = settings.ContentSettingsTypes.GEOLOCATION;
655 var categorySubtype = settings.PermissionValues.ALLOW;
656 setUpCategory(contentType, categorySubtype, prefsOneEnabled);
657 return browserProxy.whenCalled('getExceptionList').then(
658 function(actualContentType) {
659 assertEquals(contentType, actualContentType);
660 assertEquals(categorySubtype, testElement.categorySubtype);
661
662 assertEquals(1, testElement.sites.length);
663 assertEquals(
664 prefsOneEnabled.exceptions.geolocation[0].origin,
665 testElement.sites[0].origin);
666
667 Polymer.dom.flush();
668
669 var item = testElement.$.listContainer.children[0];
670
671 // Assert action button is hidden.
672 var dots = item.querySelector('#actionMenuButton');
673 assertTrue(!!dots);
674 assertTrue(dots.hidden);
675
676 // Assert reset button is visible.
677 var resetButton = item.querySelector('#resetSite');
678 assertTrue(!!resetButton);
679 assertFalse(resetButton.hidden);
680
681 MockInteractions.tap(resetButton);
682 return browserProxy.whenCalled(
683 'resetCategoryPermissionForOrigin');
684 }).then(function(args) {
685 assertEquals('https://foo-allow.com:443', args[0]);
686 assertEquals('https://foo-allow.com:443', args[1]);
687 assertEquals(contentType, args[2]);
688 });
689 });
690
650 test('edit action menu opens edit exception dialog', function() { 691 test('edit action menu opens edit exception dialog', function() {
651 setUpCategory( 692 setUpCategory(
652 settings.ContentSettingsTypes.COOKIES, 693 settings.ContentSettingsTypes.COOKIES,
653 settings.PermissionValues.SESSION_ONLY, 694 settings.PermissionValues.SESSION_ONLY,
654 prefsSessionOnly); 695 prefsSessionOnly);
655 696
656 return browserProxy.whenCalled('getExceptionList').then(function() { 697 return browserProxy.whenCalled('getExceptionList').then(function() {
657 Polymer.dom.flush(); // Populates action menu. 698 Polymer.dom.flush(); // Populates action menu.
658 699
659 openActionMenu(0); 700 openActionMenu(0);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 821
781 test('All sites category no action menu', function() { 822 test('All sites category no action menu', function() {
782 setUpCategory(settings.ALL_SITES, '', prefsVarious); 823 setUpCategory(settings.ALL_SITES, '', prefsVarious);
783 return browserProxy.whenCalled('getExceptionList').then( 824 return browserProxy.whenCalled('getExceptionList').then(
784 function(contentType) { 825 function(contentType) {
785 // Use resolver to ensure that the list container is populated. 826 // Use resolver to ensure that the list container is populated.
786 var resolver = new PromiseResolver(); 827 var resolver = new PromiseResolver();
787 testElement.async(resolver.resolve); 828 testElement.async(resolver.resolve);
788 return resolver.promise.then(function() { 829 return resolver.promise.then(function() {
789 var item = testElement.$.listContainer.children[0]; 830 var item = testElement.$.listContainer.children[0];
790 var dots = item.querySelector('paper-icon-button'); 831 var dots = item.querySelector('#actionMenuButton');
791 assertTrue(!!dots); 832 assertTrue(!!dots);
792 assertTrue(dots.hidden); 833 assertTrue(dots.hidden);
793 }); 834 });
794 }); 835 });
795 }); 836 });
796 837
797 test('All sites category', function() { 838 test('All sites category', function() {
798 // Prefs: Multiple and overlapping sites. 839 // Prefs: Multiple and overlapping sites.
799 setUpCategory(settings.ALL_SITES, '', prefsVarious); 840 setUpCategory(settings.ALL_SITES, '', prefsVarious);
800 841
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1045
1005 assertFalse(dialog.$.dialog.open); 1046 assertFalse(dialog.$.dialog.open);
1006 }); 1047 });
1007 }); 1048 });
1008 }); 1049 });
1009 1050
1010 return { 1051 return {
1011 registerTests: registerTests, 1052 registerTests: registerTests,
1012 }; 1053 };
1013 }); 1054 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698