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

Unified Diff: chrome/test/data/webui/md_bookmarks/policy_test.js

Issue 2902103002: MD Bookmarks: Disable 'Open in Incognito Window' when Incognito is disabled (Closed)
Patch Set: Add a test Created 3 years, 7 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/md_bookmarks/policy_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/policy_test.js b/chrome/test/data/webui/md_bookmarks/policy_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..707ad2f0aec3f1cbbd8cf4ec11acadfc4cd40cef
--- /dev/null
+++ b/chrome/test/data/webui/md_bookmarks/policy_test.js
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+suite('Incognito policy', function() {
+ var store;
+ var app;
+
+ setup(function() {
+ store = new bookmarks.TestStore({
+ nodes: testTree(createFolder(
+ '1',
+ [
+ createItem('11'),
+ ])),
+ selectedFolder: '1',
+ });
+ store.setReducersEnabled(true);
+ store.expectAction('set-incognito-availability');
+ bookmarks.Store.instance_ = store;
+
+ app = document.createElement('bookmarks-app');
+ replaceBody(app);
+ });
+
+ test('updates when changed by the browser', function() {
+ var commandManager = bookmarks.CommandManager.getInstance();
+ // Incognito is disabled during testGenPreamble(). Wait for the front-end to
+ // load the config.
+ return store.waitForAction('set-incognito-availability').then(action => {
+ assertEquals(IncognitoAvailability.DISABLED, store.data.prefs.incognito);
+ assertFalse(
+ commandManager.canExecute(Command.OPEN_INCOGNITO, new Set(['11'])));
+
+ return cr.sendWithPromise(
+ 'testSetIncognito', IncognitoAvailability.ENABLED);
+ }).then(() => {
+ assertEquals(IncognitoAvailability.ENABLED, store.data.prefs.incognito);
+ assertTrue(
+ commandManager.canExecute(Command.OPEN_INCOGNITO, new Set(['11'])));
+ });
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698