| OLD | NEW |
| 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 function FakeDataMaker() {} | 9 function FakeDataMaker() {} |
| 10 /** | 10 /** |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ret.addressLines = FakeDataMaker.patternMaker_('xxxx Main St', 10); | 63 ret.addressLines = FakeDataMaker.patternMaker_('xxxx Main St', 10); |
| 64 ret.addressLevel1 = 'CA'; | 64 ret.addressLevel1 = 'CA'; |
| 65 ret.addressLevel2 = 'Venice'; | 65 ret.addressLevel2 = 'Venice'; |
| 66 ret.postalCode = FakeDataMaker.patternMaker_('xxxxx', 10); | 66 ret.postalCode = FakeDataMaker.patternMaker_('xxxxx', 10); |
| 67 ret.countryCode = 'US'; | 67 ret.countryCode = 'US'; |
| 68 ret.phoneNumbers = [FakeDataMaker.patternMaker_('(xxx) xxx-xxxx', 10)]; | 68 ret.phoneNumbers = [FakeDataMaker.patternMaker_('(xxx) xxx-xxxx', 10)]; |
| 69 ret.emailAddresses = [FakeDataMaker.patternMaker_('userxxxx@gmail.com', 16)]; | 69 ret.emailAddresses = [FakeDataMaker.patternMaker_('userxxxx@gmail.com', 16)]; |
| 70 ret.languageCode = 'EN-US'; | 70 ret.languageCode = 'EN-US'; |
| 71 ret.metadata = {isLocal: true}; | 71 ret.metadata = {isLocal: true}; |
| 72 ret.metadata.summaryLabel = ret.fullNames[0]; | 72 ret.metadata.summaryLabel = ret.fullNames[0]; |
| 73 ret.metadata.summarySublabel = ' ' + ret.addressLines; | 73 ret.metadata.summarySublabel = ', ' + ret.addressLines; |
| 74 return ret; | 74 return ret; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Creates a new empty credit card entry for testing. | 78 * Creates a new empty credit card entry for testing. |
| 79 * @return {!chrome.autofillPrivate.CreditCardEntry} | 79 * @return {!chrome.autofillPrivate.CreditCardEntry} |
| 80 */ | 80 */ |
| 81 FakeDataMaker.emptyCreditCardEntry = function() { | 81 FakeDataMaker.emptyCreditCardEntry = function() { |
| 82 var now = new Date(); | 82 var now = new Date(); |
| 83 var expirationMonth = now.getMonth() + 1; | 83 var expirationMonth = now.getMonth() + 1; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 * @param {string} pattern The pattern that should be used as an input. | 120 * @param {string} pattern The pattern that should be used as an input. |
| 121 * @param {number} base The number base. ie: 16 for hex or 10 for decimal. | 121 * @param {number} base The number base. ie: 16 for hex or 10 for decimal. |
| 122 * @return {string} | 122 * @return {string} |
| 123 * @private | 123 * @private |
| 124 */ | 124 */ |
| 125 FakeDataMaker.patternMaker_ = function(pattern, base) { | 125 FakeDataMaker.patternMaker_ = function(pattern, base) { |
| 126 return pattern.replace(/x/g, function() { | 126 return pattern.replace(/x/g, function() { |
| 127 return Math.floor(Math.random() * base).toString(base); | 127 return Math.floor(Math.random() * base).toString(base); |
| 128 }); | 128 }); |
| 129 }; | 129 }; |
| OLD | NEW |