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

Unified Diff: chrome/browser/ui/webui/options/managed_user_set_passphrase_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: Adressed comments regarding the set passphrase dialog. 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_set_passphrase_browsertest.js
diff --git a/chrome/browser/ui/webui/options/managed_user_set_passphrase_browsertest.js b/chrome/browser/ui/webui/options/managed_user_set_passphrase_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..1737b6b0782d528bb1c6c9169d0d96748f012ba3
--- /dev/null
+++ b/chrome/browser/ui/webui/options/managed_user_set_passphrase_browsertest.js
@@ -0,0 +1,103 @@
+// 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.
+
+// The include does not fit in a 80 character line. Therefore we split it up.
+var includeLine = '#include "chrome/browser/ui/webui/options/';
Bernhard Bauer 2013/02/05 13:34:44 You could concatenate the strings directly instead
Adrian Kuegel 2013/02/05 14:56:45 Done.
+includeLine += 'managed_user_set_passphrase_test.h"';
+GEN(includeLine);
+
+/**
+ * Test fixture for managed user set passphrase WebUI testing.
+ * @constructor
+ * @extends {testing.Test}
+ */
+function ManagedUserSetPassphraseTest() {}
+
+ManagedUserSetPassphraseTest.prototype = {
+ __proto__: testing.Test.prototype,
+
+ /**
+ * Browse to the managed user settings page .
+ */
+ browsePreload: 'chrome://settings-frame/managedUser',
+
+ /** @override */
+ typedefCppFixture: 'ManagedUserSetPassphraseTest',
+
+ /** @inheritDoc */
+ preLoad: function() {
+ this.makeAndRegisterMockHandler(['setPassphrase']);
+ },
+
+ /**
+ * Clicks the "Set passphrase" button.
+ */
+ setPassphrase: function() {
+ var setPassphraseButton = ManagedUserSettings.getPassphraseButton();
+ assertNotEquals(null, setPassphraseButton);
+ setPassphraseButton.click();
+ },
+
+ /**
+ * Enters a passphrase.
+ */
+ enterPassphrase: function(passphrase) {
+ var passphraseInput = ManagedUserSetPassphraseOverlay.getPassphraseInput();
+ assertNotEquals(null, passphraseInput);
+ passphraseInput.value = passphrase;
+ },
+
+ /**
+ * Confirms the passphrase.
+ */
+ confirmPassphrase: function(passphrase) {
+ var passphraseConfirmInput =
+ ManagedUserSetPassphraseOverlay.getPassphraseConfirmInput();
+ assertNotEquals(null, passphraseConfirmInput);
+ passphraseConfirmInput.value = passphrase;
+ },
+
+ /**
+ * Save the passphrase.
+ */
+ savePassphrase: function() {
+ var savePassphraseButton =
+ ManagedUserSetPassphraseOverlay.getSavePassphraseButton();
+ assertNotEquals(null, savePassphraseButton);
+ // This takes care of enabling the save passphrase button (if applicable).
+ ManagedUserSetPassphraseOverlay.updateDisplay();
+ savePassphraseButton.click();
+ },
+};
+
+// Verify that the save passphrase flow works.
+TEST_F('ManagedUserSetPassphraseTest', 'SamePassphrase',
+ function() {
+ this.setPassphrase();
+ this.enterPassphrase('test_passphrase');
+ this.confirmPassphrase('test_passphrase');
+ this.mockHandler.expects(once()).setPassphrase(['test_passphrase']);
+ this.savePassphrase();
+ });
+
+// Verify that empty passphrase is not allowed.
+TEST_F('ManagedUserSetPassphraseTest', 'EmptyPassphrase',
+ function() {
+ this.setPassphrase();
+ this.enterPassphrase('');
+ this.confirmPassphrase('');
+ this.mockHandler.expects(never()).setPassphrase(ANYTHING);
+ this.savePassphrase();
+ });
+
+// Verify that the confirm passphrase input needs to contain the same
+// passphrase as the passphrase input.
+TEST_F('ManagedUserSetPassphraseTest', 'DifferentPassphrase',
+ function() {
+ this.setPassphrase();
+ this.enterPassphrase('test_passphrase');
+ this.confirmPassphrase('confirm_passphrase');
+ this.mockHandler.expects(never()).setPassphrase(ANYTHING);
+ this.savePassphrase();
+ });

Powered by Google App Engine
This is Rietveld 408576698