Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / autofill_options_browsertest.js
1 // Copyright (c) 2012 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.
4
5 /**
6  * TestFixture for autofill options WebUI testing.
7  * @extends {testing.Test}
8  * @constructor
9  **/
10 function AutofillOptionsWebUITest() {}
11
12 AutofillOptionsWebUITest.prototype = {
13   __proto__: testing.Test.prototype,
14
15   /**
16    * Browse to autofill options.
17    **/
18   browsePreload: 'chrome://settings-frame/autofill',
19 };
20
21 // Test opening the autofill options has correct location.
22 TEST_F('AutofillOptionsWebUITest', 'testOpenAutofillOptions', function() {
23   assertEquals(this.browsePreload, document.location.href);
24 });
25
26 /**
27  * TestFixture for autofill edit address overlay WebUI testing.
28  * @extends {testing.Test}
29  * @constructor
30  */
31 function AutofillEditAddressWebUITest() {}
32
33 AutofillEditAddressWebUITest.prototype = {
34   __proto__: testing.Test.prototype,
35
36   /**
37    * Browse to autofill edit address overlay.
38    **/
39   browsePreload: 'chrome://settings-frame/autofillEditAddress',
40
41   /** @inheritDoc  */
42   isAsync: true,
43
44   /**
45    * TODO(tkent): Fix an accessibility error.
46    */
47   runAccessibilityChecks: false,
48 };
49
50 TEST_F('AutofillEditAddressWebUITest',
51        'testAutofillPhoneValueListDoneValidating',
52        function() {
53   assertEquals(this.browsePreload, document.location.href);
54
55   var phoneList = $('phone-list');
56   expectEquals(0, phoneList.validationRequests_);
57   phoneList.doneValidating().then(function() {
58     phoneList.focus();
59     var input = phoneList.querySelector('input');
60     input.focus();
61     document.execCommand('insertText', false, '111-222-333');
62     assertEquals('111-222-333', input.value);
63     input.blur();
64     phoneList.doneValidating().then(function() {
65       testDone();
66     });
67   });
68 });