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

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

Issue 2541923002: MD Settings: Add Google Play Store (Arc++) section (Closed)
Patch Set: . Created 4 years 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/android_apps_page_test.js
diff --git a/chrome/test/data/webui/settings/android_apps_page_test.js b/chrome/test/data/webui/settings/android_apps_page_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a5de50e672996ce4128a21a67a06cd1ee59483a6
--- /dev/null
+++ b/chrome/test/data/webui/settings/android_apps_page_test.js
@@ -0,0 +1,101 @@
+// 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.
+
+/**
+ * @constructor
+ * @implements {settings.AndroidAppsBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+function TestAndroidAppsBrowserProxy() {
+ settings.TestBrowserProxy.call(this, [
+ 'getAndroidAppsInfo',
+ 'showAndroidAppsSettings',
+ ]);
+
+ /** @private {!AndroidAppsInfo} */
+ this.androidAppsInfo_ = {appReady: false};
+}
+
+TestAndroidAppsBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ getAndroidAppsInfo: function() {
+ this.methodCalled('getAndroidAppsInfo');
+ return Promise.resolve(this.androidAppsInfo_);
+ },
+
+ /** override */
+ showAndroidAppsSettings: function() {
+ this.methodCalled('showAndroidAppsSettings');
+ },
+};
+
+/** @type {?SettingsAndroidAppsPageElement} */
+var androidAppsPage = null;
+
+/** @type {?TestAndroidAppsBrowserProxy} */
+var androidAppsBrowserProxy = null;
+
+suite('AndroidAppsPageTests', function() {
+ setup(function() {
+ androidAppsBrowserProxy = new TestAndroidAppsBrowserProxy();
+ settings.AndroidAppsBrowserProxyImpl.instance_ = androidAppsBrowserProxy;
+ PolymerTest.clearBody();
+ androidAppsPage = document.createElement('settings-android-apps-page');
+ document.body.appendChild(androidAppsPage);
+ });
+
+ teardown(function() { androidAppsPage.remove(); });
+
+ test('Enable', function() {
+ return androidAppsBrowserProxy.whenCalled('getAndroidAppsInfo')
+ .then(function() {
+ androidAppsPage.prefs = {
+ arc: {
+ enabled: {
+ value: false,
+ },
+ },
+ };
+ Polymer.dom.flush();
+ var checkbox = androidAppsPage.$$('#enabledCheckbox');
+ assertTrue(!!checkbox);
+ assertFalse(checkbox.disabled);
+ assertFalse(checkbox.checked);
+ MockInteractions.tap(checkbox.$.checkbox);
+ Polymer.dom.flush();
+ assertTrue(checkbox.checked);
+ });
+ });
+
+ test('Disable', function() {
+ return androidAppsBrowserProxy.whenCalled('getAndroidAppsInfo')
+ .then(function() {
+ androidAppsPage.prefs = {
+ arc: {
+ enabled: {
+ value: true,
+ },
+ },
+ };
+ Polymer.dom.flush();
+ var checkbox = androidAppsPage.$$('#enabledCheckbox');
+ assertTrue(!!checkbox);
+ assertFalse(checkbox.disabled);
+ assertTrue(checkbox.checked);
+ MockInteractions.tap(checkbox.$.checkbox);
+ Polymer.dom.flush();
+ var dialog = androidAppsPage.$$('#confirmDisableDialog');
+ assertTrue(!!dialog);
+ assertTrue(dialog.open);
+ var actionButton =
+ androidAppsPage.$$('dialog paper-button.action-button');
+ assertTrue(!!actionButton);
+ MockInteractions.tap(actionButton);
+ Polymer.dom.flush();
+ assertFalse(checkbox.checked);
+ });
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698