| 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 assertEquals(settings.ContentSettingsTypes.COOKIES, args[2]); | 576 assertEquals(settings.ContentSettingsTypes.COOKIES, args[2]); |
| 577 assertTrue(args[3]); // Incognito. | 577 assertTrue(args[3]); // Incognito. |
| 578 }); | 578 }); |
| 579 }); | 579 }); |
| 580 | 580 |
| 581 test('list items shown and clickable when data is present', function() { | 581 test('list items shown and clickable when data is present', function() { |
| 582 setupCategory(settings.ContentSettingsTypes.GEOLOCATION, | 582 setupCategory(settings.ContentSettingsTypes.GEOLOCATION, |
| 583 settings.PermissionValues.ALLOW, prefs); | 583 settings.PermissionValues.ALLOW, prefs); |
| 584 return browserProxy.whenCalled('getExceptionList').then( | 584 return browserProxy.whenCalled('getExceptionList').then( |
| 585 function(contentType) { | 585 function(contentType) { |
| 586 testElement.enableSiteSettings_ = true; |
| 586 assertEquals( | 587 assertEquals( |
| 587 settings.ContentSettingsTypes.GEOLOCATION, contentType); | 588 settings.ContentSettingsTypes.GEOLOCATION, contentType); |
| 588 | 589 |
| 589 // Required for firstItem to be found below. | 590 // Required for firstItem to be found below. |
| 590 Polymer.dom.flush(); | 591 Polymer.dom.flush(); |
| 591 | 592 |
| 592 // Validate that the sites gets populated from pre-canned prefs. | 593 // Validate that the sites gets populated from pre-canned prefs. |
| 593 assertEquals(2, testElement.sites.length); | 594 assertEquals(2, testElement.sites.length); |
| 594 assertEquals(prefs.exceptions.geolocation[1].origin, | 595 assertEquals(prefs.exceptions.geolocation[1].origin, |
| 595 testElement.sites[0].origin); | 596 testElement.sites[0].origin); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 // Prefs: Multiple and overlapping sites. | 699 // Prefs: Multiple and overlapping sites. |
| 699 setupCategory(settings.ALL_SITES, '', prefsVarious); | 700 setupCategory(settings.ALL_SITES, '', prefsVarious); |
| 700 | 701 |
| 701 return browserProxy.whenCalled('getExceptionList').then( | 702 return browserProxy.whenCalled('getExceptionList').then( |
| 702 function(contentType) { | 703 function(contentType) { |
| 703 // Use resolver to ensure asserts bubble up to the framework with | 704 // Use resolver to ensure asserts bubble up to the framework with |
| 704 // meaningful errors. | 705 // meaningful errors. |
| 705 var resolver = new PromiseResolver(); | 706 var resolver = new PromiseResolver(); |
| 706 testElement.async(resolver.resolve); | 707 testElement.async(resolver.resolve); |
| 707 return resolver.promise.then(function() { | 708 return resolver.promise.then(function() { |
| 709 testElement.enableSiteSettings_ = true; |
| 708 // All Sites calls getExceptionList for all categories, starting | 710 // All Sites calls getExceptionList for all categories, starting |
| 709 // with Cookies. | 711 // with Cookies. |
| 710 assertEquals( | 712 assertEquals( |
| 711 settings.ContentSettingsTypes.COOKIES, contentType); | 713 settings.ContentSettingsTypes.COOKIES, contentType); |
| 712 | 714 |
| 713 // Required for firstItem to be found below. | 715 // Required for firstItem to be found below. |
| 714 Polymer.dom.flush(); | 716 Polymer.dom.flush(); |
| 715 | 717 |
| 716 assertTrue(testElement.$.category.opened); | 718 assertTrue(testElement.$.category.opened); |
| 717 assertFalse(testElement.$.category.hidden); | 719 assertFalse(testElement.$.category.hidden); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 742 // Prefs: One site, represented as origin and pattern. | 744 // Prefs: One site, represented as origin and pattern. |
| 743 setupCategory(settings.ALL_SITES, '', prefsMixedOriginAndPattern); | 745 setupCategory(settings.ALL_SITES, '', prefsMixedOriginAndPattern); |
| 744 | 746 |
| 745 return browserProxy.whenCalled('getExceptionList').then( | 747 return browserProxy.whenCalled('getExceptionList').then( |
| 746 function(contentType) { | 748 function(contentType) { |
| 747 // Use resolver to ensure asserts bubble up to the framework with | 749 // Use resolver to ensure asserts bubble up to the framework with |
| 748 // meaningful errors. | 750 // meaningful errors. |
| 749 var resolver = new PromiseResolver(); | 751 var resolver = new PromiseResolver(); |
| 750 testElement.async(resolver.resolve); | 752 testElement.async(resolver.resolve); |
| 751 return resolver.promise.then(function() { | 753 return resolver.promise.then(function() { |
| 754 testElement.enableSiteSettings_ = true; |
| 752 // All Sites calls getExceptionList for all categories, starting | 755 // All Sites calls getExceptionList for all categories, starting |
| 753 // with Cookies. | 756 // with Cookies. |
| 754 assertEquals( | 757 assertEquals( |
| 755 settings.ContentSettingsTypes.COOKIES, contentType); | 758 settings.ContentSettingsTypes.COOKIES, contentType); |
| 756 | 759 |
| 757 // Required for firstItem to be found below. | 760 // Required for firstItem to be found below. |
| 758 Polymer.dom.flush(); | 761 Polymer.dom.flush(); |
| 759 | 762 |
| 760 assertTrue(testElement.$.category.opened); | 763 assertTrue(testElement.$.category.opened); |
| 761 assertFalse(testElement.$.category.hidden); | 764 assertFalse(testElement.$.category.hidden); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); | 828 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); |
| 826 assertEquals('allow', args[3]); | 829 assertEquals('allow', args[3]); |
| 827 }); | 830 }); |
| 828 }); | 831 }); |
| 829 }); | 832 }); |
| 830 } | 833 } |
| 831 return { | 834 return { |
| 832 registerTests: registerTests, | 835 registerTests: registerTests, |
| 833 }; | 836 }; |
| 834 }); | 837 }); |
| OLD | NEW |