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

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

Issue 14325003: Clean up managed user settings dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix broken merge Created 7 years, 8 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 GEN('#include "chrome/browser/ui/webui/options/' + 5 GEN('#include "chrome/browser/ui/webui/options/' +
6 'managed_user_settings_test.h"'); 6 'managed_user_settings_test.h"');
7 7
8 /** 8 /**
9 * Test fixture for managed user settings WebUI testing. 9 * Test fixture for managed user settings WebUI testing.
10 * @constructor 10 * @constructor
(...skipping 15 matching lines...) Expand all
26 /** @override */ 26 /** @override */
27 runAccessibilityChecks: false, 27 runAccessibilityChecks: false,
28 28
29 /** @inheritDoc */ 29 /** @inheritDoc */
30 preLoad: function() { 30 preLoad: function() {
31 this.makeAndRegisterMockHandler(['setElevated']); 31 this.makeAndRegisterMockHandler(['setElevated']);
32 }, 32 },
33 33
34 }; 34 };
35 35
36 // Verify that the settings page is locked when a passphrase is specified. 36 // Verify that the settings page is locked and can be unlocked.
37 TEST_F('ManagedUserSettingsTest', 'PageLocked', 37 TEST_F('ManagedUserSettingsTest', 'PageLocked',
38 function() { 38 function() {
39 // Check that the user is not authenticated when a passphrase is set.
40 ManagedUserSettings.passphraseChanged(true);
41 var instance = ManagedUserSettings.getInstance(); 39 var instance = ManagedUserSettings.getInstance();
42 expectEquals(instance.authenticationState, 40 expectFalse(instance.isAuthenticated);
43 options.ManagedUserAuthentication.UNAUTHENTICATED);
44 // Now verify that the unlock button can be clicked. 41 // Now verify that the unlock button can be clicked.
45 var unlockButton = 42 var unlockButton =
46 options.ManagedUserSettingsForTesting.getUnlockButton(); 43 options.ManagedUserSettingsForTesting.getUnlockButton();
47 expectFalse(unlockButton.disabled); 44 expectFalse(unlockButton.disabled);
48 this.mockHandler.expects(once()).setElevated([true]); 45 this.mockHandler.expects(once()).setElevated([true]);
49 unlockButton.click(); 46 unlockButton.click();
50 // When closing the page, we expect the elevation to be reset. 47 // When closing the page, we expect the elevation to be reset.
51 this.mockHandler.expects(once()).setElevated([false]); 48 this.mockHandler.expects(once()).setElevated([false]);
52 OptionsPage.closeOverlay(); 49 OptionsPage.closeOverlay();
53 }); 50 });
54
55 // Verify that the settings page is also locked when no passphrase is specified.
56 TEST_F('ManagedUserSettingsTest', 'PageLockedNoPassphrase',
57 function() {
58 var instance = ManagedUserSettings.getInstance();
59 expectEquals(instance.authenticationState,
60 options.ManagedUserAuthentication.UNAUTHENTICATED);
61 var unlockButton =
62 options.ManagedUserSettingsForTesting.getUnlockButton();
63 expectFalse(unlockButton.disabled);
64 this.mockHandler.expects(once()).setElevated([false]);
65 OptionsPage.closeOverlay();
66 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698