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

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

Issue 2845543002: Show human readable origin for Android apps (Closed)
Patch Set: Created 3 years, 8 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
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 /** 5 /**
6 * Used to create fake data for both passwords and autofill. 6 * Used to create fake data for both passwords and autofill.
7 * These sections are related, so it made sense to share this. 7 * These sections are related, so it made sense to share this.
8 */ 8 */
9 9
10 function FakeDataMaker() {} 10 function FakeDataMaker() {}
11 11
12 /** 12 /**
13 * Creates a single item for the list of passwords. 13 * Creates a single item for the list of passwords.
14 * @param {string|undefined} url 14 * @param {string|undefined} url
15 * @param {string|undefined} username 15 * @param {string|undefined} username
16 * @param {number|undefined} passwordLength 16 * @param {number|undefined} passwordLength
17 * @return {chrome.passwordsPrivate.PasswordUiEntry} 17 * @return {chrome.passwordsPrivate.PasswordUiEntry}
18 */ 18 */
19 FakeDataMaker.passwordEntry = function(url, username, passwordLength) { 19 FakeDataMaker.passwordEntry = function(url, username, passwordLength) {
20 // Generate fake data if param is undefined. 20 // Generate fake data if param is undefined.
21 url = url || FakeDataMaker.patternMaker_('www.xxxxxx.com', 16); 21 url = url || FakeDataMaker.patternMaker_('www.xxxxxx.com', 16);
22 username = username || FakeDataMaker.patternMaker_('user_xxxxx', 16); 22 username = username || FakeDataMaker.patternMaker_('user_xxxxx', 16);
23 passwordLength = passwordLength || Math.floor(Math.random() * 15) + 3; 23 passwordLength = passwordLength || Math.floor(Math.random() * 15) + 3;
24 24
25 return { 25 return {
26 loginPair: { 26 loginPair: {
27 originUrl: url, 27 urls: {
28 origin: 'http://' + url + '/login',
29 shown: url,
30 link: 'http://' + url + '/login',
31 },
28 username: username, 32 username: username,
29 }, 33 },
30 linkUrl: 'http://' + url + '/login',
31 numCharactersInPassword: passwordLength, 34 numCharactersInPassword: passwordLength,
32 }; 35 };
33 }; 36 };
34 37
35 /** 38 /**
36 * Creates a single item for the list of password exceptions. 39 * Creates a single item for the list of password exceptions.
37 * @param {string|undefined} url 40 * @param {string|undefined} url
38 * @return {chrome.passwordsPrivate.ExceptionPair} 41 * @return {chrome.passwordsPrivate.ExceptionEntry}
39 */ 42 */
40 FakeDataMaker.exceptionEntry = function(url) { 43 FakeDataMaker.exceptionEntry = function(url) {
41 url = url || FakeDataMaker.patternMaker_('www.xxxxxx.com', 16); 44 url = url || FakeDataMaker.patternMaker_('www.xxxxxx.com', 16);
42 return { 45 return {
43 exceptionUrl: url, 46 urls: {
44 linkUrl: 'http://' + url + '/login', 47 origin: 'http://' + url + '/login',
48 shown: url,
49 link: 'http://' + url + '/login',
50 }
45 }; 51 };
46 }; 52 };
47 53
48 /** 54 /**
49 * Creates a new fake address entry for testing. 55 * Creates a new fake address entry for testing.
50 * @return {!chrome.autofillPrivate.AddressEntry} 56 * @return {!chrome.autofillPrivate.AddressEntry}
51 */ 57 */
52 FakeDataMaker.emptyAddressEntry = function() { 58 FakeDataMaker.emptyAddressEntry = function() {
53 return {}; 59 return {};
54 } 60 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 assertExpectations: function(expected) { 330 assertExpectations: function(expected) {
325 var actual = this.actual_; 331 var actual = this.actual_;
326 332
327 assertEquals(expected.requested.addresses, actual.requested.addresses); 333 assertEquals(expected.requested.addresses, actual.requested.addresses);
328 assertEquals(expected.requested.creditCards, actual.requested.creditCards); 334 assertEquals(expected.requested.creditCards, actual.requested.creditCards);
329 335
330 assertEquals(expected.listening.addresses, actual.listening.addresses); 336 assertEquals(expected.listening.addresses, actual.listening.addresses);
331 assertEquals(expected.listening.creditCards, actual.listening.creditCards); 337 assertEquals(expected.listening.creditCards, actual.listening.creditCards);
332 }, 338 },
333 }; 339 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698