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

Unified Diff: chrome/test/data/webui/settings/fake_quick_unlock_private.js

Issue 2157673002: Browser tests for the quick_unlock settings pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pin-unlock-quick-unlock-interface
Patch Set: Address comments Created 4 years, 2 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/test/data/webui/settings/fake_quick_unlock_private.js
diff --git a/chrome/test/data/webui/settings/fake_quick_unlock_private.js b/chrome/test/data/webui/settings/fake_quick_unlock_private.js
new file mode 100644
index 0000000000000000000000000000000000000000..0852d671316e1ef2bc85220a1aa7ffecc252cc46
--- /dev/null
+++ b/chrome/test/data/webui/settings/fake_quick_unlock_private.js
@@ -0,0 +1,64 @@
+// Copyright 2016 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.
+
+/**
+ * @fileoverview Fake implementation of chrome.quickUnlockPrivate for testing.
+ */
+cr.define('settings', function() {
+ /**
+ * Fake of the chrome.quickUnlockPrivate API.
+ * @constructor
+ * @implements {QuickUnlockPrivate}
+ */
+ function FakeQuickUnlockPrivate() {
+ /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
+ this.availableModes = [chrome.quickUnlockPrivate.QuickUnlockMode.PIN];
+ /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
+ this.activeModes = [];
+ /** @type {!Array<string>} */ this.credentials = [];
+ /** @type {string} */ this.accountPassword = '';
+ }
+
+ FakeQuickUnlockPrivate.prototype = {
+ // Public testing methods.
+ /**
+ * @override
+ * @param {function(
+ * !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
+ */
+ getAvailableModes: function(onComplete) {
+ onComplete(this.availableModes);
+ },
+
+ /**
+ * @override
+ * @param {function(
+ * !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
+ */
+ getActiveModes: function(onComplete) {
+ onComplete(this.activeModes);
+ },
+
+ /**
+ * @override
+ * @param {string} accountPassword
+ * @param {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} modes
+ * @param {!Array<string>} credentials
+ * @param {function(boolean):void} onComplete
+ */
+ setModes: function(accountPassword, modes, credentials, onComplete) {
+ // Even if the account password is wrong we still update activeModes and
+ // credentials so that the mock owner has a chance to see what was given
+ // to the API.
+ this.activeModes = modes;
+ this.credentials = credentials;
+ onComplete(this.accountPassword == accountPassword);
+ }
+ };
+
+ /** @type {!ChromeEvent} */
+ FakeQuickUnlockPrivate.prototype.onActiveModesChanged = new FakeChromeEvent();
+
+ return {FakeQuickUnlockPrivate: FakeQuickUnlockPrivate};
+});

Powered by Google App Engine
This is Rietveld 408576698