| 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'])));
|
| + });
|
| + });
|
| +});
|
|
|