OLD | NEW |
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 21 matching lines...) Expand all Loading... |
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 when a passphrase is specified. |
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. | 39 // Check that the user is not authenticated when a passphrase is set. |
40 ManagedUserSettings.passphraseChanged(true); | 40 ManagedUserSettings.passphraseChanged(true); |
41 var instance = ManagedUserSettings.getInstance(); | 41 var instance = ManagedUserSettings.getInstance(); |
42 expectEquals(instance.authenticationState, | 42 expectEquals(options.ManagedUserAuthentication.UNAUTHENTICATED, |
43 options.ManagedUserAuthentication.UNAUTHENTICATED); | 43 instance.authenticationState); |
44 // Now verify that the unlock button can be clicked. | 44 // Now verify that the unlock button can be clicked. |
45 var unlockButton = | 45 var unlockButton = |
46 options.ManagedUserSettingsForTesting.getUnlockButton(); | 46 options.ManagedUserSettingsForTesting.getUnlockButton(); |
47 expectFalse(unlockButton.disabled); | 47 expectFalse(unlockButton.disabled); |
48 this.mockHandler.expects(once()).setElevated([true]); | 48 this.mockHandler.expects(once()).setElevated([true]); |
49 unlockButton.click(); | 49 unlockButton.click(); |
50 // When closing the page, we expect the elevation to be reset. | 50 // When closing the page, we expect the elevation to be reset. |
51 this.mockHandler.expects(once()).setElevated([false]); | 51 this.mockHandler.expects(once()).setElevated([false]); |
52 OptionsPage.closeOverlay(); | 52 OptionsPage.closeOverlay(); |
53 }); | 53 }); |
54 | 54 |
55 // Verify that the settings page is also locked when no passphrase is specified. | 55 // Verify that the settings page is also locked when no passphrase is specified. |
56 TEST_F('ManagedUserSettingsTest', 'PageLockedNoPassphrase', | 56 TEST_F('ManagedUserSettingsTest', 'PageLockedNoPassphrase', |
57 function() { | 57 function() { |
58 var instance = ManagedUserSettings.getInstance(); | 58 var instance = ManagedUserSettings.getInstance(); |
59 expectEquals(instance.authenticationState, | 59 expectEquals(options.ManagedUserAuthentication.UNAUTHENTICATED, |
60 options.ManagedUserAuthentication.UNAUTHENTICATED); | 60 instance.authenticationState); |
61 var unlockButton = | 61 var unlockButton = |
62 options.ManagedUserSettingsForTesting.getUnlockButton(); | 62 options.ManagedUserSettingsForTesting.getUnlockButton(); |
63 expectFalse(unlockButton.disabled); | 63 expectFalse(unlockButton.disabled); |
64 this.mockHandler.expects(once()).setElevated([false]); | 64 this.mockHandler.expects(once()).setElevated([false]); |
65 OptionsPage.closeOverlay(); | 65 OptionsPage.closeOverlay(); |
66 }); | 66 }); |
OLD | NEW |