| 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('user_manager.create_profile_tests', function() { | 5 cr.define('user_manager.create_profile_tests', function() { |
| 6 /** @return {!CreateProfileElement} */ | 6 /** @return {!CreateProfileElement} */ |
| 7 function createElement() { | 7 function createElement() { |
| 8 PolymerTest.clearBody(); | 8 PolymerTest.clearBody(); |
| 9 var createProfileElement = document.createElement('create-profile'); | 9 var createProfileElement = document.createElement('create-profile'); |
| 10 document.body.appendChild(createProfileElement); | 10 document.body.appendChild(createProfileElement); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 }); | 105 }); |
| 106 | 106 |
| 107 test('Create a profile', function() { | 107 test('Create a profile', function() { |
| 108 // Simulate clicking 'Create'. | 108 // Simulate clicking 'Create'. |
| 109 MockInteractions.tap(createProfileElement.$.save); | 109 MockInteractions.tap(createProfileElement.$.save); |
| 110 | 110 |
| 111 return browserProxy.whenCalled('createProfile').then(function(args) { | 111 return browserProxy.whenCalled('createProfile').then(function(args) { |
| 112 assertEquals('profile name', args.profileName); | 112 assertEquals('profile name', args.profileName); |
| 113 assertEquals('icon1.png', args.profileIconUrl); | 113 assertEquals('icon1.png', args.profileIconUrl); |
| 114 assertFalse(args.isSupervised); | 114 assertFalse(args.isSupervised); |
| 115 assertEquals('', args.supervisedUserId); |
| 115 assertEquals('', args.custodianProfilePath); | 116 assertEquals('', args.custodianProfilePath); |
| 116 }); | 117 }); |
| 117 }); | 118 }); |
| 118 | 119 |
| 119 test('Has to select a custodian for the supervised profile', function() { | 120 test('Has to select a custodian for the supervised profile', function() { |
| 120 // Simulate checking the checkbox. | 121 // Simulate checking the checkbox. |
| 121 MockInteractions.tap(createProfileElement.$$('paper-checkbox')); | 122 MockInteractions.tap(createProfileElement.$$('paper-checkbox')); |
| 122 Polymer.dom.flush(); | 123 Polymer.dom.flush(); |
| 123 | 124 |
| 124 // Simulate clicking 'Create'. | 125 // Simulate clicking 'Create'. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 var paperMenu = dropdownMenu.querySelector('paper-menu'); | 203 var paperMenu = dropdownMenu.querySelector('paper-menu'); |
| 203 paperMenu.selected = 0; | 204 paperMenu.selected = 0; |
| 204 | 205 |
| 205 // Simulate clicking 'Create'. | 206 // Simulate clicking 'Create'. |
| 206 MockInteractions.tap(createProfileElement.$.save); | 207 MockInteractions.tap(createProfileElement.$.save); |
| 207 | 208 |
| 208 return browserProxy.whenCalled('createProfile').then(function(args) { | 209 return browserProxy.whenCalled('createProfile').then(function(args) { |
| 209 assertEquals('profile name', args.profileName); | 210 assertEquals('profile name', args.profileName); |
| 210 assertEquals('icon1.png', args.profileIconUrl); | 211 assertEquals('icon1.png', args.profileIconUrl); |
| 211 assertTrue(args.isSupervised); | 212 assertTrue(args.isSupervised); |
| 213 assertEquals('', args.supervisedUserId); |
| 212 assertEquals('path/to/profile', args.custodianProfilePath); | 214 assertEquals('path/to/profile', args.custodianProfilePath); |
| 213 }); | 215 }); |
| 214 }); | 216 }); |
| 215 | 217 |
| 216 test('Cancel creating a profile', function() { | 218 test('Cancel creating a profile', function() { |
| 217 // Simulate clicking 'Create'. | 219 // Simulate clicking 'Create'. |
| 218 MockInteractions.tap(createProfileElement.$.save); | 220 MockInteractions.tap(createProfileElement.$.save); |
| 219 | 221 |
| 220 return browserProxy.whenCalled('createProfile').then(function(args) { | 222 return browserProxy.whenCalled('createProfile').then(function(args) { |
| 221 // The 'Save' button is disabled when create is in progress. | 223 // The 'Save' button is disabled when create is in progress. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 test('Create button is disabled', function() { | 347 test('Create button is disabled', function() { |
| 346 assertTrue(createProfileElement.$.save.disabled); | 348 assertTrue(createProfileElement.$.save.disabled); |
| 347 }); | 349 }); |
| 348 }); | 350 }); |
| 349 } | 351 } |
| 350 | 352 |
| 351 return { | 353 return { |
| 352 registerTests: registerTests, | 354 registerTests: registerTests, |
| 353 }; | 355 }; |
| 354 }); | 356 }); |
| OLD | NEW |