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

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: A few more fixes. 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_set_passphrase_test.h"');
7
8 /**
9 * Test fixture for managed user set passphrase WebUI testing.
10 * @constructor
11 * @extends {testing.Test}
12 */
13 function ManagedUserSetPassphraseTest() {}
14
15 ManagedUserSetPassphraseTest.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: 'ManagedUserSetPassphraseTest',
25
26 /** @inheritDoc */
27 preLoad: function() {
28 this.makeAndRegisterMockHandler(['setPassphrase']);
29 },
30
31 /**
32 * Clicks the "Set passphrase" button.
33 */
34 setPassphrase: function() {
35 var setPassphraseButton = ManagedUserSettings.getPassphraseButton();
36 assertNotEquals(null, setPassphraseButton);
37 setPassphraseButton.click();
38 },
39
40 /**
41 * Enters a passphrase.
42 */
43 enterPassphrase: function(passphrase) {
44 var instance = new options.ManagedUserSetPassphraseForTesting();
Bernhard Bauer 2013/02/05 16:21:32 You don't need to create a new instance; just call
Adrian Kuegel 2013/02/05 16:53:04 Done.
45 var passphraseInput = instance.getPassphraseInput();
46 assertNotEquals(null, passphraseInput);
47 passphraseInput.value = passphrase;
48 },
49
50 /**
51 * Confirms the passphrase.
52 */
53 confirmPassphrase: function(passphrase) {
54 var instance = new options.ManagedUserSetPassphraseForTesting();
55 var passphraseConfirmInput = instance.getPassphraseConfirmInput();
56 assertNotEquals(null, passphraseConfirmInput);
57 passphraseConfirmInput.value = passphrase;
58 },
59
60 /**
61 * Save the passphrase.
62 */
63 savePassphrase: function() {
64 var instance = new options.ManagedUserSetPassphraseForTesting();
65 var savePassphraseButton = instance.getSavePassphraseButton();
66 assertNotEquals(null, savePassphraseButton);
67 // This takes care of enabling the save passphrase button (if applicable).
68 instance.updateDisplay();
69 savePassphraseButton.click();
70 },
71 };
72
73 // Verify that the save passphrase flow works.
74 TEST_F('ManagedUserSetPassphraseTest', 'SamePassphrase',
75 function() {
76 this.setPassphrase();
77 this.enterPassphrase('test_passphrase');
78 this.confirmPassphrase('test_passphrase');
79 this.mockHandler.expects(once()).setPassphrase(['test_passphrase']);
80 this.savePassphrase();
81 });
82
83 // Verify that empty passphrase is not allowed.
84 TEST_F('ManagedUserSetPassphraseTest', 'EmptyPassphrase',
85 function() {
86 this.setPassphrase();
87 this.enterPassphrase('');
88 this.confirmPassphrase('');
89 this.mockHandler.expects(never()).setPassphrase(ANYTHING);
90 this.savePassphrase();
91 });
92
93 // Verify that the confirm passphrase input needs to contain the same
94 // passphrase as the passphrase input.
95 TEST_F('ManagedUserSetPassphraseTest', 'DifferentPassphrase',
96 function() {
97 this.setPassphrase();
98 this.enterPassphrase('test_passphrase');
99 this.confirmPassphrase('confirm_passphrase');
100 this.mockHandler.expects(never()).setPassphrase(ANYTHING);
101 this.savePassphrase();
102 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698