Chromium Code Reviews| Index: chrome/test/data/webui/settings/site_list_tests.js |
| diff --git a/chrome/test/data/webui/settings/site_list_tests.js b/chrome/test/data/webui/settings/site_list_tests.js |
| index 9235f42de9292270e892d9596fe70d16f89a0190..c4bf9c83b2060e2cbaf19116801dfb18d1eb8649 100644 |
| --- a/chrome/test/data/webui/settings/site_list_tests.js |
| +++ b/chrome/test/data/webui/settings/site_list_tests.js |
| @@ -87,6 +87,38 @@ cr.define('site_list', function() { |
| }; |
| /** |
| + * An example pref with mixed origin and pattern. |
| + * @type {SiteSettingsPref} |
| + */ |
| + var prefsMixedOriginAndPattern = { |
| + exceptions: { |
| + media_stream_camera: [], |
| + cookies: [], |
| + fullscreen: [], |
| + geolocation: [ |
| + { |
| + origin: 'https://foo.com', |
| + embeddingOrigin: '*', |
| + setting: 'allow', |
| + source: 'preference', |
| + }, |
| + ], |
| + javascript: [ |
| + { |
| + origin: 'https://[*.]foo.com', |
| + embeddingOrigin: '*', |
| + setting: 'allow', |
| + source: 'preference', |
| + }, |
| + ], |
| + images: [], |
| + media_stream_mic: [], |
| + notifications: [], |
| + popups: [], |
| + } |
| + }; |
| + |
| + /** |
| * An example pref with multiple categories and multiple allow/block |
| * state. |
| * @type {SiteSettingsPref} |
| @@ -493,6 +525,46 @@ cr.define('site_list', function() { |
| }); |
| }); |
| + test('All sites mixed pattern and origin', function(done) { |
| + // Prefs: One site, represented as origin and pattern. |
| + setupAllSitesCategory(prefsMixedOriginAndPattern); |
| + |
| + browserProxy.whenCalled('getExceptionList').then( |
| + function(contentType) { |
| + testElement.async(function() { |
| + // All Sites calls getExceptionList for all categories, starting |
| + // with Cookies. |
| + assertEquals(settings.ContentSettingsTypes.COOKIES, contentType); |
| + |
| + // Required for firstItem to be found below. |
| + Polymer.dom.flush(); |
| + |
| + assertTrue(testElement.$.category.opened); |
| + assertFalse(testElement.$.category.hidden); |
| + // Validate that the sites gets populated from pre-canned prefs. |
| + // If this fails with 2 instead of the expected 1, then the |
|
michaelpg
2016/04/11 03:55:35
nit: move comment to assert message :-)
Finnur
2016/04/11 11:45:33
It doesn't really do anything because all asserts
michaelpg
2016/04/11 14:09:55
This is because the error is being thrown asynchro
|
| + // de-duping of sites is not working for site_list. |
| + assertEquals(1, testElement.sites.length); |
| + assertEquals( |
| + prefsMixedOriginAndPattern.exceptions.geolocation[0].origin, |
| + testElement.sites[0].originForDisplay); |
| + |
| + assertEquals(undefined, testElement.selectedOrigin); |
| + // Validate that the sites are shown in UI and can be selected. |
| + var firstItem = testElement.$.listContainer.items[0]; |
| + var clickable = firstItem.querySelector('.flex paper-item-body'); |
| + assertNotEquals(undefined, clickable); |
| + MockInteractions.tap(clickable); |
| + assertEquals( |
| + prefsMixedOriginAndPattern.exceptions.geolocation[0].origin, |
| + testElement.selectedSite.originForDisplay); |
| + |
| + done(); |
| + }); |
| + }); |
| + }); |
| + |
| + |
| test('Mixed schemes (present and absent)', function() { |
| // Prefs: One item with scheme and one without. |
| setupLocationCategory(settings.PermissionValues.ALLOW, |