| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 assertEquals(prefs.exceptions.geolocation[1].origin, | 618 assertEquals(prefs.exceptions.geolocation[1].origin, |
| 619 testElement.sites[1].origin); | 619 testElement.sites[1].origin); |
| 620 assertEquals(undefined, testElement.selectedOrigin); | 620 assertEquals(undefined, testElement.selectedOrigin); |
| 621 | 621 |
| 622 // Validate that the sites are shown in UI and can be selected. | 622 // Validate that the sites are shown in UI and can be selected. |
| 623 var firstItem = testElement.$.listContainer.children[0]; | 623 var firstItem = testElement.$.listContainer.children[0]; |
| 624 var clickable = firstItem.querySelector('.middle'); | 624 var clickable = firstItem.querySelector('.middle'); |
| 625 assertNotEquals(undefined, clickable); | 625 assertNotEquals(undefined, clickable); |
| 626 MockInteractions.tap(clickable); | 626 MockInteractions.tap(clickable); |
| 627 assertEquals(prefs.exceptions.geolocation[0].origin, | 627 assertEquals(prefs.exceptions.geolocation[0].origin, |
| 628 testElement.selectedSite.origin); | 628 testElement.selectedSiteForUnitTest.origin); |
| 629 }); | 629 }); |
| 630 }); | 630 }); |
| 631 | 631 |
| 632 test('Block list open when Allow list is empty', function() { | 632 test('Block list open when Allow list is empty', function() { |
| 633 // Prefs: One item in Block list, nothing in Allow list. | 633 // Prefs: One item in Block list, nothing in Allow list. |
| 634 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, | 634 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, |
| 635 settings.PermissionValues.BLOCK, prefsOneDisabled); | 635 settings.PermissionValues.BLOCK, prefsOneDisabled); |
| 636 return browserProxy.whenCalled('getExceptionList').then( | 636 return browserProxy.whenCalled('getExceptionList').then( |
| 637 function(contentType) { | 637 function(contentType) { |
| 638 assertEquals( | 638 assertEquals( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 assertEquals(prefsVarious.exceptions.notifications[0].origin, | 741 assertEquals(prefsVarious.exceptions.notifications[0].origin, |
| 742 testElement.sites[2].origin); | 742 testElement.sites[2].origin); |
| 743 assertEquals(undefined, testElement.selectedOrigin); | 743 assertEquals(undefined, testElement.selectedOrigin); |
| 744 | 744 |
| 745 // Validate that the sites are shown in UI and can be selected. | 745 // Validate that the sites are shown in UI and can be selected. |
| 746 var firstItem = testElement.$.listContainer.children[1]; | 746 var firstItem = testElement.$.listContainer.children[1]; |
| 747 var clickable = firstItem.querySelector('.middle'); | 747 var clickable = firstItem.querySelector('.middle'); |
| 748 assertNotEquals(undefined, clickable); | 748 assertNotEquals(undefined, clickable); |
| 749 MockInteractions.tap(clickable); | 749 MockInteractions.tap(clickable); |
| 750 assertEquals(prefsVarious.exceptions.geolocation[0].origin, | 750 assertEquals(prefsVarious.exceptions.geolocation[0].origin, |
| 751 testElement.selectedSite.origin); | 751 testElement.selectedSiteForUnitTest.origin); |
| 752 }); | 752 }); |
| 753 }); | 753 }); |
| 754 }); | 754 }); |
| 755 | 755 |
| 756 test('All sites mixed pattern and origin', function() { | 756 test('All sites mixed pattern and origin', function() { |
| 757 // Prefs: One site, represented as origin and pattern. | 757 // Prefs: One site, represented as origin and pattern. |
| 758 setUpCategory(settings.ALL_SITES, '', prefsMixedOriginAndPattern); | 758 setUpCategory(settings.ALL_SITES, '', prefsMixedOriginAndPattern); |
| 759 | 759 |
| 760 return browserProxy.whenCalled('getExceptionList').then( | 760 return browserProxy.whenCalled('getExceptionList').then( |
| 761 function(contentType) { | 761 function(contentType) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 // Validate that the sites are shown in UI and can be selected. | 793 // Validate that the sites are shown in UI and can be selected. |
| 794 var firstItem = testElement.$.listContainer.children[0]; | 794 var firstItem = testElement.$.listContainer.children[0]; |
| 795 var clickable = firstItem.querySelector('.middle'); | 795 var clickable = firstItem.querySelector('.middle'); |
| 796 assertNotEquals(undefined, clickable); | 796 assertNotEquals(undefined, clickable); |
| 797 MockInteractions.tap(clickable); | 797 MockInteractions.tap(clickable); |
| 798 if (testElement.sites.length == 1) { | 798 if (testElement.sites.length == 1) { |
| 799 assertEquals( | 799 assertEquals( |
| 800 prefsMixedOriginAndPattern.exceptions. | 800 prefsMixedOriginAndPattern.exceptions. |
| 801 geolocation[0]. | 801 geolocation[0]. |
| 802 origin, | 802 origin, |
| 803 testElement.selectedSite.displayName); | 803 testElement.selectedSiteForUnitTest.displayName); |
| 804 } | 804 } |
| 805 }); | 805 }); |
| 806 }); | 806 }); |
| 807 }); | 807 }); |
| 808 | 808 |
| 809 test('Mixed schemes (present and absent)', function() { | 809 test('Mixed schemes (present and absent)', function() { |
| 810 // Prefs: One item with scheme and one without. | 810 // Prefs: One item with scheme and one without. |
| 811 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, | 811 setUpCategory(settings.ContentSettingsTypes.GEOLOCATION, |
| 812 settings.PermissionValues.ALLOW, prefsMixedSchemes); | 812 settings.PermissionValues.ALLOW, prefsMixedSchemes); |
| 813 return browserProxy.whenCalled('getExceptionList').then( | 813 return browserProxy.whenCalled('getExceptionList').then( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); | 851 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); |
| 852 assertEquals('allow', args[3]); | 852 assertEquals('allow', args[3]); |
| 853 }); | 853 }); |
| 854 }); | 854 }); |
| 855 }); | 855 }); |
| 856 } | 856 } |
| 857 return { | 857 return { |
| 858 registerTests: registerTests, | 858 registerTests: registerTests, |
| 859 }; | 859 }; |
| 860 }); | 860 }); |
| OLD | NEW |