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

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

Issue 2796783005: MD Settings: Google Play Store: Add subpage and polish (Take 2) (Closed)
Patch Set: nit Created 3 years, 8 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/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('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/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 95a80c2afb185f8cf16eeabf951dc6cd0098b879..f5e2daceb010e04a6ff2d0a821576192b512d6ca 100644
--- a/chrome/test/data/webui/settings/android_apps_page_test.js
+++ b/chrome/test/data/webui/settings/android_apps_page_test.js
@@ -12,9 +12,6 @@ function TestAndroidAppsBrowserProxy() {
'requestAndroidAppsInfo',
'showAndroidAppsSettings',
]);
-
- /** @private {!AndroidAppsInfo} */
- this.androidAppsInfo_ = {appReady: false};
}
TestAndroidAppsBrowserProxy.prototype = {
@@ -23,12 +20,19 @@ TestAndroidAppsBrowserProxy.prototype = {
/** @override */
requestAndroidAppsInfo: function() {
this.methodCalled('requestAndroidAppsInfo');
+ cr.webUIListenerCallback('android-apps-info-update', {appReady: false});
},
/** override */
showAndroidAppsSettings: function(keyboardAction) {
this.methodCalled('showAndroidAppsSettings');
},
+
+ setAppReady: function(ready) {
+ // 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});
+ },
};
/** @type {?SettingsAndroidAppsPageElement} */
@@ -44,72 +48,99 @@ suite('AndroidAppsPageTests', function() {
PolymerTest.clearBody();
androidAppsPage = document.createElement('settings-android-apps-page');
document.body.appendChild(androidAppsPage);
+ testing.Test.disableAnimationsAndTransitions();
+ });
+
+ teardown(function() {
+ androidAppsPage.remove();
+ });
+
+ suite('Main Page', function() {
+ setup(function() {
+ androidAppsPage.prefs = {arc: {enabled: {value: false}}};
+ Polymer.dom.flush();
+
+ return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
+ .then(function() {
+ androidAppsBrowserProxy.setAppReady(false);
+ });
+ });
+
+ test('Enable', function() {
+ var button = androidAppsPage.$$('#enable');
+ assertTrue(!!button);
+ assertFalse(!!androidAppsPage.$$('.subpage-arrow'));
+
+ MockInteractions.tap(button);
+ Polymer.dom.flush();
+ assertTrue(androidAppsPage.prefs.arc.enabled.value);
+
+ androidAppsBrowserProxy.setAppReady(true);
+ Polymer.dom.flush();
+ assertTrue(!!androidAppsPage.$$('.subpage-arrow'));
+ });
});
- 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 control = androidAppsPage.$$('#enabled');
- assertTrue(!!control);
- assertFalse(control.disabled);
- assertFalse(control.checked);
- var managed = androidAppsPage.$$('#manageApps');
- assertTrue(!!managed);
- assertTrue(managed.hidden);
-
- MockInteractions.tap(control.$.control);
- Polymer.dom.flush();
- assertTrue(control.checked);
- });
+ suite('SubPage', function() {
+ var subpage;
+
+ setup(function() {
+ androidAppsPage.prefs = {arc: {enabled: {value: true}}};
+ return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
+ .then(function() {
+ androidAppsBrowserProxy.setAppReady(true);
+ MockInteractions.tap(androidAppsPage.$$('#android-apps'));
+ Polymer.dom.flush();
+ subpage = androidAppsPage.$$('settings-android-apps-subpage');
+ assertTrue(!!subpage);
+ });
+ });
+
+ test('Sanity', function() {
+ assertTrue(!!subpage.$$('#manageApps'));
+ assertTrue(!!subpage.$$('#remove'));
+ });
+
+ test('Disable', function() {
+ var dialog = subpage.$$('#confirmDisableDialog');
+ assertTrue(!!dialog);
+ assertFalse(dialog.open);
+
+ var remove = subpage.$$('#remove');
+ assertTrue(!!remove);
+ MockInteractions.tap(remove);
+
+ Polymer.dom.flush();
+ assertTrue(dialog.open);
+ });
});
- 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 control = androidAppsPage.$$('#enabled');
- assertTrue(!!control);
- assertFalse(control.disabled);
- assertTrue(control.checked);
- var managed = androidAppsPage.$$('#manageApps');
- assertTrue(!!managed);
- assertFalse(managed.hidden);
-
- MockInteractions.tap(control.$.control);
- 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(control.checked);
- assertTrue(managed.hidden);
- });
+ suite('Enforced', function() {
+ var subpage;
+
+ setup(function() {
+ androidAppsPage.prefs = {
+ arc: {
+ enabled: {
+ value: true,
+ enforcement: chrome.settingsPrivate.Enforcement.ENFORCED
+ }
+ }
+ };
+ return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo')
+ .then(function() {
+ androidAppsBrowserProxy.setAppReady(true);
+ MockInteractions.tap(androidAppsPage.$$('#android-apps'));
+ Polymer.dom.flush();
+ subpage = androidAppsPage.$$('settings-android-apps-subpage');
+ assertTrue(!!subpage);
+ });
+ });
+
+ test('Sanity', function() {
+ Polymer.dom.flush();
+ assertTrue(!!subpage.$$('#manageApps'));
+ assertFalse(!!subpage.$$('#remove'));
+ });
});
});
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698