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

Side by Side Diff: chrome/browser/ui/webui/options/managed_user_set_passphrase_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: Adressed comments regarding the set passphrase dialog. 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 // The include does not fit in a 80 character line. Therefore we split it up.
6 var includeLine = '#include "chrome/browser/ui/webui/options/';
Bernhard Bauer 2013/02/05 13:34:44 You could concatenate the strings directly instead
Adrian Kuegel 2013/02/05 14:56:45 Done.
7 includeLine += 'managed_user_set_passphrase_test.h"';
8 GEN(includeLine);
9
10 /**
11 * Test fixture for managed user set passphrase WebUI testing.
12 * @constructor
13 * @extends {testing.Test}
14 */
15 function ManagedUserSetPassphraseTest() {}
16
17 ManagedUserSetPassphraseTest.prototype = {
18 __proto__: testing.Test.prototype,
19
20 /**
21 * Browse to the managed user settings page .
22 */
23 browsePreload: 'chrome://settings-frame/managedUser',
24
25 /** @override */
26 typedefCppFixture: 'ManagedUserSetPassphraseTest',
27
28 /** @inheritDoc */
29 preLoad: function() {
30 this.makeAndRegisterMockHandler(['setPassphrase']);
31 },
32
33 /**
34 * Clicks the "Set passphrase" button.
35 */
36 setPassphrase: function() {
37 var setPassphraseButton = ManagedUserSettings.getPassphraseButton();
38 assertNotEquals(null, setPassphraseButton);
39 setPassphraseButton.click();
40 },
41
42 /**
43 * Enters a passphrase.
44 */
45 enterPassphrase: function(passphrase) {
46 var passphraseInput = ManagedUserSetPassphraseOverlay.getPassphraseInput();
47 assertNotEquals(null, passphraseInput);
48 passphraseInput.value = passphrase;
49 },
50
51 /**
52 * Confirms the passphrase.
53 */
54 confirmPassphrase: function(passphrase) {
55 var passphraseConfirmInput =
56 ManagedUserSetPassphraseOverlay.getPassphraseConfirmInput();
57 assertNotEquals(null, passphraseConfirmInput);
58 passphraseConfirmInput.value = passphrase;
59 },
60
61 /**
62 * Save the passphrase.
63 */
64 savePassphrase: function() {
65 var savePassphraseButton =
66 ManagedUserSetPassphraseOverlay.getSavePassphraseButton();
67 assertNotEquals(null, savePassphraseButton);
68 // This takes care of enabling the save passphrase button (if applicable).
69 ManagedUserSetPassphraseOverlay.updateDisplay();
70 savePassphraseButton.click();
71 },
72 };
73
74 // Verify that the save passphrase flow works.
75 TEST_F('ManagedUserSetPassphraseTest', 'SamePassphrase',
76 function() {
77 this.setPassphrase();
78 this.enterPassphrase('test_passphrase');
79 this.confirmPassphrase('test_passphrase');
80 this.mockHandler.expects(once()).setPassphrase(['test_passphrase']);
81 this.savePassphrase();
82 });
83
84 // Verify that empty passphrase is not allowed.
85 TEST_F('ManagedUserSetPassphraseTest', 'EmptyPassphrase',
86 function() {
87 this.setPassphrase();
88 this.enterPassphrase('');
89 this.confirmPassphrase('');
90 this.mockHandler.expects(never()).setPassphrase(ANYTHING);
91 this.savePassphrase();
92 });
93
94 // Verify that the confirm passphrase input needs to contain the same
95 // passphrase as the passphrase input.
96 TEST_F('ManagedUserSetPassphraseTest', 'DifferentPassphrase',
97 function() {
98 this.setPassphrase();
99 this.enterPassphrase('test_passphrase');
100 this.confirmPassphrase('confirm_passphrase');
101 this.mockHandler.expects(never()).setPassphrase(ANYTHING);
102 this.savePassphrase();
103 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698