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

Side by Side 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: Addressed comments 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/webui/md_user_manager/test_profile_browser_proxy.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('settings_people_page_manage_profile', function() { 5 cr.define('settings_people_page_manage_profile', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @implements {settings.ManageProfileBrowserProxy} 8 * @implements {settings.ManageProfileBrowserProxy}
9 * @extends {settings.TestBrowserProxy} 9 * @extends {settings.TestBrowserProxy}
10 */ 10 */
11 var TestManageProfileBrowserProxy = function() { 11 var TestManageProfileBrowserProxy = function() {
12 settings.TestBrowserProxy.call(this, [ 12 settings.TestBrowserProxy.call(this, [
13 'getAvailableIcons', 13 'getAvailableIcons',
14 'setProfileIconAndName', 14 'setProfileIconAndName',
15 'getHasProfileShortcut',
16 'addProfileShortcut',
17 'removeProfileShortcut',
15 ]); 18 ]);
16 }; 19 };
17 20
18 TestManageProfileBrowserProxy.prototype = { 21 TestManageProfileBrowserProxy.prototype = {
19 __proto__: settings.TestBrowserProxy.prototype, 22 __proto__: settings.TestBrowserProxy.prototype,
20 23
21 /** @override */ 24 /** @override */
22 getAvailableIcons: function() { 25 getAvailableIcons: function() {
23 this.methodCalled('getAvailableIcons'); 26 this.methodCalled('getAvailableIcons');
24 return Promise.resolve([{url: 'fake-icon-1.png', label: 'fake-icon-1'}, 27 return Promise.resolve([{url: 'fake-icon-1.png', label: 'fake-icon-1'},
25 {url: 'fake-icon-2.png', label: 'fake-icon-2'}]); 28 {url: 'fake-icon-2.png', label: 'fake-icon-2'}]);
26 }, 29 },
27 30
28 /** @override */ 31 /** @override */
29 setProfileIconAndName: function(iconUrl, name) { 32 setProfileIconAndName: function(iconUrl, name) {
30 this.methodCalled('setProfileIconAndName', [iconUrl, name]); 33 this.methodCalled('setProfileIconAndName', [iconUrl, name]);
31 }, 34 },
35
36 getHasProfileShortcut: function() {
37 this.methodCalled('getHasProfileShortcut');
38 return Promise.resolve(true);
39 },
40
41 /** @override */
42 addProfileShortcut: function() {
43 this.methodCalled('addProfileShortcut');
44 },
45
46 /** @override */
47 removeProfileShortcut: function() {
48 this.methodCalled('removeProfileShortcut');
49 },
32 }; 50 };
33 51
34 function registerManageProfileTests() { 52 function registerManageProfileTests() {
35 suite('ManageProfileTests', function() { 53 suite('ManageProfileTests', function() {
36 var manageProfile = null; 54 var manageProfile = null;
37 var browserProxy = null; 55 var browserProxy = null;
38 56
39 setup(function() { 57 setup(function() {
40 browserProxy = new TestManageProfileBrowserProxy(); 58 browserProxy = new TestManageProfileBrowserProxy();
41 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy; 59 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy;
42 PolymerTest.clearBody(); 60 PolymerTest.clearBody();
43 manageProfile = document.createElement('settings-manage-profile'); 61 manageProfile = document.createElement('settings-manage-profile');
44 manageProfile.profileIconUrl = 'fake-icon-1.png'; 62 manageProfile.profileIconUrl = 'fake-icon-1.png';
45 manageProfile.profileName = 'Initial Fake Name'; 63 manageProfile.profileName = 'Initial Fake Name';
46 manageProfile.syncStatus = {supervisedUser: false, childUser: false}; 64 manageProfile.syncStatus = {supervisedUser: false, childUser: false};
47 document.body.appendChild(manageProfile); 65 document.body.appendChild(manageProfile);
66 settings.navigateTo(settings.Route.MANAGE_PROFILE);
48 }); 67 });
49 68
50 teardown(function() { manageProfile.remove(); }); 69 teardown(function() { manageProfile.remove(); });
51 70
52 // Tests that the manage profile subpage 71 // Tests that the manage profile subpage
53 // - gets and receives all the available icons 72 // - gets and receives all the available icons
54 // - has the correct icon selected 73 // - has the correct icon selected
55 // - can select a new icon 74 // - can select a new icon
56 test('ManageProfileChangeIcon', function() { 75 test('ManageProfileChangeIcon', function() {
57 var selector = manageProfile.$.selector.$['avatar-grid']; 76 var selector = manageProfile.$.selector.$['avatar-grid'];
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 assertTrue(!!nameField); 143 assertTrue(!!nameField);
125 144
126 return browserProxy.whenCalled('getAvailableIcons').then(function() { 145 return browserProxy.whenCalled('getAvailableIcons').then(function() {
127 manageProfile.profileName = 'New Name From Browser'; 146 manageProfile.profileName = 'New Name From Browser';
128 147
129 Polymer.dom.flush(); 148 Polymer.dom.flush();
130 149
131 assertEquals('New Name From Browser', nameField.value); 150 assertEquals('New Name From Browser', nameField.value);
132 }); 151 });
133 }); 152 });
153
154 // Tests profile shortcut toggle is hidden if profile shortcuts feature is
155 // disabled.
156 test('ManageProfileShortcutToggleHidden', function() {
157 var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle');
158 assertFalse(!!hasShortcutToggle);
159 });
160 });
161
162 suite('ManageProfileTestsProfileShortcutsEnabled', function() {
163 var manageProfile = null;
164 var browserProxy = null;
165
166 setup(function() {
167 loadTimeData.overrideValues({
168 profileShortcutsEnabled: true,
169 });
170
171 browserProxy = new TestManageProfileBrowserProxy();
172 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy;
173 PolymerTest.clearBody();
174 manageProfile = document.createElement('settings-manage-profile');
175 manageProfile.profileIconUrl = 'fake-icon-1.png';
176 manageProfile.profileName = 'Initial Fake Name';
177 manageProfile.syncStatus = {supervisedUser: false, childUser: false};
178 document.body.appendChild(manageProfile);
179 settings.navigateTo(settings.Route.MANAGE_PROFILE);
180 Polymer.dom.flush();
181 });
182
183 teardown(function() { manageProfile.remove(); });
184
185 // Tests profile shortcut toggle is visible and toggling it removes and
186 // creates the profile shortcut respectively.
187 test('ManageProfileShortcutToggle', function() {
188 var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle');
189 assertTrue(!!hasShortcutToggle);
190
191 return browserProxy.whenCalled('getHasProfileShortcut')
192 .then(function() {
193 Polymer.dom.flush();
194
195 // The profile shortcut toggle is checked.
196 assertTrue(hasShortcutToggle.active);
197
198 // Simulate tapping the profile shortcut toggle.
199 MockInteractions.tap(hasShortcutToggle);
200 return browserProxy.whenCalled('removeProfileShortcut')
201 .then(function() {
202 Polymer.dom.flush();
203
204 // The profile shortcut toggle is checked.
205 assertFalse(hasShortcutToggle.active);
206
207 // Simulate tapping the profile shortcut toggle.
208 MockInteractions.tap(hasShortcutToggle);
209 return browserProxy.whenCalled('addProfileShortcut');
210 });
211 });
212 });
134 }); 213 });
135 } 214 }
136 215
137 return { 216 return {
138 registerTests: function() { 217 registerTests: function() {
139 registerManageProfileTests(); 218 registerManageProfileTests();
140 }, 219 },
141 }; 220 };
142 }); 221 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_user_manager/test_profile_browser_proxy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698