Chromium Code Reviews| 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_sync_page', function() { | 5 cr.define('settings_people_page_sync_page', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.SyncBrowserProxy} | 8 * @implements {settings.SyncBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
| 10 */ | 10 */ |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 assertTrue(!!syncPage.$$('#create-password-box')); | 256 assertTrue(!!syncPage.$$('#create-password-box')); |
| 257 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); | 257 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); |
| 258 assertTrue(!!saveNewPassphrase); | 258 assertTrue(!!saveNewPassphrase); |
| 259 | 259 |
| 260 // Test that a sync prefs update does not reset the selection. | 260 // Test that a sync prefs update does not reset the selection. |
| 261 cr.webUIListenerCallback('sync-prefs-changed', getSyncAllPrefs()); | 261 cr.webUIListenerCallback('sync-prefs-changed', getSyncAllPrefs()); |
| 262 Polymer.dom.flush(); | 262 Polymer.dom.flush(); |
| 263 assertTrue(encryptWithPassphrase.checked); | 263 assertTrue(encryptWithPassphrase.checked); |
| 264 }); | 264 }); |
| 265 | 265 |
| 266 test('CreatingPassphraseEmptyPassphrase', function() { | 266 test('SaveButtonDisabledWhenPassphraseOrConfirmationEmpty', function() { |
| 267 MockInteractions.tap(encryptWithPassphrase); | 267 MockInteractions.tap(encryptWithPassphrase); |
| 268 Polymer.dom.flush(); | 268 Polymer.dom.flush(); |
| 269 | 269 |
| 270 assertTrue(!!syncPage.$$('#create-password-box')); | 270 assertTrue(!!syncPage.$$('#create-password-box')); |
| 271 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); | 271 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); |
| 272 assertTrue(!!saveNewPassphrase); | |
| 273 | |
| 274 MockInteractions.tap(saveNewPassphrase); | |
| 275 Polymer.dom.flush(); | |
| 276 | |
| 277 var passphraseInput = syncPage.$$('#passphraseInput'); | 272 var passphraseInput = syncPage.$$('#passphraseInput'); |
| 278 var passphraseConfirmationInput = | 273 var passphraseConfirmationInput = |
| 279 syncPage.$$('#passphraseConfirmationInput'); | 274 syncPage.$$('#passphraseConfirmationInput'); |
| 280 assertTrue(!!passphraseInput); | |
| 281 assertTrue(!!passphraseConfirmationInput); | |
| 282 | 275 |
| 283 assertTrue(passphraseInput.invalid); | 276 passphraseInput.value = ''; |
| 284 assertFalse(passphraseConfirmationInput.invalid); | 277 passphraseConfirmationInput.value = ''; |
| 278 assertTrue(!!saveNewPassphrase.disabled); | |
| 285 | 279 |
| 286 assertFalse(syncPage.syncPrefs.encryptAllData); | 280 passphraseInput.value = 'foo'; |
| 281 passphraseConfirmationInput.value = ''; | |
| 282 assertTrue(!!saveNewPassphrase.disabled); | |
| 283 | |
| 284 passphraseInput.value = 'foo'; | |
| 285 passphraseConfirmationInput.value = 'bar'; | |
| 286 assertFalse(!!saveNewPassphrase.disabled); | |
| 287 }); | 287 }); |
| 288 | 288 |
| 289 test('CreatingPassphraseMismatchedPassphrase', function() { | 289 test('CreatingPassphraseMismatchedPassphrase', function() { |
| 290 MockInteractions.tap(encryptWithPassphrase); | 290 MockInteractions.tap(encryptWithPassphrase); |
| 291 Polymer.dom.flush(); | 291 Polymer.dom.flush(); |
| 292 | 292 |
| 293 assertTrue(!!syncPage.$$('#create-password-box')); | 293 assertTrue(!!syncPage.$$('#create-password-box')); |
| 294 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); | 294 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); |
| 295 assertTrue(!!saveNewPassphrase); | 295 assertTrue(!!saveNewPassphrase); |
| 296 | 296 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 prefs.encryptAllData = true; | 348 prefs.encryptAllData = true; |
| 349 prefs.passphraseRequired = true; | 349 prefs.passphraseRequired = true; |
| 350 prefs.fullEncryptionBody = 'Sync already encrypted.'; | 350 prefs.fullEncryptionBody = 'Sync already encrypted.'; |
| 351 cr.webUIListenerCallback('sync-prefs-changed', prefs); | 351 cr.webUIListenerCallback('sync-prefs-changed', prefs); |
| 352 | 352 |
| 353 Polymer.dom.flush(); | 353 Polymer.dom.flush(); |
| 354 | 354 |
| 355 assertTrue(syncPage.$.encryptionRadioGroupContainer.hidden); | 355 assertTrue(syncPage.$.encryptionRadioGroupContainer.hidden); |
| 356 }); | 356 }); |
| 357 | 357 |
| 358 test('ExistingPassphraseSubmitButtonHiddenIfPassphraseEmpty', function() { | |
|
tommycli
2016/10/25 18:28:46
The UI specs really call for the button to be HIDD
Moe
2016/10/25 22:30:18
The mocks seem to suggest that. I pinged Alan to k
tommycli
2016/10/25 22:39:09
Okay great. I leave it up to you if you want to ha
Moe
2016/10/26 18:26:13
Alan confirmed that the button should be disabled
| |
| 359 var prefs = getSyncAllPrefs(); | |
| 360 prefs.encryptAllData = true; | |
| 361 prefs.passphraseRequired = true; | |
| 362 cr.webUIListenerCallback('sync-prefs-changed', prefs); | |
| 363 | |
| 364 Polymer.dom.flush(); | |
| 365 | |
| 366 var existingPassphraseInput = syncPage.$$('#existingPassphraseInput'); | |
| 367 var submitExistingPassphrase = syncPage.$$('#submitExistingPassphrase'); | |
| 368 | |
| 369 existingPassphraseInput.value = ''; | |
| 370 assertFalse(submitExistingPassphrase.clientHeight > 0); | |
| 371 | |
| 372 existingPassphraseInput.value = 'foo'; | |
| 373 assertTrue(submitExistingPassphrase.clientHeight > 0); | |
| 374 }); | |
| 375 | |
| 358 test('EnterExistingWrongPassphrase', function() { | 376 test('EnterExistingWrongPassphrase', function() { |
| 359 var prefs = getSyncAllPrefs(); | 377 var prefs = getSyncAllPrefs(); |
| 360 prefs.encryptAllData = true; | 378 prefs.encryptAllData = true; |
| 361 prefs.passphraseRequired = true; | 379 prefs.passphraseRequired = true; |
| 362 cr.webUIListenerCallback('sync-prefs-changed', prefs); | 380 cr.webUIListenerCallback('sync-prefs-changed', prefs); |
| 363 | 381 |
| 364 Polymer.dom.flush(); | 382 Polymer.dom.flush(); |
| 365 | 383 |
| 366 var existingPassphraseInput = syncPage.$$('#existingPassphraseInput'); | 384 var existingPassphraseInput = syncPage.$$('#existingPassphraseInput'); |
| 367 assertTrue(!!existingPassphraseInput); | 385 assertTrue(!!existingPassphraseInput); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 }); | 444 }); |
| 427 }); | 445 }); |
| 428 } | 446 } |
| 429 | 447 |
| 430 return { | 448 return { |
| 431 registerTests: function() { | 449 registerTests: function() { |
| 432 registerAdvancedSyncSettingsTests(); | 450 registerAdvancedSyncSettingsTests(); |
| 433 }, | 451 }, |
| 434 }; | 452 }; |
| 435 }); | 453 }); |
| OLD | NEW |