Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: chrome/test/data/webui/settings/site_list_tests.js

Issue 1867363003: Better support for patterns. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+ // 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();
+ });
michaelpg 2016/04/11 14:32:18 forgot to mention: indent these 2 lines
Finnur 2016/04/11 17:10:54 Done.
+ });
+ });
+
+
test('Mixed schemes (present and absent)', function() {
// Prefs: One item with scheme and one without.
setupLocationCategory(settings.PermissionValues.ALLOW,

Powered by Google App Engine
This is Rietveld 408576698