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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
diff --git a/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js b/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
new file mode 100644
index 0000000000000000000000000000000000000000..78a2ca08fe94aeeb0c45911ee13dc16b3f681474
--- /dev/null
+++ b/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
@@ -0,0 +1,135 @@
+// 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 Suite of tests for Easy Unlock within People section. */
+
+GEN_INCLUDE(['settings_page_browsertest.js']);
+
+/**
+ * @constructor
+ * @extends {SettingsPageBrowserTest}
+*/
+function SettingsEasyUnlockBrowserTest() {
+}
+
+SettingsEasyUnlockBrowserTest.prototype = {
+ __proto__: SettingsPageBrowserTest.prototype,
+
+ /** @override */
+ extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([
+ ROOT_PATH + 'ui/webui/resources/js/promise_resolver.js',
+ 'test_browser_proxy.js',
+ ]),
+};
+
+// Times out on debug builders and may time out on memory bots because
+// the Settings page can take several seconds to load in a Release build
+// and several times that in a Debug build. See https://crbug.com/558434.
+GEN('#if defined(MEMORY_SANITIZER) || !defined(NDEBUG)');
+GEN('#define MAYBE_EasyUnlock DISABLED_EasyUnlock');
+GEN('#else');
+GEN('#define MAYBE_EasyUnlock EasyUnlock');
+GEN('#endif');
+
+// Runs change picture tests.
+TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
+ /**
+ * A test version of EasyUnlockBrowserProxy. Provides helper methods
+ * for allowing tests to know when a method was called, as well as
+ * specifying mock responses.
+ *
+ * @constructor
+ * @implements {settings.EasyUnlockBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+ var TestEasyUnlockBrowserProxy = function() {
+ settings.TestBrowserProxy.call(this, [
+ 'getEnabledStatus',
+ 'launchSetup',
+ ]);
+
+ /** @private {boolean} */
+ this.isEnabled_ = false;
+ };
+
+ TestEasyUnlockBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /**
+ * @param {boolean} easyUnlockEnabled
+ */
+ setEnabledStatus: function(easyUnlockEnabled) {
+ this.isEnabled_ = easyUnlockEnabled;
+ },
+
+ /** @override */
+ getEnabledStatus: function() {
+ this.methodCalled('getEnabledStatus');
+ return Promise.resolve(this.isEnabled_);
+ },
+
+ /** @override */
+ launchSetup: function() {
+ this.methodCalled('launchSetup');
+ },
+ };
+
+ /** @type {?SettingsPeoplePageElement} */
+ var page = null;
+
+ /** @type {?TestEasyUnlockBrowserProxy} */
+ var browserProxy = null;
+
+ suite('SettingsEasyUnlock', function() {
+ setup(function() {
+ 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
+ loadTimeData.overrideValues({
+ easyUnlockAllowed: true,
+ easyUnlockEnabled: false,
+
+ easyUnlockSectionTitle: '',
+ easyUnlockLearnMoreURL: '',
+ easyUnlockSetupIntro: '',
+ easyUnlockSetupButton: 'Setup',
+ });
+
+ browserProxy = new TestEasyUnlockBrowserProxy();
+ settings.EasyUnlockBrowserProxyImpl.instance_ = browserProxy;
+
+ // Before clearing the body, save a copy of the real prefs so we can
+ // cleanly re-create the People page element.
+ var prefs = document.querySelector(
+ 'cr-settings').$$('settings-prefs').prefs;
+
+ PolymerTest.clearBody();
+ page = document.createElement('settings-people-page');
+ page.currentRoute = {
+ page: 'basic',
+ section: '',
+ subpage: [],
+ };
+ page.prefs = prefs;
+
+ document.body.appendChild(page);
+ });
+
+ test('setup button', function() {
+ return browserProxy.whenCalled('getEnabledStatus').then(function() {
+ assertTrue(page.easyUnlockAllowed_);
+ expectFalse(page.easyUnlockEnabled_);
+
+ Polymer.dom.flush();
+
+ var setupButton = page.$$('#easyUnlockSetup');
+ assertTrue(!!setupButton);
+
+ MockInteractions.tap(setupButton);
+ return browserProxy.whenCalled('launchSetup');
+ });
+ });
+ });
+
+ // Run all registered tests.
+ mocha.run();
+});
« 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