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

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

Issue 2525783002: MD Settings: Hide Profile Shortcut switch for single-profile machines. (Closed)
Patch Set: one more fix to make it actually work Created 4 years, 1 month 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/settings_manage_profile_handler.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/people_page_manage_profile_test.js
diff --git a/chrome/test/data/webui/settings/people_page_manage_profile_test.js b/chrome/test/data/webui/settings/people_page_manage_profile_test.js
index c4247a61f042b4c5c33e8ed7ddd1fff2a28505a4..77fb2a57741b3a0d1526524646b9b10fdbbc57b5 100644
--- a/chrome/test/data/webui/settings/people_page_manage_profile_test.js
+++ b/chrome/test/data/webui/settings/people_page_manage_profile_test.js
@@ -12,15 +12,23 @@ cr.define('settings_people_page_manage_profile', function() {
settings.TestBrowserProxy.call(this, [
'getAvailableIcons',
'setProfileIconAndName',
- 'getHasProfileShortcut',
+ 'getProfileShortcutStatus',
'addProfileShortcut',
'removeProfileShortcut',
]);
+
+ /** @private {!ProfileShortcutStatus} */
+ this.profileShortcutStatus_ = ProfileShortcutStatus.PROFILE_SHORTCUT_FOUND;
};
TestManageProfileBrowserProxy.prototype = {
__proto__: settings.TestBrowserProxy.prototype,
+ /** @param {!ProfileShortcutStatus} status */
+ setProfileShortcutStatus: function(status) {
+ this.profileShortcutStatus_ = status;
+ },
+
/** @override */
getAvailableIcons: function() {
this.methodCalled('getAvailableIcons');
@@ -33,9 +41,10 @@ cr.define('settings_people_page_manage_profile', function() {
this.methodCalled('setProfileIconAndName', [iconUrl, name]);
},
- getHasProfileShortcut: function() {
- this.methodCalled('getHasProfileShortcut');
- return Promise.resolve(true);
+ /** @override */
+ getProfileShortcutStatus: function() {
+ this.methodCalled('getProfileShortcutStatus');
+ return Promise.resolve([this.profileShortcutStatus_]);
},
/** @override */
@@ -176,8 +185,6 @@ cr.define('settings_people_page_manage_profile', function() {
manageProfile.profileName = 'Initial Fake Name';
manageProfile.syncStatus = {supervisedUser: false, childUser: false};
document.body.appendChild(manageProfile);
- settings.navigateTo(settings.Route.MANAGE_PROFILE);
- Polymer.dom.flush();
});
teardown(function() { manageProfile.remove(); });
@@ -185,15 +192,20 @@ cr.define('settings_people_page_manage_profile', function() {
// Tests profile shortcut toggle is visible and toggling it removes and
// creates the profile shortcut respectively.
test('ManageProfileShortcutToggle', function() {
- var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle');
- assertTrue(!!hasShortcutToggle);
+ settings.navigateTo(settings.Route.MANAGE_PROFILE);
+ Polymer.dom.flush();
- return browserProxy.whenCalled('getHasProfileShortcut')
+ assertFalse(!!manageProfile.$$('#hasShortcutToggle'));
+
+ return browserProxy.whenCalled('getProfileShortcutStatus')
.then(function() {
Polymer.dom.flush();
+ var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle');
+ assertTrue(!!hasShortcutToggle);
+
// The profile shortcut toggle is checked.
- assertTrue(hasShortcutToggle.active);
+ assertTrue(hasShortcutToggle.checked);
// Simulate tapping the profile shortcut toggle.
MockInteractions.tap(hasShortcutToggle);
@@ -202,7 +214,7 @@ cr.define('settings_people_page_manage_profile', function() {
Polymer.dom.flush();
// The profile shortcut toggle is checked.
- assertFalse(hasShortcutToggle.active);
+ assertFalse(hasShortcutToggle.checked);
// Simulate tapping the profile shortcut toggle.
MockInteractions.tap(hasShortcutToggle);
@@ -210,6 +222,47 @@ cr.define('settings_people_page_manage_profile', function() {
});
});
});
+
+ // Tests profile shortcut toggle is visible and toggled off when no
+ // profile shortcut is found.
+ test('ManageProfileShortcutToggle', function() {
+ browserProxy.setProfileShortcutStatus(
+ ProfileShortcutStatus.PROFILE_SHORTCUT_NOT_FOUND);
+
+ settings.navigateTo(settings.Route.MANAGE_PROFILE);
+ Polymer.dom.flush();
+
+ assertFalse(!!manageProfile.$$('#hasShortcutToggle'));
+
+ return browserProxy.whenCalled('getProfileShortcutStatus')
+ .then(function() {
+ Polymer.dom.flush();
+
+ var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle');
+ assertTrue(!!hasShortcutToggle);
+
+ assertFalse(hasShortcutToggle.checked);
+ });
+ });
+
+ // Tests the case when the profile shortcut setting is hidden. This can
+ // occur in the single profile case.
+ test('ManageProfileShortcutSettingHIdden', function() {
+ browserProxy.setProfileShortcutStatus(
+ ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN);
+
+ settings.navigateTo(settings.Route.MANAGE_PROFILE);
+ Polymer.dom.flush();
+
+ assertFalse(!!manageProfile.$$('#hasShortcutToggle'));
+
+ return browserProxy.whenCalled('getProfileShortcutStatus')
+ .then(function() {
+ Polymer.dom.flush();
+
+ assertFalse(!!manageProfile.$$('#hasShortcutToggle'));
+ });
+ });
});
}
« no previous file with comments | « chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698