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

Side by Side Diff: chrome/browser/ui/webui/options/managed_user_settings_browsertest.js

Issue 11783008: Add a lock to the managed user settings page and require authentication for unlocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT and address review comments. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 GEN('#include "chrome/browser/ui/webui/options/' +
6 'managed_user_settings_test.h"');
7
8 /**
9 * Test fixture for managed user settings WebUI testing.
10 * @constructor
11 * @extends {testing.Test}
12 */
13 function ManagedUserSettingsTest() {}
14
15 ManagedUserSettingsTest.prototype = {
16 __proto__: testing.Test.prototype,
17
18 /**
19 * Browse to the managed user settings page .
20 */
21 browsePreload: 'chrome://settings-frame/managedUser',
22
23 /** @override */
24 typedefCppFixture: 'ManagedUserSettingsTest',
25
26 /** @inheritDoc */
27 preLoad: function() {
28 this.makeAndRegisterMockHandler(['displayPassphraseDialog']);
29 },
30
31 };
32
33 // Verify that the settings page is locked when a passphrase is specified.
34 TEST_F('ManagedUserSettingsTest', 'PageLocked',
35 function() {
36 // Check that the user is not authenticated when a passphrase is set.
37 ManagedUserSettings.initializeSetPassphraseButton(true);
38 var instance = ManagedUserSettings.getInstance();
39 expectEquals(instance.authenticationState,
40 options.Authentication.UNAUTHENTICATED);
41 // Now verify that the unlock button can be clicked.
42 var unlockButton =
43 options.ManagedUserSettingsForTesting.getUnlockButton();
44 expectFalse(unlockButton.disabled);
45 this.mockHandler.expects((once())).displayPassphraseDialog(
46 ['options.ManagedUserSettings.isAuthenticated']);
47 unlockButton.click();
48 });
49
50 // Verify that the settings page is not locked when no passphrase is specified.
51 TEST_F('ManagedUserSettingsTest', 'PageUnlocked',
52 function() {
53 var instance = ManagedUserSettings.getInstance();
54 expectEquals(instance.authenticationState,
55 options.Authentication.AUTHENTICATED);
56 var unlockButton =
57 options.ManagedUserSettingsForTesting.getUnlockButton();
58 expectTrue(unlockButton.disabled);
59 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698