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

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: js format 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
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..8b413735dab510f0b86dedb02efa524eefbc2a11 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;
Dan Beam 2017/03/30 04:50:43 hasIncognito_
dschuyler 2017/03/30 21:06:16 See https://codereview.chromium.org/2787923002/
+
/** @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) {
+ var incognitoElements = [];
+ for (var i = 0; i < pref.length; ++i)
+ incognitoElements.push(Object.assign({incognito: true}, pref[i]));
+ pref = pref.concat(incognitoElements);
+ }
+
return Promise.resolve(pref);
},

Powered by Google App Engine
This is Rietveld 408576698