| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 suite('Incognito policy', function() { |
| 6 var store; |
| 7 var app; |
| 8 |
| 9 setup(function() { |
| 10 store = new bookmarks.TestStore({ |
| 11 nodes: testTree(createFolder( |
| 12 '1', |
| 13 [ |
| 14 createItem('11'), |
| 15 ])), |
| 16 selectedFolder: '1', |
| 17 }); |
| 18 store.setReducersEnabled(true); |
| 19 store.expectAction('set-incognito-availability'); |
| 20 bookmarks.Store.instance_ = store; |
| 21 |
| 22 app = document.createElement('bookmarks-app'); |
| 23 replaceBody(app); |
| 24 }); |
| 25 |
| 26 test('updates when changed by the browser', function() { |
| 27 var commandManager = bookmarks.CommandManager.getInstance(); |
| 28 // Incognito is disabled during testGenPreamble(). Wait for the front-end to |
| 29 // load the config. |
| 30 return store.waitForAction('set-incognito-availability').then(action => { |
| 31 assertEquals(IncognitoAvailability.DISABLED, |
| 32 store.data.prefs.incognitoAvailability); |
| 33 assertFalse( |
| 34 commandManager.canExecute(Command.OPEN_INCOGNITO, new Set(['11']))); |
| 35 |
| 36 return cr.sendWithPromise( |
| 37 'testSetIncognito', IncognitoAvailability.ENABLED); |
| 38 }).then(() => { |
| 39 assertEquals(IncognitoAvailability.ENABLED, |
| 40 store.data.prefs.incognitoAvailability); |
| 41 assertTrue( |
| 42 commandManager.canExecute(Command.OPEN_INCOGNITO, new Set(['11']))); |
| 43 }); |
| 44 }); |
| 45 }); |
| OLD | NEW |