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

Unified Diff: chrome/browser/ui/webui/options/managed_user_settings_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: Fix problem with some WebUI tests. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/managed_user_settings_browsertest.js
diff --git a/chrome/browser/ui/webui/options/managed_user_settings_browsertest.js b/chrome/browser/ui/webui/options/managed_user_settings_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..bb4a0553ff13314c700aac2c7f10cf23c4d3db01
--- /dev/null
+++ b/chrome/browser/ui/webui/options/managed_user_settings_browsertest.js
@@ -0,0 +1,62 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+GEN('#include "chrome/browser/ui/webui/options/' +
+ 'managed_user_settings_test.h"');
+
+/**
+ * Test fixture for managed user settings WebUI testing.
+ * @constructor
+ * @extends {testing.Test}
+ */
+function ManagedUserSettingsTest() {}
+
+ManagedUserSettingsTest.prototype = {
+ __proto__: testing.Test.prototype,
+
+ /**
+ * Browse to the managed user settings page .
+ */
+ browsePreload: 'chrome://settings-frame/managedUser',
+
+ /** @override */
+ typedefCppFixture: 'ManagedUserSettingsTest',
+
+ /** @override */
+ runAccessibilityChecks: false,
+
+ /** @inheritDoc */
+ preLoad: function() {
+ this.makeAndRegisterMockHandler(['displayPassphraseDialog']);
+ },
+
+};
+
+// Verify that the settings page is locked when a passphrase is specified.
+TEST_F('ManagedUserSettingsTest', 'PageLocked',
+ function() {
+ // Check that the user is not authenticated when a passphrase is set.
+ ManagedUserSettings.initializeSetPassphraseButton(true);
+ var instance = ManagedUserSettings.getInstance();
+ expectEquals(instance.authenticationState,
+ options.ManagedUserAuthentication.UNAUTHENTICATED);
+ // Now verify that the unlock button can be clicked.
+ var unlockButton =
+ options.ManagedUserSettingsForTesting.getUnlockButton();
+ expectFalse(unlockButton.disabled);
+ this.mockHandler.expects((once())).displayPassphraseDialog(
+ ['options.ManagedUserSettings.isAuthenticated']);
+ unlockButton.click();
+ });
+
+// Verify that the settings page is not locked when no passphrase is specified.
+TEST_F('ManagedUserSettingsTest', 'PageUnlocked',
+ function() {
+ var instance = ManagedUserSettings.getInstance();
+ expectEquals(instance.authenticationState,
+ options.ManagedUserAuthentication.AUTHENTICATED);
+ var unlockButton =
+ options.ManagedUserSettingsForTesting.getUnlockButton();
+ expectTrue(unlockButton.disabled);
+ });

Powered by Google App Engine
This is Rietveld 408576698