| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 GEN_INCLUDE(['../options_browsertest_base.js']); | 5 GEN_INCLUDE(['../options_browsertest_base.js']); |
| 6 | 6 |
| 7 function AccountsOptionsWebUITest() {} | 7 function AccountsOptionsWebUITest() {} |
| 8 | 8 |
| 9 AccountsOptionsWebUITest.prototype = { | 9 AccountsOptionsWebUITest.prototype = { |
| 10 __proto__: OptionsBrowsertestBase.prototype, | 10 __proto__: OptionsBrowsertestBase.prototype, |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Browse to accounts options. | 13 * Browse to accounts options. |
| 14 */ | 14 */ |
| 15 browsePreload: 'chrome://settings-frame/accounts', | 15 browsePreload: 'chrome://settings-frame/accounts', |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 function createEnterKeyboardEvent(type) { | 18 function createEnterKeyboardEvent(type) { |
| 19 return new KeyboardEvent(type, { | 19 return new KeyboardEvent(type, { |
| 20 'bubbles': true, | 20 'bubbles': true, |
| 21 'cancelable': true, | 21 'cancelable': true, |
| 22 'keyIdentifier': 'Enter' | 22 'key': 'Enter' |
| 23 }); | 23 }); |
| 24 } | 24 } |
| 25 | 25 |
| 26 TEST_F('AccountsOptionsWebUITest', 'testNoCloseOnEnter', function() { | 26 TEST_F('AccountsOptionsWebUITest', 'testNoCloseOnEnter', function() { |
| 27 assertEquals(this.browsePreload, document.location.href); | 27 assertEquals(this.browsePreload, document.location.href); |
| 28 | 28 |
| 29 var inputField = $('userNameEdit'); | 29 var inputField = $('userNameEdit'); |
| 30 var accountsOptionsPage = AccountsOptions.getInstance(); | 30 var accountsOptionsPage = AccountsOptions.getInstance(); |
| 31 | 31 |
| 32 // Overlay is visible. | 32 // Overlay is visible. |
| 33 assertTrue(accountsOptionsPage.visible); | 33 assertTrue(accountsOptionsPage.visible); |
| 34 | 34 |
| 35 // Simulate pressing the enter key in the edit field. | 35 // Simulate pressing the enter key in the edit field. |
| 36 inputField.dispatchEvent(createEnterKeyboardEvent('keydown')); | 36 inputField.dispatchEvent(createEnterKeyboardEvent('keydown')); |
| 37 inputField.dispatchEvent(createEnterKeyboardEvent('keypress')); | 37 inputField.dispatchEvent(createEnterKeyboardEvent('keypress')); |
| 38 inputField.dispatchEvent(createEnterKeyboardEvent('keyup')); | 38 inputField.dispatchEvent(createEnterKeyboardEvent('keyup')); |
| 39 | 39 |
| 40 // Verify the overlay is still visible. | 40 // Verify the overlay is still visible. |
| 41 assertTrue(accountsOptionsPage.visible); | 41 assertTrue(accountsOptionsPage.visible); |
| 42 }); | 42 }); |
| OLD | NEW |