| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 package org.chromium.chrome.browser.autofill; | 5 package org.chromium.chrome.browser.autofill; |
| 6 | 6 |
| 7 import android.support.test.InstrumentationRegistry; | 7 import android.support.test.InstrumentationRegistry; |
| 8 import android.support.test.filters.SmallTest; | 8 import android.support.test.filters.SmallTest; |
| 9 | 9 |
| 10 import org.junit.Assert; | 10 import org.junit.Assert; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 public void testCreditCardsFrecency() | 362 public void testCreditCardsFrecency() |
| 363 throws InterruptedException, ExecutionException, TimeoutException { | 363 throws InterruptedException, ExecutionException, TimeoutException { |
| 364 // Create 3 credit cards. | 364 // Create 3 credit cards. |
| 365 CreditCard card1 = new CreditCard("" /* guid */, "https://www.example.co
m" /* origin */, | 365 CreditCard card1 = new CreditCard("" /* guid */, "https://www.example.co
m" /* origin */, |
| 366 "Visa", "1234123412341234", "", "5", "2020"); | 366 "Visa", "1234123412341234", "", "5", "2020"); |
| 367 | 367 |
| 368 CreditCard card2 = new CreditCard("" /* guid */, "http://www.example.com
" /* origin */, | 368 CreditCard card2 = new CreditCard("" /* guid */, "http://www.example.com
" /* origin */, |
| 369 "American Express", "1234123412341234", "", "8", "2020"); | 369 "American Express", "1234123412341234", "", "8", "2020"); |
| 370 | 370 |
| 371 CreditCard card3 = new CreditCard("" /* guid */, "http://www.example.com
" /* origin */, | 371 CreditCard card3 = new CreditCard("" /* guid */, "http://www.example.com
" /* origin */, |
| 372 "Master Card", "1234123412341234", "", "11", "2020"); | 372 "Mastercard", "1234123412341234", "", "11", "2020"); |
| 373 | 373 |
| 374 String guid1 = mHelper.setCreditCard(card1); | 374 String guid1 = mHelper.setCreditCard(card1); |
| 375 String guid2 = mHelper.setCreditCard(card2); | 375 String guid2 = mHelper.setCreditCard(card2); |
| 376 String guid3 = mHelper.setCreditCard(card3); | 376 String guid3 = mHelper.setCreditCard(card3); |
| 377 | 377 |
| 378 // The first card has a lower use count than the two other cards. It als
o has an older | 378 // The first card has a lower use count than the two other cards. It als
o has an older |
| 379 // use date that the second card and the same use date as the third. It
should be last. | 379 // use date that the second card and the same use date as the third. It
should be last. |
| 380 mHelper.setCreditCardUseStatsForTesting(guid1, 3, 5000); | 380 mHelper.setCreditCardUseStatsForTesting(guid1, 3, 5000); |
| 381 // The second card has the same use count as the third but a more recent
use date. It also | 381 // The second card has the same use count as the third but a more recent
use date. It also |
| 382 // has a bigger use count that the first card. It should be first. | 382 // has a bigger use count that the first card. It should be first. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 throws InterruptedException, ExecutionException, TimeoutException { | 542 throws InterruptedException, ExecutionException, TimeoutException { |
| 543 mHelper.setProfile(createTestProfile()); | 543 mHelper.setProfile(createTestProfile()); |
| 544 | 544 |
| 545 List<AutofillProfile> profiles = | 545 List<AutofillProfile> profiles = |
| 546 mHelper.getProfilesToSuggest(true /* includeNameInLabel */); | 546 mHelper.getProfilesToSuggest(true /* includeNameInLabel */); |
| 547 Assert.assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, Calif
ornia 90210, " | 547 Assert.assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, Calif
ornia 90210, " |
| 548 + "United States", | 548 + "United States", |
| 549 profiles.get(0).getLabel()); | 549 profiles.get(0).getLabel()); |
| 550 } | 550 } |
| 551 } | 551 } |
| OLD | NEW |