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

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, add test for ManagedUserSettings page. 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/',
22
23 /** @override */
24 typedefCppFixture: 'ManagedUserSettingsTest',
25
26 /** @inheritDoc */
27 preLoad: function() {
28 this.makeAndRegisterMockHandler(['isPassphraseSet',
29 'displayPassphraseDialog']);
30 },
31
32 };
33
34 // Verify that the settings page is locked when a passphrase is specified.
35 TEST_F('ManagedUserSettingsTest', 'PageLocked',
36 function() {
37 this.mockHandler.expects((once())).isPassphraseSet(
38 ['ManagedUserSettings.initializeSetPassphraseButton']).
39 will(callFunction(
40 function() {
41 ManagedUserSettings.initializeSetPassphraseButton(true);
42 var instance = ManagedUserSettings.getInstance();
43 expectFalse(instance.authenticationChecked);
44 }));
45 options.OptionsPage.navigateToPage('managedUser');
46 // Now verify that the unlock button can be clicked.
47 var unlockButton =
48 options.ManagedUserSettingsForTesting.getUnlockButton();
49 expectFalse(unlockButton.disabled);
50 this.mockHandler.expects((once())).displayPassphraseDialog(
51 ['ManagedUserSettings.isAuthenticated']);
52 unlockButton.click();
53 });
54
55 // Verify that the settings page is not locked when no passphrase is specified.
56 TEST_F('ManagedUserSettingsTest', 'PageUnlocked',
57 function() {
58 this.mockHandler.expects((once())).isPassphraseSet(
59 ['ManagedUserSettings.initializeSetPassphraseButton']).
60 will(callFunction(
61 function() {
62 ManagedUserSettings.initializeSetPassphraseButton(false);
63 var instance = ManagedUserSettings.getInstance();
64 expectTrue(instance.authenticationChecked);
65 var unlockButton =
66 options.ManagedUserSettingsForTesting.getUnlockButton();
67 expectTrue(unlockButton.disabled);
68 }));
69 options.OptionsPage.navigateToPage('managedUser');
70 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698