Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: chrome/test/data/webui/settings/settings_autofill_section_browsertest.js

Issue 2428733002: MD Settings: Migrating autofill cr-shared-menu to settings-action-menu. (Closed)
Patch Set: Test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** @fileoverview Runs the Polymer Autofill Settings tests. */ 5 /** @fileoverview Runs the Polymer Autofill Settings tests. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
11 GEN_INCLUDE([ 11 GEN_INCLUDE([
12 ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js', 12 ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js',
13 ROOT_PATH + 'ui/webui/resources/js/load_time_data.js',
dpapad 2016/10/18 00:16:50 settings_action_menu.html depends on direction_del
14 ]); 13 ]);
15 14
16 /** 15 /**
17 * Test implementation. 16 * Test implementation.
18 * @implements {settings.address.CountryDetailManager} 17 * @implements {settings.address.CountryDetailManager}
19 * @constructor 18 * @constructor
20 */ 19 */
21 function CountryDetailManagerTestImpl() {} 20 function CountryDetailManagerTestImpl() {}
22 CountryDetailManagerTestImpl.prototype = { 21 CountryDetailManagerTestImpl.prototype = {
23 /** @override */ 22 /** @override */
24 getCountryList: function() { 23 getCountryList: function() {
25 return new Promise(function(resolve) { 24 return new Promise(function(resolve) {
26 resolve([ 25 resolve([
27 {name: 'United States', countryCode: 'US'}, // Default test country. 26 {name: 'United States', countryCode: 'US'}, // Default test country.
28 {name: 'Israel', countryCode: 'IL'}, 27 {name: 'Israel', countryCode: 'IL'},
29 {name: 'United Kingdom', countryCode: 'GB'}, 28 {name: 'United Kingdom', countryCode: 'GB'},
30 ]); 29 ]);
31 }); 30 });
32 }, 31 },
33 32
34 /** @override */ 33 /** @override */
35 getAddressFormat: function(countryCode) { 34 getAddressFormat: function(countryCode) {
36 return new Promise(function(resolve) { 35 return new Promise(function(resolve) {
37 chrome.autofillPrivate.getAddressComponents(countryCode, resolve); 36 chrome.autofillPrivate.getAddressComponents(countryCode, resolve);
38 }); 37 });
39 }, 38 },
40 }; 39 };
41 40
42 /** 41 /**
43 * Will call |loopBody| for each item in |items|. Will only move to the next 42 * Will call |loopBody| for each item in |items|. Will only move to the next
44 * item after the promise from |loopBody| resolves. 43 * item after the promise from |loopBody| resolves.
45 * @param {!Array<Object>} items 44 * @param {!Array<Object>} items
46 * @param {!function(!Object):!Promise} loopBody 45 * @param {!function(!Object):!Promise} loopBody
47 * @return {!Promise} 46 * @return {!Promise}
48 */ 47 */
49 function asyncForEach(items, loopBody) { 48 function asyncForEach(items, loopBody) {
50 return new Promise(function(finish) { 49 return new Promise(function(resolve) {
51 var index = 0; 50 var index = 0;
52 51
53 function loop() { 52 function loop() {
54 var item = items[index++]; 53 var item = items[index++];
55 if (item) 54 if (item)
56 loopBody(item).then(loop); 55 loopBody(item).then(loop);
57 else 56 else
58 finish(); 57 resolve();
59 }; 58 };
60 59
61 loop(); 60 loop();
62 }); 61 });
63 } 62 }
64 63
65 /** 64 /**
66 * Resolves the promise after the element fires the expected event. Will add and 65 * Resolves the promise after the element fires the expected event. Will add and
67 * remove the listener so it is only triggered once. |causeEvent| is called 66 * remove the listener so it is only triggered once. |causeEvent| is called
68 * after adding a listener to make sure that the event is captured. 67 * after adding a listener to make sure that the event is captured.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 editCreditCardTitle: 'edit-title', 114 editCreditCardTitle: 'edit-title',
116 }, 115 },
117 116
118 /** @override */ 117 /** @override */
119 setUp: function() { 118 setUp: function() {
120 PolymerTest.prototype.setUp.call(this); 119 PolymerTest.prototype.setUp.call(this);
121 120
122 // Test is run on an individual element that won't have a page language. 121 // Test is run on an individual element that won't have a page language.
123 this.accessibilityAuditConfig.auditRulesToIgnore.push('humanLangMissing'); 122 this.accessibilityAuditConfig.auditRulesToIgnore.push('humanLangMissing');
124 123
125 // Faking 'strings.js' for this test.
126 loadTimeData.data = this.i18nStrings;
dpapad 2016/10/18 00:16:50 This line started causing me problems, because loa
127
128 settings.address.CountryDetailManagerImpl.instance_ = 124 settings.address.CountryDetailManagerImpl.instance_ =
129 new CountryDetailManagerTestImpl(); 125 new CountryDetailManagerTestImpl();
130 }, 126 },
131 127
132 /** 128 /**
133 * Creates the autofill section for the given lists. 129 * Creates the autofill section for the given lists.
134 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList 130 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList
135 * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} exceptionList 131 * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} exceptionList
136 * @return {!Object} 132 * @return {!Object}
137 * @private 133 * @private
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 assertEquals(city, cols[0].value); 821 assertEquals(city, cols[0].value);
826 assertEquals(state, cols[1].value); 822 assertEquals(state, cols[1].value);
827 assertEquals(zip, cols[2].value); 823 assertEquals(zip, cols[2].value);
828 }); 824 });
829 }); 825 });
830 }); 826 });
831 }); 827 });
832 828
833 mocha.run(); 829 mocha.run();
834 }); 830 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698