| 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..c4247a61f042b4c5c33e8ed7ddd1fff2a28505a4 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',
|
| + 'getHasProfileShortcut',
|
| + 'addProfileShortcut',
|
| + 'removeProfileShortcut',
|
| ]);
|
| };
|
|
|
| @@ -29,6 +32,21 @@ cr.define('settings_people_page_manage_profile', function() {
|
| setProfileIconAndName: function(iconUrl, name) {
|
| this.methodCalled('setProfileIconAndName', [iconUrl, name]);
|
| },
|
| +
|
| + getHasProfileShortcut: function() {
|
| + this.methodCalled('getHasProfileShortcut');
|
| + 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,66 @@ 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');
|
| + assertFalse(!!hasShortcutToggle);
|
| + });
|
| + });
|
| +
|
| + 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);
|
| + Polymer.dom.flush();
|
| + });
|
| +
|
| + teardown(function() { manageProfile.remove(); });
|
| +
|
| + // 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);
|
| +
|
| + return browserProxy.whenCalled('getHasProfileShortcut')
|
| + .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');
|
| + });
|
| + });
|
| + });
|
| });
|
| }
|
|
|
|
|