OLD | NEW |
(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_settings_test.h"'); |
| 7 |
| 8 /** |
| 9 * Test fixture for managed user settings WebUI testing. |
| 10 * @constructor |
| 11 * @extends {testing.Test} |
| 12 */ |
| 13 function ManagedUserSettingsTest() {} |
| 14 |
| 15 ManagedUserSettingsTest.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: 'ManagedUserSettingsTest', |
| 25 |
| 26 /** @override */ |
| 27 runAccessibilityChecks: false, |
| 28 |
| 29 /** @inheritDoc */ |
| 30 preLoad: function() { |
| 31 this.makeAndRegisterMockHandler(['displayPassphraseDialog']); |
| 32 }, |
| 33 |
| 34 }; |
| 35 |
| 36 // Verify that the settings page is locked when a passphrase is specified. |
| 37 TEST_F('ManagedUserSettingsTest', 'PageLocked', |
| 38 function() { |
| 39 // Check that the user is not authenticated when a passphrase is set. |
| 40 ManagedUserSettings.initializeSetPassphraseButton(true); |
| 41 var instance = ManagedUserSettings.getInstance(); |
| 42 expectEquals(instance.authenticationState, |
| 43 options.ManagedUserAuthentication.UNAUTHENTICATED); |
| 44 // Now verify that the unlock button can be clicked. |
| 45 var unlockButton = |
| 46 options.ManagedUserSettingsForTesting.getUnlockButton(); |
| 47 expectFalse(unlockButton.disabled); |
| 48 this.mockHandler.expects((once())).displayPassphraseDialog( |
| 49 ['options.ManagedUserSettings.isAuthenticated']); |
| 50 unlockButton.click(); |
| 51 }); |
| 52 |
| 53 // Verify that the settings page is not locked when no passphrase is specified. |
| 54 TEST_F('ManagedUserSettingsTest', 'PageUnlocked', |
| 55 function() { |
| 56 var instance = ManagedUserSettings.getInstance(); |
| 57 expectEquals(instance.authenticationState, |
| 58 options.ManagedUserAuthentication.AUTHENTICATED); |
| 59 var unlockButton = |
| 60 options.ManagedUserSettingsForTesting.getUnlockButton(); |
| 61 expectTrue(unlockButton.disabled); |
| 62 }); |
OLD | NEW |