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

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: Review comment 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..f04fe3df3ebfe50f58099d2a2d109df2241f551a
--- /dev/null
+++ b/chrome/test/data/webui/md_bookmarks/policy_test.js
@@ -0,0 +1,45 @@
+// 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.incognitoAvailability);
+ assertFalse(
+ commandManager.canExecute(Command.OPEN_INCOGNITO, new Set(['11'])));
+
+ return cr.sendWithPromise(
+ 'testSetIncognito', IncognitoAvailability.ENABLED);
+ }).then(() => {
+ assertEquals(IncognitoAvailability.ENABLED,
+ store.data.prefs.incognitoAvailability);
+ assertTrue(
+ commandManager.canExecute(Command.OPEN_INCOGNITO, new Set(['11'])));
+ });
+ });
+});
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/md_bookmarks_browsertest.js ('k') | chrome/test/data/webui/md_bookmarks/test_store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698