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

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

Issue 12208068: Add a set passphrase dialog for managed user accounts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error on linux_clang. 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 =
36 options.ManagedUserSettingsForTesting.getSetPassphraseButton();
37 assertNotEquals(null, setPassphraseButton);
38 setPassphraseButton.click();
39 },
40
41 /**
42 * Enters a passphrase.
43 */
44 enterPassphrase: function(passphrase) {
45 var passphraseInput =
46 options.ManagedUserSetPassphraseForTesting.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 options.ManagedUserSetPassphraseForTesting.getPassphraseConfirmInput();
57 assertNotEquals(null, passphraseConfirmInput);
58 passphraseConfirmInput.value = passphrase;
59 },
60
61 /**
62 * Save the passphrase.
63 */
64 savePassphrase: function() {
65 var testObject = options.ManagedUserSetPassphraseForTesting;
66 var savePassphraseButton = testObject.getSavePassphraseButton();
67 assertNotEquals(null, savePassphraseButton);
68 // This takes care of enabling the save passphrase button (if applicable).
69 testObject.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