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
3 // found in the LICENSE file.
5 function AccountsOptionsWebUITest() {}
7 AccountsOptionsWebUITest.prototype = {
8 __proto__: testing.Test.prototype,
11 * Browse to accounts options.
13 browsePreload: 'chrome://settings-frame/accounts',
16 function createEnterKeyboardEvent(type) {
17 return new KeyboardEvent(type, {
20 'keyIdentifier': 'Enter'
24 TEST_F('AccountsOptionsWebUITest', 'testNoCloseOnEnter', function() {
25 assertEquals(this.browsePreload, document.location.href);
27 var inputField = $('userNameEdit');
28 var accountsOptionsPage = AccountsOptions.getInstance();
30 // Overlay is visible.
31 assertTrue(accountsOptionsPage.visible);
33 // Simulate pressing the enter key in the edit field.
34 inputField.dispatchEvent(createEnterKeyboardEvent('keydown'));
35 inputField.dispatchEvent(createEnterKeyboardEvent('keypress'));
36 inputField.dispatchEvent(createEnterKeyboardEvent('keyup'));
38 // Verify the overlay is still visible.
39 assertTrue(accountsOptionsPage.visible);