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

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

Issue 2498153002: [MD Settings][MD User Manager] create/manage profile desktop shortcut (Windows only) (Closed)
Patch Set: 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
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 0c63889f5d0ab7660b8547018971f2916d97ee2f..943976bec77b11c1f54c368d0cff11100ed4fd2d 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,6 +12,9 @@ cr.define('settings_people_page_manage_profile', function() {
settings.TestBrowserProxy.call(this, [
'getAvailableIcons',
'setProfileIconAndName',
+ 'hasProfileShortcut',
+ 'addProfileShortcut',
+ 'removeProfileShortcut',
]);
};
@@ -29,6 +32,21 @@ cr.define('settings_people_page_manage_profile', function() {
setProfileIconAndName: function(iconUrl, name) {
this.methodCalled('setProfileIconAndName', [iconUrl, name]);
},
+
+ hasProfileShortcut: function() {
+ this.methodCalled('hasProfileShortcut');
+ return Promise.resolve(true);
+ },
+
+ /** @override */
+ addProfileShortcut: function() {
+ this.methodCalled('addProfileShortcut');
+ },
+
+ /** @override */
+ removeProfileShortcut: function() {
+ this.methodCalled('removeProfileShortcut');
+ },
};
function registerManageProfileTests() {
@@ -45,6 +63,7 @@ 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);
});
teardown(function() { manageProfile.remove(); });
@@ -131,6 +150,64 @@ cr.define('settings_people_page_manage_profile', function() {
assertEquals('New Name From Browser', nameField.value);
});
});
+
+ // Tests profile shortcut toggle is hidden if profile shortcuts feature is
+ // disabled.
+ test('ManageProfileShortcutToggleHidden', function() {
+ var hasShortcutToggle = manageProfile.$.hasShortcutToggle;
+ assertTrue(hasShortcutToggle.clientHeight == 0);
+ });
+ });
+
+ suite('ManageProfileTestsProfileShortcutsEnabled', function() {
+ var manageProfile = null;
+ var browserProxy = null;
+
+ setup(function() {
+ loadTimeData.overrideValues({
+ profileShortcutsEnabled: true,
+ });
+
+ browserProxy = new TestManageProfileBrowserProxy();
+ settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy;
+ PolymerTest.clearBody();
+ manageProfile = document.createElement('settings-manage-profile');
+ manageProfile.profileIconUrl = 'fake-icon-1.png';
+ manageProfile.profileName = 'Initial Fake Name';
+ manageProfile.syncStatus = {supervisedUser: false, childUser: false};
+ document.body.appendChild(manageProfile);
+ settings.navigateTo(settings.Route.MANAGE_PROFILE);
+ });
+
+ teardown(function() { manageProfile.remove(); });
+
+ // Tests profile shortcut toggle is visible and toggle it creates/removes
+ // the profile shortcut.
+ test('ManageProfileShortcutToggle', function() {
+ var hasShortcutToggle = manageProfile.$.hasShortcutToggle;
+ assertTrue(hasShortcutToggle.clientHeight > 0);
+
+ return browserProxy.whenCalled('hasProfileShortcut').then(function() {
+ Polymer.dom.flush();
+
+ // The profile shortcut toggle is checked.
+ assertTrue(hasShortcutToggle.active);
+
+ // Simulate tapping the profile shortcut toggle.
+ MockInteractions.tap(hasShortcutToggle);
+ return browserProxy.whenCalled('removeProfileShortcut')
+ .then(function() {
+ Polymer.dom.flush();
+
+ // The profile shortcut toggle is checked.
+ assertFalse(hasShortcutToggle.active);
+
+ // Simulate tapping the profile shortcut toggle.
+ MockInteractions.tap(hasShortcutToggle);
+ return browserProxy.whenCalled('addProfileShortcut');
+ });
+ });
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698