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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 /**
6 * @fileoverview Fake implementation of chrome.quickUnlockPrivate for testing.
7 */
8 cr.define('settings', function() {
9 /**
10 * Fake of the chrome.quickUnlockPrivate API.
11 * @constructor
12 * @implements {QuickUnlockPrivate}
13 */
14 function FakeQuickUnlockPrivate() {
15 /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
16 this.availableModes = [chrome.quickUnlockPrivate.QuickUnlockMode.PIN];
17 /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
18 this.activeModes = [];
19 /** @type {!Array<string>} */ this.credentials = [];
20 /** @type {string} */ this.accountPassword = '';
21 }
22
23 FakeQuickUnlockPrivate.prototype = {
24 // Public testing methods.
25 /**
26 * @override
27 * @param {function(
28 * !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
29 */
30 getAvailableModes: function(onComplete) {
31 onComplete(this.availableModes);
32 },
33
34 /**
35 * @override
36 * @param {function(
37 * !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
38 */
39 getActiveModes: function(onComplete) {
40 onComplete(this.activeModes);
41 },
42
43 /**
44 * @override
45 * @param {string} accountPassword
46 * @param {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} modes
47 * @param {!Array<string>} credentials
48 * @param {function(boolean):void} onComplete
49 */
50 setModes: function(accountPassword, modes, credentials, onComplete) {
51 // Even if the account password is wrong we still update activeModes and
52 // credentials so that the mock owner has a chance to see what was given
53 // to the API.
54 this.activeModes = modes;
55 this.credentials = credentials;
56 onComplete(this.accountPassword == accountPassword);
57 }
58 };
59
60 /** @type {!ChromeEvent} */
61 FakeQuickUnlockPrivate.prototype.onActiveModesChanged = new FakeChromeEvent();
62
63 return {FakeQuickUnlockPrivate: FakeQuickUnlockPrivate};
64 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698