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

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

Issue 2769863006: [MD settings] unit test for incognito activation (Closed)
Patch Set: reset resolver; .list-item Created 3 years, 9 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
« no previous file with comments | « chrome/test/data/webui/settings/site_list_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
diff --git a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
index 6fe9b1ca4a670e19f9e30d280c432135acc73109..ef7069b910a07af76810c9ecb0700fe7e5603a57 100644
--- a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
+++ b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
@@ -67,6 +67,9 @@ var TestSiteSettingsPrefsBrowserProxy = function() {
'setProtocolDefault'
]);
+ /** @private {boolean} */
+ this.hasIncognito = false;
+
/** @private {!SiteSettingsPref} */
this.prefs_ = prefsEmpty;
@@ -90,6 +93,15 @@ TestSiteSettingsPrefsBrowserProxy.prototype = {
__proto__: settings.TestBrowserProxy.prototype,
/**
+ * Pretends an incognito session started or ended.
+ * @param {boolean} hasIncognito True for session started.
+ */
+ setIncognito: function(hasIncognito) {
+ this.hasIncognito = hasIncognito;
+ cr.webUIListenerCallback('onIncognitoStatusChanged', hasIncognito);
+ },
+
+ /**
* Sets the prefs to use when testing.
* @param {!SiteSettingsPref} prefs The prefs to set.
*/
@@ -231,6 +243,14 @@ TestSiteSettingsPrefsBrowserProxy.prototype = {
console.log('getExceptionList received unknown category: ' + contentType);
assert(pref != undefined, 'Pref is missing for ' + contentType);
+
+ if (this.hasIncognito) {
+ pref = pref.concat(pref.filter(function(p) {
dpapad 2017/03/23 22:29:10 I am confused about the usage of filter() here. fi
dschuyler 2017/03/23 23:54:36 filter() returns the object returned by the functi
+ if (p.source == 'policy')
+ return Object.assign({incognito: true}, p);
+ }));
+ }
+
return Promise.resolve(pref);
},
« no previous file with comments | « chrome/test/data/webui/settings/site_list_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698