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

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: fix stuff 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')
658 .then(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 })
685 .then(function(args) {
686 assertEquals('https://foo-allow.com:443', args[0]);
687 assertEquals('https://foo-allow.com:443', args[1]);
688 assertEquals(contentType, args[2]);
689 });
690 });
691
650 test('edit action menu opens edit exception dialog', function() { 692 test('edit action menu opens edit exception dialog', function() {
651 setUpCategory( 693 setUpCategory(
652 settings.ContentSettingsTypes.COOKIES, 694 settings.ContentSettingsTypes.COOKIES,
653 settings.PermissionValues.SESSION_ONLY, 695 settings.PermissionValues.SESSION_ONLY,
654 prefsSessionOnly); 696 prefsSessionOnly);
655 697
656 return browserProxy.whenCalled('getExceptionList').then(function() { 698 return browserProxy.whenCalled('getExceptionList').then(function() {
657 Polymer.dom.flush(); // Populates action menu. 699 Polymer.dom.flush(); // Populates action menu.
658 700
659 openActionMenu(0); 701 openActionMenu(0);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 822
781 test('All sites category no action menu', function() { 823 test('All sites category no action menu', function() {
782 setUpCategory(settings.ALL_SITES, '', prefsVarious); 824 setUpCategory(settings.ALL_SITES, '', prefsVarious);
783 return browserProxy.whenCalled('getExceptionList').then( 825 return browserProxy.whenCalled('getExceptionList').then(
784 function(contentType) { 826 function(contentType) {
785 // Use resolver to ensure that the list container is populated. 827 // Use resolver to ensure that the list container is populated.
786 var resolver = new PromiseResolver(); 828 var resolver = new PromiseResolver();
787 testElement.async(resolver.resolve); 829 testElement.async(resolver.resolve);
788 return resolver.promise.then(function() { 830 return resolver.promise.then(function() {
789 var item = testElement.$.listContainer.children[0]; 831 var item = testElement.$.listContainer.children[0];
790 var dots = item.querySelector('paper-icon-button'); 832 var dots = item.querySelector('#actionMenuButton');
791 assertTrue(!!dots); 833 assertTrue(!!dots);
792 assertTrue(dots.hidden); 834 assertTrue(dots.hidden);
793 }); 835 });
794 }); 836 });
795 }); 837 });
796 838
797 test('All sites category', function() { 839 test('All sites category', function() {
798 // Prefs: Multiple and overlapping sites. 840 // Prefs: Multiple and overlapping sites.
799 setUpCategory(settings.ALL_SITES, '', prefsVarious); 841 setUpCategory(settings.ALL_SITES, '', prefsVarious);
800 842
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1046
1005 assertFalse(dialog.$.dialog.open); 1047 assertFalse(dialog.$.dialog.open);
1006 }); 1048 });
1007 }); 1049 });
1008 }); 1050 });
1009 1051
1010 return { 1052 return {
1011 registerTests: registerTests, 1053 registerTests: registerTests,
1012 }; 1054 };
1013 }); 1055 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698