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

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

Issue 2873853002: arc: Handle ARC events in MD Settings (Closed)
Patch Set: Created 3 years, 7 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
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
index f5e2daceb010e04a6ff2d0a821576192b512d6ca..e5d2917efee26024da87209c7de1995b63f16a6b 100644
--- a/chrome/test/data/webui/settings/android_apps_page_test.js
+++ b/chrome/test/data/webui/settings/android_apps_page_test.js
@@ -20,7 +20,7 @@ TestAndroidAppsBrowserProxy.prototype = {
/** @override */
requestAndroidAppsInfo: function() {
this.methodCalled('requestAndroidAppsInfo');
- cr.webUIListenerCallback('android-apps-info-update', {appReady: false});
+ this.setAndroidAppsState(false, false);
},
/** override */
@@ -28,10 +28,13 @@ TestAndroidAppsBrowserProxy.prototype = {
this.methodCalled('showAndroidAppsSettings');
},
- setAppReady: function(ready) {
+ setAndroidAppsState: function(playStoreEnabled, appSettingsAvailable) {
// We need to make sure to pass a new object here, otherwise the property
// change event may not get fired in the listener.
- cr.webUIListenerCallback('android-apps-info-update', {appReady: ready});
+ var appsInfo = {};
+ appsInfo.playStoreEnabled = playStoreEnabled;
+ appsInfo.appSettingsAvailable = appSettingsAvailable;
+ cr.webUIListenerCallback('android-apps-info-update', appsInfo);
},
};
@@ -62,7 +65,7 @@ suite('AndroidAppsPageTests', function() {
return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
.then(function() {
- androidAppsBrowserProxy.setAppReady(false);
+ androidAppsBrowserProxy.setAndroidAppsState(false, false);
});
});
@@ -75,7 +78,7 @@ suite('AndroidAppsPageTests', function() {
Polymer.dom.flush();
assertTrue(androidAppsPage.prefs.arc.enabled.value);
- androidAppsBrowserProxy.setAppReady(true);
+ androidAppsBrowserProxy.setAndroidAppsState(true, false);
Polymer.dom.flush();
assertTrue(!!androidAppsPage.$$('.subpage-arrow'));
});
@@ -88,7 +91,7 @@ suite('AndroidAppsPageTests', function() {
androidAppsPage.prefs = {arc: {enabled: {value: true}}};
return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
.then(function() {
- androidAppsBrowserProxy.setAppReady(true);
+ androidAppsBrowserProxy.setAndroidAppsState(true, false);
MockInteractions.tap(androidAppsPage.$$('#android-apps'));
Polymer.dom.flush();
subpage = androidAppsPage.$$('settings-android-apps-subpage');
@@ -97,8 +100,19 @@ suite('AndroidAppsPageTests', function() {
});
test('Sanity', function() {
- assertTrue(!!subpage.$$('#manageApps'));
assertTrue(!!subpage.$$('#remove'));
+ assertTrue(!!subpage.$$('#manageApps'));
+ });
+
+ test('ManageAppsUpdate', function() {
+ var manageApps = subpage.$$('#manageApps');
+ assertTrue(manageApps.hidden);
+ androidAppsBrowserProxy.setAndroidAppsState(true, true);
+ Polymer.dom.flush();
+ assertFalse(manageApps.hidden);
+ androidAppsBrowserProxy.setAndroidAppsState(true, false);
+ Polymer.dom.flush();
+ assertTrue(manageApps.hidden);
});
test('Disable', function() {
@@ -108,11 +122,28 @@ suite('AndroidAppsPageTests', function() {
var remove = subpage.$$('#remove');
assertTrue(!!remove);
- MockInteractions.tap(remove);
+ // remove button is not always visible immediately after dom flush. This
+ // leads to tap ignoring and test failure. Simulate tap asynchronously.
+ return new Promise(function(resolve, reject) {
+ var validateDialog = function() {
+ MockInteractions.tap(remove);
+ Polymer.dom.flush();
+ assertTrue(dialog.open);
+ resolve();
+ }
+ setTimeout(validateDialog, 0)
+ });
+ });
+
+ test('HideOnDisable', function() {
+ assertEquals(settings.getCurrentRoute(),
+ settings.Route.ANDROID_APPS_DETAILS);
+ androidAppsBrowserProxy.setAndroidAppsState(false, false);
Polymer.dom.flush();
- assertTrue(dialog.open);
+ assertEquals(settings.getCurrentRoute(), settings.Route.ANDROID_APPS);
});
+
});
suite('Enforced', function() {
@@ -129,7 +160,7 @@ suite('AndroidAppsPageTests', function() {
};
return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
.then(function() {
- androidAppsBrowserProxy.setAppReady(true);
+ androidAppsBrowserProxy.setAndroidAppsState(true, true);
MockInteractions.tap(androidAppsPage.$$('#android-apps'));
Polymer.dom.flush();
subpage = androidAppsPage.$$('settings-android-apps-subpage');

Powered by Google App Engine
This is Rietveld 408576698