| 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 function AccountsOptionsWebUITest() {} | 5 function AccountsOptionsWebUITest() {} |
| 6 | 6 |
| 7 AccountsOptionsWebUITest.prototype = { | 7 AccountsOptionsWebUITest.prototype = { |
| 8 __proto__: testing.Test.prototype, | 8 __proto__: testing.Test.prototype, |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Browse to accounts options. | 11 * Browse to accounts options. |
| 12 */ | 12 */ |
| 13 browsePreload: 'chrome://settings-frame/accounts', | 13 browsePreload: 'chrome://settings-frame/accounts', |
| 14 |
| 15 /** @override */ |
| 16 runAccessibilityChecks: true, |
| 17 |
| 18 /** @override */ |
| 19 accessibilityIssuesAreErrors: true, |
| 20 |
| 21 /** override */ |
| 22 setUp: function() { |
| 23 // user-image-stream is a streaming video element used for capturing a |
| 24 // user image. |
| 25 this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions', |
| 26 '.user-image-stream'); |
| 27 }, |
| 14 }; | 28 }; |
| 15 | 29 |
| 16 function createEnterKeyboardEvent(type) { | 30 function createEnterKeyboardEvent(type) { |
| 17 return new KeyboardEvent(type, { | 31 return new KeyboardEvent(type, { |
| 18 'bubbles': true, | 32 'bubbles': true, |
| 19 'cancelable': true, | 33 'cancelable': true, |
| 20 'keyIdentifier': 'Enter' | 34 'keyIdentifier': 'Enter' |
| 21 }); | 35 }); |
| 22 } | 36 } |
| 23 | 37 |
| 24 TEST_F('AccountsOptionsWebUITest', 'testNoCloseOnEnter', function() { | 38 TEST_F('AccountsOptionsWebUITest', 'testNoCloseOnEnter', function() { |
| 25 assertEquals(this.browsePreload, document.location.href); | 39 assertEquals(this.browsePreload, document.location.href); |
| 26 | 40 |
| 27 var inputField = $('userNameEdit'); | 41 var inputField = $('userNameEdit'); |
| 28 var accountsOptionsPage = AccountsOptions.getInstance(); | 42 var accountsOptionsPage = AccountsOptions.getInstance(); |
| 29 | 43 |
| 30 // Overlay is visible. | 44 // Overlay is visible. |
| 31 assertTrue(accountsOptionsPage.visible); | 45 assertTrue(accountsOptionsPage.visible); |
| 32 | 46 |
| 33 // Simulate pressing the enter key in the edit field. | 47 // Simulate pressing the enter key in the edit field. |
| 34 inputField.dispatchEvent(createEnterKeyboardEvent('keydown')); | 48 inputField.dispatchEvent(createEnterKeyboardEvent('keydown')); |
| 35 inputField.dispatchEvent(createEnterKeyboardEvent('keypress')); | 49 inputField.dispatchEvent(createEnterKeyboardEvent('keypress')); |
| 36 inputField.dispatchEvent(createEnterKeyboardEvent('keyup')); | 50 inputField.dispatchEvent(createEnterKeyboardEvent('keyup')); |
| 37 | 51 |
| 38 // Verify the overlay is still visible. | 52 // Verify the overlay is still visible. |
| 39 assertTrue(accountsOptionsPage.visible); | 53 assertTrue(accountsOptionsPage.visible); |
| 40 }); | 54 }); |
| OLD | NEW |