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.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
8 | 8 |
9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
10 import org.chromium.base.test.util.RetryOnFailure; | 10 import org.chromium.base.test.util.RetryOnFailure; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // The first profile has a lower use count than the two other profiles.
It also has an older | 318 // The first profile has a lower use count than the two other profiles.
It also has an older |
319 // use date that the second profile and the same use date as the third.
It should be last. | 319 // use date that the second profile and the same use date as the third.
It should be last. |
320 mHelper.setProfileUseStatsForTesting(guid1, 3, 5000); | 320 mHelper.setProfileUseStatsForTesting(guid1, 3, 5000); |
321 // The second profile has the same use count as the third but a more rec
ent use date. It | 321 // The second profile has the same use count as the third but a more rec
ent use date. It |
322 // also has a bigger use count that the first profile. It should be firs
t. | 322 // also has a bigger use count that the first profile. It should be firs
t. |
323 mHelper.setProfileUseStatsForTesting(guid2, 6, 5001); | 323 mHelper.setProfileUseStatsForTesting(guid2, 6, 5001); |
324 // The third profile has the same use count as the second but an older u
se date. It also has | 324 // The third profile has the same use count as the second but an older u
se date. It also has |
325 // a bigger use count that the first profile. It should be second. | 325 // a bigger use count that the first profile. It should be second. |
326 mHelper.setProfileUseStatsForTesting(guid3, 6, 5000); | 326 mHelper.setProfileUseStatsForTesting(guid3, 6, 5000); |
327 | 327 |
328 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(false /* i
ncludeName */); | 328 List<AutofillProfile> profiles = |
| 329 mHelper.getProfilesToSuggest(false /* includeNameInLabel */); |
329 assertEquals(3, profiles.size()); | 330 assertEquals(3, profiles.size()); |
330 assertTrue("Profile2 should be ranked first", guid2.equals(profiles.get(
0).getGUID())); | 331 assertTrue("Profile2 should be ranked first", guid2.equals(profiles.get(
0).getGUID())); |
331 assertTrue("Profile3 should be ranked second", guid3.equals(profiles.get
(1).getGUID())); | 332 assertTrue("Profile3 should be ranked second", guid3.equals(profiles.get
(1).getGUID())); |
332 assertTrue("Profile1 should be ranked third", guid1.equals(profiles.get(
2).getGUID())); | 333 assertTrue("Profile1 should be ranked third", guid1.equals(profiles.get(
2).getGUID())); |
333 } | 334 } |
334 | 335 |
335 @SmallTest | 336 @SmallTest |
336 @Feature({"Autofill"}) | 337 @Feature({"Autofill"}) |
337 public void testCreditCardsFrecency() throws InterruptedException, Execution
Exception, | 338 public void testCreditCardsFrecency() throws InterruptedException, Execution
Exception, |
338 TimeoutException { | 339 TimeoutException { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(gui
d)); | 493 assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(gui
d)); |
493 } | 494 } |
494 | 495 |
495 @SmallTest | 496 @SmallTest |
496 @Feature({"Autofill"}) | 497 @Feature({"Autofill"}) |
497 @RetryOnFailure | 498 @RetryOnFailure |
498 public void testGetProfilesToSuggest_NoName() throws InterruptedException, E
xecutionException, | 499 public void testGetProfilesToSuggest_NoName() throws InterruptedException, E
xecutionException, |
499 TimeoutException { | 500 TimeoutException { |
500 mHelper.setProfile(createTestProfile()); | 501 mHelper.setProfile(createTestProfile()); |
501 | 502 |
502 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(false /* i
ncludeName */); | 503 List<AutofillProfile> profiles = |
| 504 mHelper.getProfilesToSuggest(false /* includeNameInLabel */); |
503 assertEquals("Acme Inc., 123 Main, Los Angeles, California 90210, United
States", | 505 assertEquals("Acme Inc., 123 Main, Los Angeles, California 90210, United
States", |
504 profiles.get(0).getLabel()); | 506 profiles.get(0).getLabel()); |
505 } | 507 } |
506 | 508 |
507 @SmallTest | 509 @SmallTest |
508 @Feature({"Autofill"}) | 510 @Feature({"Autofill"}) |
509 @RetryOnFailure | 511 @RetryOnFailure |
510 public void testGetProfilesToSuggest_WithName() throws InterruptedException,
ExecutionException, | 512 public void testGetProfilesToSuggest_WithName() throws InterruptedException,
ExecutionException, |
511 TimeoutException { | 513 TimeoutException { |
512 mHelper.setProfile(createTestProfile()); | 514 mHelper.setProfile(createTestProfile()); |
513 | 515 |
514 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(true /* in
cludeName */); | 516 List<AutofillProfile> profiles = |
| 517 mHelper.getProfilesToSuggest(true /* includeNameInLabel */); |
515 assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, California 9
0210, " | 518 assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, California 9
0210, " |
516 + "United States", profiles.get(0).getLabel()); | 519 + "United States", profiles.get(0).getLabel()); |
517 } | 520 } |
518 } | 521 } |
OLD | NEW |