| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 assertEquals( | 455 assertEquals( |
| 456 settings.PermissionValues.ALLOW, testElement.categorySubtype); | 456 settings.PermissionValues.ALLOW, testElement.categorySubtype); |
| 457 Polymer.dom.flush(); // Populates action menu. | 457 Polymer.dom.flush(); // Populates action menu. |
| 458 openActionMenu(0); | 458 openActionMenu(0); |
| 459 assertMenu(['Block', 'Remove'], testElement); | 459 assertMenu(['Block', 'Remove'], testElement); |
| 460 | 460 |
| 461 assertFalse(testElement.$.category.hidden); | 461 assertFalse(testElement.$.category.hidden); |
| 462 }); | 462 }); |
| 463 }); | 463 }); |
| 464 | 464 |
| 465 test('action menu closes when list changes', function() { |
| 466 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, |
| 467 settings.PermissionValues.ALLOW, prefs); |
| 468 var actionMenu = testElement.$$('dialog[is=cr-action-menu]'); |
| 469 return browserProxy.whenCalled('getExceptionList').then( |
| 470 function(contentType) { |
| 471 Polymer.dom.flush(); // Populates action menu. |
| 472 openActionMenu(0); |
| 473 assertTrue(actionMenu.open); |
| 474 |
| 475 browserProxy.resetResolver('getExceptionList'); |
| 476 // Simulate a change in the underlying model. |
| 477 cr.webUIListenerCallback( |
| 478 'contentSettingSitePermissionChanged', |
| 479 settings.ContentSettingsTypes.GEOLOCATION); |
| 480 return browserProxy.whenCalled('getExceptionList'); |
| 481 }).then(function() { |
| 482 // Check that the action menu was closed. |
| 483 assertFalse(actionMenu.open); |
| 484 }); |
| 485 }); |
| 486 |
| 465 test('exceptions are not reordered in non-ALL_SITES', function() { | 487 test('exceptions are not reordered in non-ALL_SITES', function() { |
| 466 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, | 488 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, |
| 467 settings.PermissionValues.BLOCK, prefsMixedProvider); | 489 settings.PermissionValues.BLOCK, prefsMixedProvider); |
| 468 return browserProxy.whenCalled('getExceptionList').then( | 490 return browserProxy.whenCalled('getExceptionList').then( |
| 469 function(contentType) { | 491 function(contentType) { |
| 470 assertEquals( | 492 assertEquals( |
| 471 settings.ContentSettingsTypes.GEOLOCATION, contentType); | 493 settings.ContentSettingsTypes.GEOLOCATION, contentType); |
| 472 | 494 |
| 473 assertEquals(3, testElement.sites.length); | 495 assertEquals(3, testElement.sites.length); |
| 474 for(var i = 0; i < 3; i++) { | 496 for(var i = 0; i < 3; i++) { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); | 886 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); |
| 865 assertEquals('allow', args[3]); | 887 assertEquals('allow', args[3]); |
| 866 }); | 888 }); |
| 867 }); | 889 }); |
| 868 }); | 890 }); |
| 869 } | 891 } |
| 870 return { | 892 return { |
| 871 registerTests: registerTests, | 893 registerTests: registerTests, |
| 872 }; | 894 }; |
| 873 }); | 895 }); |
| OLD | NEW |