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

Side by Side Diff: chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js

Issue 1811813002: Settings People Revamp: Easy Unlock: Add browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0107-settings-easy-unlock-add-turn-on-and-off-implementation
Patch Set: Created 4 years, 9 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
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** @fileoverview Suite of tests for Easy Unlock within People section. */
6
7 GEN_INCLUDE(['settings_page_browsertest.js']);
8
9 /**
10 * @constructor
11 * @extends {SettingsPageBrowserTest}
12 */
13 function SettingsEasyUnlockBrowserTest() {
14 }
15
16 SettingsEasyUnlockBrowserTest.prototype = {
17 __proto__: SettingsPageBrowserTest.prototype,
18
19 /** @override */
20 extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([
21 ROOT_PATH + 'ui/webui/resources/js/promise_resolver.js',
22 'test_browser_proxy.js',
23 ]),
24 };
25
26 // Times out on debug builders and may time out on memory bots because
27 // the Settings page can take several seconds to load in a Release build
28 // and several times that in a Debug build. See https://crbug.com/558434.
29 GEN('#if defined(MEMORY_SANITIZER) || !defined(NDEBUG)');
30 GEN('#define MAYBE_EasyUnlock DISABLED_EasyUnlock');
31 GEN('#else');
32 GEN('#define MAYBE_EasyUnlock EasyUnlock');
33 GEN('#endif');
34
35 // Runs change picture tests.
36 TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
37 /**
38 * A test version of EasyUnlockBrowserProxy. Provides helper methods
39 * for allowing tests to know when a method was called, as well as
40 * specifying mock responses.
41 *
42 * @constructor
43 * @implements {settings.EasyUnlockBrowserProxy}
44 * @extends {settings.TestBrowserProxy}
45 */
46 var TestEasyUnlockBrowserProxy = function() {
47 settings.TestBrowserProxy.call(this, [
48 'getEnabledStatus',
49 'launchSetup',
50 ]);
51
52 /** @private {boolean} */
53 this.isEnabled_ = false;
54 };
55
56 TestEasyUnlockBrowserProxy.prototype = {
57 __proto__: settings.TestBrowserProxy.prototype,
58
59 /**
60 * @param {boolean} easyUnlockEnabled
61 */
62 setEnabledStatus: function(easyUnlockEnabled) {
63 this.isEnabled_ = easyUnlockEnabled;
64 },
65
66 /** @override */
67 getEnabledStatus: function() {
68 this.methodCalled('getEnabledStatus');
69 return Promise.resolve(this.isEnabled_);
70 },
71
72 /** @override */
73 launchSetup: function() {
74 this.methodCalled('launchSetup');
75 },
76 };
77
78 /** @type {?SettingsPeoplePageElement} */
79 var page = null;
80
81 /** @type {?TestEasyUnlockBrowserProxy} */
82 var browserProxy = null;
83
84 suite('SettingsEasyUnlock', function() {
85 setup(function() {
86 assertTrue(loadTimeData.valueExists('easyUnlockAllowed'));
Dan Beam 2016/03/17 01:51:28 yes, this is OK, but why not make this part of you
tommycli 2016/03/17 20:23:11 Done. I just removed this. I don't think it's nece
87 loadTimeData.overrideValues({
88 easyUnlockAllowed: true,
89 easyUnlockEnabled: false,
90
91 easyUnlockSectionTitle: '',
92 easyUnlockLearnMoreURL: '',
93 easyUnlockSetupIntro: '',
94 easyUnlockSetupButton: 'Setup',
95 });
96
97 browserProxy = new TestEasyUnlockBrowserProxy();
98 settings.EasyUnlockBrowserProxyImpl.instance_ = browserProxy;
99
100 // Before clearing the body, save a copy of the real prefs so we can
101 // cleanly re-create the People page element.
102 var prefs = document.querySelector(
103 'cr-settings').$$('settings-prefs').prefs;
104
105 PolymerTest.clearBody();
106 page = document.createElement('settings-people-page');
107 page.currentRoute = {
108 page: 'basic',
109 section: '',
110 subpage: [],
111 };
112 page.prefs = prefs;
113
114 document.body.appendChild(page);
115 });
116
117 test('setup button', function() {
118 return browserProxy.whenCalled('getEnabledStatus').then(function() {
119 assertTrue(page.easyUnlockAllowed_);
120 expectFalse(page.easyUnlockEnabled_);
121
122 Polymer.dom.flush();
123
124 var setupButton = page.$$('#easyUnlockSetup');
125 assertTrue(!!setupButton);
126
127 MockInteractions.tap(setupButton);
128 return browserProxy.whenCalled('launchSetup');
129 });
130 });
131 });
132
133 // Run all registered tests.
134 mocha.run();
135 });
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698