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 /** | 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 643 |
644 assertTrue(!!testElement.$$('settings-edit-exception-dialog')); | 644 assertTrue(!!testElement.$$('settings-edit-exception-dialog')); |
645 }); | 645 }); |
646 }); | 646 }); |
647 | 647 |
648 test('list items shown and clickable when data is present', function() { | 648 test('list items shown and clickable when data is present', function() { |
649 var contentType = settings.ContentSettingsTypes.GEOLOCATION; | 649 var contentType = settings.ContentSettingsTypes.GEOLOCATION; |
650 setUpCategory(contentType, settings.PermissionValues.ALLOW, prefs); | 650 setUpCategory(contentType, settings.PermissionValues.ALLOW, prefs); |
651 return browserProxy.whenCalled('getExceptionList').then( | 651 return browserProxy.whenCalled('getExceptionList').then( |
652 function(actualContentType) { | 652 function(actualContentType) { |
653 testElement.enableSiteSettings_ = true; | |
654 assertEquals(contentType, actualContentType); | 653 assertEquals(contentType, actualContentType); |
655 | 654 |
656 // Required for firstItem to be found below. | 655 // Required for firstItem to be found below. |
657 Polymer.dom.flush(); | 656 Polymer.dom.flush(); |
658 | 657 |
659 // Validate that the sites gets populated from pre-canned prefs. | 658 // Validate that the sites gets populated from pre-canned prefs. |
660 assertEquals(2, testElement.sites.length); | 659 assertEquals(2, testElement.sites.length); |
661 assertEquals( | 660 assertEquals( |
662 prefs.exceptions.geolocation[0].origin, | 661 prefs.exceptions.geolocation[0].origin, |
663 testElement.sites[0].origin); | 662 testElement.sites[0].origin); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 // Prefs: Multiple and overlapping sites. | 773 // Prefs: Multiple and overlapping sites. |
775 setUpCategory(settings.ALL_SITES, '', prefsVarious); | 774 setUpCategory(settings.ALL_SITES, '', prefsVarious); |
776 | 775 |
777 return browserProxy.whenCalled('getExceptionList').then( | 776 return browserProxy.whenCalled('getExceptionList').then( |
778 function(contentType) { | 777 function(contentType) { |
779 // Use resolver to ensure asserts bubble up to the framework with | 778 // Use resolver to ensure asserts bubble up to the framework with |
780 // meaningful errors. | 779 // meaningful errors. |
781 var resolver = new PromiseResolver(); | 780 var resolver = new PromiseResolver(); |
782 testElement.async(resolver.resolve); | 781 testElement.async(resolver.resolve); |
783 return resolver.promise.then(function() { | 782 return resolver.promise.then(function() { |
784 testElement.enableSiteSettings_ = true; | |
785 // All Sites calls getExceptionList for all categories, starting | 783 // All Sites calls getExceptionList for all categories, starting |
786 // with Cookies. | 784 // with Cookies. |
787 assertEquals( | 785 assertEquals( |
788 settings.ContentSettingsTypes.COOKIES, contentType); | 786 settings.ContentSettingsTypes.COOKIES, contentType); |
789 | 787 |
790 // Required for firstItem to be found below. | 788 // Required for firstItem to be found below. |
791 Polymer.dom.flush(); | 789 Polymer.dom.flush(); |
792 | 790 |
793 assertFalse(testElement.$.category.hidden); | 791 assertFalse(testElement.$.category.hidden); |
794 // Validate that the sites gets populated from pre-canned prefs. | 792 // Validate that the sites gets populated from pre-canned prefs. |
(...skipping 23 matching lines...) Expand all Loading... |
818 // Prefs: One site, represented as origin and pattern. | 816 // Prefs: One site, represented as origin and pattern. |
819 setUpCategory(settings.ALL_SITES, '', prefsMixedOriginAndPattern); | 817 setUpCategory(settings.ALL_SITES, '', prefsMixedOriginAndPattern); |
820 | 818 |
821 return browserProxy.whenCalled('getExceptionList').then( | 819 return browserProxy.whenCalled('getExceptionList').then( |
822 function(contentType) { | 820 function(contentType) { |
823 // Use resolver to ensure asserts bubble up to the framework with | 821 // Use resolver to ensure asserts bubble up to the framework with |
824 // meaningful errors. | 822 // meaningful errors. |
825 var resolver = new PromiseResolver(); | 823 var resolver = new PromiseResolver(); |
826 testElement.async(resolver.resolve); | 824 testElement.async(resolver.resolve); |
827 return resolver.promise.then(function() { | 825 return resolver.promise.then(function() { |
828 testElement.enableSiteSettings_ = true; | |
829 // All Sites calls getExceptionList for all categories, starting | 826 // All Sites calls getExceptionList for all categories, starting |
830 // with Cookies. | 827 // with Cookies. |
831 assertEquals( | 828 assertEquals( |
832 settings.ContentSettingsTypes.COOKIES, contentType); | 829 settings.ContentSettingsTypes.COOKIES, contentType); |
833 | 830 |
834 // Required for firstItem to be found below. | 831 // Required for firstItem to be found below. |
835 Polymer.dom.flush(); | 832 Polymer.dom.flush(); |
836 | 833 |
837 assertFalse(testElement.$.category.hidden); | 834 assertFalse(testElement.$.category.hidden); |
838 // Validate that the sites gets populated from pre-canned prefs. | 835 // Validate that the sites gets populated from pre-canned prefs. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 979 |
983 assertFalse(dialog.$.dialog.open); | 980 assertFalse(dialog.$.dialog.open); |
984 }); | 981 }); |
985 }); | 982 }); |
986 }); | 983 }); |
987 | 984 |
988 return { | 985 return { |
989 registerTests: registerTests, | 986 registerTests: registerTests, |
990 }; | 987 }; |
991 }); | 988 }); |
OLD | NEW |