OLD | NEW |
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 {TestBrowserProxy} | 9 * @extends {TestBrowserProxy} |
10 */ | 10 */ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 setup(function() { | 81 setup(function() { |
82 browserProxy = new TestManageProfileBrowserProxy(); | 82 browserProxy = new TestManageProfileBrowserProxy(); |
83 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy; | 83 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy; |
84 PolymerTest.clearBody(); | 84 PolymerTest.clearBody(); |
85 manageProfile = document.createElement('settings-manage-profile'); | 85 manageProfile = document.createElement('settings-manage-profile'); |
86 manageProfile.profileIconUrl = 'fake-icon-1.png'; | 86 manageProfile.profileIconUrl = 'fake-icon-1.png'; |
87 manageProfile.profileName = 'Initial Fake Name'; | 87 manageProfile.profileName = 'Initial Fake Name'; |
88 manageProfile.syncStatus = {supervisedUser: false, childUser: false}; | 88 manageProfile.syncStatus = {supervisedUser: false, childUser: false}; |
89 document.body.appendChild(manageProfile); | 89 document.body.appendChild(manageProfile); |
90 settings.navigateTo(settings.Route.MANAGE_PROFILE); | 90 settings.navigateTo(settings.routes.MANAGE_PROFILE); |
91 }); | 91 }); |
92 | 92 |
93 teardown(function() { manageProfile.remove(); }); | 93 teardown(function() { manageProfile.remove(); }); |
94 | 94 |
95 // Tests that the manage profile subpage | 95 // Tests that the manage profile subpage |
96 // - gets and receives all the available icons | 96 // - gets and receives all the available icons |
97 // - can select a new icon | 97 // - can select a new icon |
98 test('ManageProfileChangeIcon', function() { | 98 test('ManageProfileChangeIcon', function() { |
99 var items = null; | 99 var items = null; |
100 return browserProxy.whenCalled('getAvailableIcons') | 100 return browserProxy.whenCalled('getAvailableIcons') |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 manageProfile.profileName = 'Initial Fake Name'; | 186 manageProfile.profileName = 'Initial Fake Name'; |
187 manageProfile.syncStatus = {supervisedUser: false, childUser: false}; | 187 manageProfile.syncStatus = {supervisedUser: false, childUser: false}; |
188 document.body.appendChild(manageProfile); | 188 document.body.appendChild(manageProfile); |
189 }); | 189 }); |
190 | 190 |
191 teardown(function() { manageProfile.remove(); }); | 191 teardown(function() { manageProfile.remove(); }); |
192 | 192 |
193 // Tests profile shortcut toggle is visible and toggling it removes and | 193 // Tests profile shortcut toggle is visible and toggling it removes and |
194 // creates the profile shortcut respectively. | 194 // creates the profile shortcut respectively. |
195 test('ManageProfileShortcutToggle', function() { | 195 test('ManageProfileShortcutToggle', function() { |
196 settings.navigateTo(settings.Route.MANAGE_PROFILE); | 196 settings.navigateTo(settings.routes.MANAGE_PROFILE); |
197 Polymer.dom.flush(); | 197 Polymer.dom.flush(); |
198 | 198 |
199 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); | 199 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); |
200 | 200 |
201 return browserProxy.whenCalled('getProfileShortcutStatus') | 201 return browserProxy.whenCalled('getProfileShortcutStatus') |
202 .then(function() { | 202 .then(function() { |
203 Polymer.dom.flush(); | 203 Polymer.dom.flush(); |
204 | 204 |
205 var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle'); | 205 var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle'); |
206 assertTrue(!!hasShortcutToggle); | 206 assertTrue(!!hasShortcutToggle); |
(...skipping 16 matching lines...) Expand all Loading... |
223 }); | 223 }); |
224 }); | 224 }); |
225 }); | 225 }); |
226 | 226 |
227 // Tests profile shortcut toggle is visible and toggled off when no | 227 // Tests profile shortcut toggle is visible and toggled off when no |
228 // profile shortcut is found. | 228 // profile shortcut is found. |
229 test('ManageProfileShortcutToggle', function() { | 229 test('ManageProfileShortcutToggle', function() { |
230 browserProxy.setProfileShortcutStatus( | 230 browserProxy.setProfileShortcutStatus( |
231 ProfileShortcutStatus.PROFILE_SHORTCUT_NOT_FOUND); | 231 ProfileShortcutStatus.PROFILE_SHORTCUT_NOT_FOUND); |
232 | 232 |
233 settings.navigateTo(settings.Route.MANAGE_PROFILE); | 233 settings.navigateTo(settings.routes.MANAGE_PROFILE); |
234 Polymer.dom.flush(); | 234 Polymer.dom.flush(); |
235 | 235 |
236 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); | 236 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); |
237 | 237 |
238 return browserProxy.whenCalled('getProfileShortcutStatus') | 238 return browserProxy.whenCalled('getProfileShortcutStatus') |
239 .then(function() { | 239 .then(function() { |
240 Polymer.dom.flush(); | 240 Polymer.dom.flush(); |
241 | 241 |
242 var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle'); | 242 var hasShortcutToggle = manageProfile.$$('#hasShortcutToggle'); |
243 assertTrue(!!hasShortcutToggle); | 243 assertTrue(!!hasShortcutToggle); |
244 | 244 |
245 assertFalse(hasShortcutToggle.checked); | 245 assertFalse(hasShortcutToggle.checked); |
246 }); | 246 }); |
247 }); | 247 }); |
248 | 248 |
249 // Tests the case when the profile shortcut setting is hidden. This can | 249 // Tests the case when the profile shortcut setting is hidden. This can |
250 // occur in the single profile case. | 250 // occur in the single profile case. |
251 test('ManageProfileShortcutSettingHIdden', function() { | 251 test('ManageProfileShortcutSettingHIdden', function() { |
252 browserProxy.setProfileShortcutStatus( | 252 browserProxy.setProfileShortcutStatus( |
253 ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN); | 253 ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN); |
254 | 254 |
255 settings.navigateTo(settings.Route.MANAGE_PROFILE); | 255 settings.navigateTo(settings.routes.MANAGE_PROFILE); |
256 Polymer.dom.flush(); | 256 Polymer.dom.flush(); |
257 | 257 |
258 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); | 258 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); |
259 | 259 |
260 return browserProxy.whenCalled('getProfileShortcutStatus') | 260 return browserProxy.whenCalled('getProfileShortcutStatus') |
261 .then(function() { | 261 .then(function() { |
262 Polymer.dom.flush(); | 262 Polymer.dom.flush(); |
263 | 263 |
264 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); | 264 assertFalse(!!manageProfile.$$('#hasShortcutToggle')); |
265 }); | 265 }); |
266 }); | 266 }); |
267 }); | 267 }); |
268 } | 268 } |
269 | 269 |
270 return { | 270 return { |
271 registerTests: function() { | 271 registerTests: function() { |
272 registerManageProfileTests(); | 272 registerManageProfileTests(); |
273 }, | 273 }, |
274 }; | 274 }; |
275 }); | 275 }); |
OLD | NEW |