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

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: Fix tests 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
« no previous file with comments | « chrome/common/url_constants.cc ('k') | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..52d8bc41441296b80ffdf6d5a4c85252b8009f98
--- /dev/null
+++ b/chrome/test/data/webui/settings/android_apps_page_test.js
@@ -0,0 +1,115 @@
+// 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, [
+ 'requestAndroidAppsInfo',
+ 'showAndroidAppsSettings',
+ ]);
+
+ /** @private {!AndroidAppsInfo} */
+ this.androidAppsInfo_ = {appReady: false};
+}
+
+TestAndroidAppsBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ requestAndroidAppsInfo: function() {
+ this.methodCalled('requestAndroidAppsInfo');
+ },
+
+ /** override */
+ showAndroidAppsSettings: function(keyboardAction) {
+ 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('requestAndroidAppsInfo')
+ .then(function() {
+ androidAppsPage.prefs = {
+ arc: {
+ enabled: {
+ value: false,
+ },
+ },
+ };
+ cr.webUIListenerCallback(
+ 'android-apps-info-update', {appReady: false});
+ Polymer.dom.flush();
+ var checkbox = androidAppsPage.$$('#enabledCheckbox');
+ assertTrue(!!checkbox);
+ assertFalse(checkbox.disabled);
+ assertFalse(checkbox.checked);
+ var managed = androidAppsPage.$$('#manageApps');
+ assertTrue(!!managed);
+ assertTrue(managed.hidden);
+
+ MockInteractions.tap(checkbox.$.checkbox);
+ Polymer.dom.flush();
+ assertTrue(checkbox.checked);
+ });
+ });
+
+ test('Disable', function() {
+ return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
+ .then(function() {
+ androidAppsPage.prefs = {
+ arc: {
+ enabled: {
+ value: true,
+ },
+ },
+ };
+ cr.webUIListenerCallback(
+ 'android-apps-info-update', {appReady: true});
+ Polymer.dom.flush();
+ var checkbox = androidAppsPage.$$('#enabledCheckbox');
+ assertTrue(!!checkbox);
+ assertFalse(checkbox.disabled);
+ assertTrue(checkbox.checked);
+ var managed = androidAppsPage.$$('#manageApps');
+ assertTrue(!!managed);
+ assertFalse(managed.hidden);
+
+ MockInteractions.tap(checkbox.$.checkbox);
+ cr.webUIListenerCallback(
+ 'android-apps-info-update', {appReady: false});
+ 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);
+ assertTrue(managed.hidden);
+ });
+ });
+});
« no previous file with comments | « chrome/common/url_constants.cc ('k') | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698