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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java

Issue 2327673002: Mark flaky chrome_public tests with @RetryOnFailure Batch 1 (Closed)
Patch Set: Created 4 years, 3 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 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.chrome.browser.autofill.PersonalDataManager.AutofillProfile; 11 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
11 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; 12 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
12 import org.chromium.chrome.test.util.ApplicationData; 13 import org.chromium.chrome.test.util.ApplicationData;
13 import org.chromium.content.browser.test.NativeLibraryTestBase; 14 import org.chromium.content.browser.test.NativeLibraryTestBase;
14 15
15 import java.util.LinkedList; 16 import java.util.LinkedList;
16 import java.util.List; 17 import java.util.List;
17 import java.util.concurrent.ExecutionException; 18 import java.util.concurrent.ExecutionException;
18 import java.util.concurrent.TimeoutException; 19 import java.util.concurrent.TimeoutException;
19 20
(...skipping 14 matching lines...) Expand all
34 } 35 }
35 36
36 private AutofillProfile createTestProfile() { 37 private AutofillProfile createTestProfile() {
37 return new AutofillProfile("" /* guid */, "https://www.example.com" /* o rigin */, 38 return new AutofillProfile("" /* guid */, "https://www.example.com" /* o rigin */,
38 "John Major", "Acme Inc.", "123 Main", "California", "Los Angele s", "", "90210", "", 39 "John Major", "Acme Inc.", "123 Main", "California", "Los Angele s", "", "90210", "",
39 "US", "555 123-4567", "jm@example.com", ""); 40 "US", "555 123-4567", "jm@example.com", "");
40 } 41 }
41 42
42 @SmallTest 43 @SmallTest
43 @Feature({"Autofill"}) 44 @Feature({"Autofill"})
45 @RetryOnFailure
44 public void testAddAndEditProfiles() throws InterruptedException, ExecutionE xception, 46 public void testAddAndEditProfiles() throws InterruptedException, ExecutionE xception,
45 TimeoutException { 47 TimeoutException {
46 AutofillProfile profile = new AutofillProfile( 48 AutofillProfile profile = new AutofillProfile(
47 "" /* guid */, "https://www.example.com" /* origin */, 49 "" /* guid */, "https://www.example.com" /* origin */,
48 "John Smith", "Acme Inc.", 50 "John Smith", "Acme Inc.",
49 "1 Main\nApt A", "CA", "San Francisco", "", 51 "1 Main\nApt A", "CA", "San Francisco", "",
50 "94102", "", 52 "94102", "",
51 "US", "4158889999", "john@acme.inc", ""); 53 "US", "4158889999", "john@acme.inc", "");
52 String profileOneGUID = mHelper.setProfile(profile); 54 String profileOneGUID = mHelper.setProfile(profile);
53 assertEquals(1, mHelper.getNumberOfProfilesForSettings()); 55 assertEquals(1, mHelper.getNumberOfProfilesForSettings());
(...skipping 16 matching lines...) Expand all
70 AutofillProfile storedProfile = mHelper.getProfile(profileOneGUID); 72 AutofillProfile storedProfile = mHelper.getProfile(profileOneGUID);
71 assertEquals(profileOneGUID, storedProfile.getGUID()); 73 assertEquals(profileOneGUID, storedProfile.getGUID());
72 assertEquals("https://www.example.com", storedProfile.getOrigin()); 74 assertEquals("https://www.example.com", storedProfile.getOrigin());
73 assertEquals("CA", storedProfile.getCountryCode()); 75 assertEquals("CA", storedProfile.getCountryCode());
74 assertEquals("San Francisco", storedProfile.getLocality()); 76 assertEquals("San Francisco", storedProfile.getLocality());
75 assertNotNull(mHelper.getProfile(profileTwoGUID)); 77 assertNotNull(mHelper.getProfile(profileTwoGUID));
76 } 78 }
77 79
78 @SmallTest 80 @SmallTest
79 @Feature({"Autofill"}) 81 @Feature({"Autofill"})
82 @RetryOnFailure
80 public void testUpdateLanguageCodeInProfile() throws InterruptedException, E xecutionException, 83 public void testUpdateLanguageCodeInProfile() throws InterruptedException, E xecutionException,
81 TimeoutException { 84 TimeoutException {
82 AutofillProfile profile = new AutofillProfile( 85 AutofillProfile profile = new AutofillProfile(
83 "" /* guid */, "https://www.example.com" /* origin */, 86 "" /* guid */, "https://www.example.com" /* origin */,
84 "John Smith", "Acme Inc.", 87 "John Smith", "Acme Inc.",
85 "1 Main\nApt A", "CA", "San Francisco", "", 88 "1 Main\nApt A", "CA", "San Francisco", "",
86 "94102", "", 89 "94102", "",
87 "US", "4158889999", "john@acme.inc", "fr"); 90 "US", "4158889999", "john@acme.inc", "fr");
88 assertEquals("fr", profile.getLanguageCode()); 91 assertEquals("fr", profile.getLanguageCode());
89 String profileOneGUID = mHelper.setProfile(profile); 92 String profileOneGUID = mHelper.setProfile(profile);
(...skipping 11 matching lines...) Expand all
101 AutofillProfile storedProfile2 = mHelper.getProfile(profileOneGUID); 104 AutofillProfile storedProfile2 = mHelper.getProfile(profileOneGUID);
102 assertEquals(profileOneGUID, storedProfile2.getGUID()); 105 assertEquals(profileOneGUID, storedProfile2.getGUID());
103 assertEquals("en", storedProfile2.getLanguageCode()); 106 assertEquals("en", storedProfile2.getLanguageCode());
104 assertEquals("US", storedProfile2.getCountryCode()); 107 assertEquals("US", storedProfile2.getCountryCode());
105 assertEquals("San Francisco", storedProfile2.getLocality()); 108 assertEquals("San Francisco", storedProfile2.getLocality());
106 assertEquals("https://www.example.com", storedProfile2.getOrigin()); 109 assertEquals("https://www.example.com", storedProfile2.getOrigin());
107 } 110 }
108 111
109 @SmallTest 112 @SmallTest
110 @Feature({"Autofill"}) 113 @Feature({"Autofill"})
114 @RetryOnFailure
111 public void testAddAndDeleteProfile() throws InterruptedException, Execution Exception, 115 public void testAddAndDeleteProfile() throws InterruptedException, Execution Exception,
112 TimeoutException { 116 TimeoutException {
113 String profileOneGUID = mHelper.setProfile(createTestProfile()); 117 String profileOneGUID = mHelper.setProfile(createTestProfile());
114 assertEquals(1, mHelper.getNumberOfProfilesForSettings()); 118 assertEquals(1, mHelper.getNumberOfProfilesForSettings());
115 119
116 mHelper.deleteProfile(profileOneGUID); 120 mHelper.deleteProfile(profileOneGUID);
117 assertEquals(0, mHelper.getNumberOfProfilesForSettings()); 121 assertEquals(0, mHelper.getNumberOfProfilesForSettings());
118 } 122 }
119 123
120 @SmallTest 124 @SmallTest
121 @Feature({"Autofill"}) 125 @Feature({"Autofill"})
126 @RetryOnFailure
122 public void testAddAndEditCreditCards() throws InterruptedException, Executi onException, 127 public void testAddAndEditCreditCards() throws InterruptedException, Executi onException,
123 TimeoutException { 128 TimeoutException {
124 CreditCard card = new CreditCard( 129 CreditCard card = new CreditCard(
125 "" /* guid */, "https://www.example.com" /* origin */, 130 "" /* guid */, "https://www.example.com" /* origin */,
126 "Visa", "1234123412341234", "", "5", "2020"); 131 "Visa", "1234123412341234", "", "5", "2020");
127 String cardOneGUID = mHelper.setCreditCard(card); 132 String cardOneGUID = mHelper.setCreditCard(card);
128 assertEquals(1, mHelper.getNumberOfCreditCardsForSettings()); 133 assertEquals(1, mHelper.getNumberOfCreditCardsForSettings());
129 134
130 CreditCard card2 = new CreditCard( 135 CreditCard card2 = new CreditCard(
131 "" /* guid */, "http://www.example.com" /* origin */, 136 "" /* guid */, "http://www.example.com" /* origin */,
(...skipping 13 matching lines...) Expand all
145 assertEquals("https://www.example.com", storedCard.getOrigin()); 150 assertEquals("https://www.example.com", storedCard.getOrigin());
146 assertEquals("Visa", storedCard.getName()); 151 assertEquals("Visa", storedCard.getName());
147 assertEquals("10", storedCard.getMonth()); 152 assertEquals("10", storedCard.getMonth());
148 assertEquals("4012888888881881", storedCard.getNumber()); 153 assertEquals("4012888888881881", storedCard.getNumber());
149 assertEquals("Visa\u00a0\u22ef1881", storedCard.getObfuscatedNumber()); 154 assertEquals("Visa\u00a0\u22ef1881", storedCard.getObfuscatedNumber());
150 assertNotNull(mHelper.getCreditCard(cardTwoGUID)); 155 assertNotNull(mHelper.getCreditCard(cardTwoGUID));
151 } 156 }
152 157
153 @SmallTest 158 @SmallTest
154 @Feature({"Autofill"}) 159 @Feature({"Autofill"})
160 @RetryOnFailure
155 public void testAddAndDeleteCreditCard() throws InterruptedException, Execut ionException, 161 public void testAddAndDeleteCreditCard() throws InterruptedException, Execut ionException,
156 TimeoutException { 162 TimeoutException {
157 CreditCard card = new CreditCard( 163 CreditCard card = new CreditCard(
158 "" /* guid */, "Chrome settings" /* origin */, 164 "" /* guid */, "Chrome settings" /* origin */,
159 "Visa", "1234123412341234", "", "5", "2020"); 165 "Visa", "1234123412341234", "", "5", "2020");
160 String cardOneGUID = mHelper.setCreditCard(card); 166 String cardOneGUID = mHelper.setCreditCard(card);
161 assertEquals(1, mHelper.getNumberOfCreditCardsForSettings()); 167 assertEquals(1, mHelper.getNumberOfCreditCardsForSettings());
162 168
163 mHelper.deleteCreditCard(cardOneGUID); 169 mHelper.deleteCreditCard(cardOneGUID);
164 assertEquals(0, mHelper.getNumberOfCreditCardsForSettings()); 170 assertEquals(0, mHelper.getNumberOfCreditCardsForSettings());
(...skipping 25 matching lines...) Expand all
190 196
191 AutofillProfile storedProfile1 = mHelper.getProfile(profileGuid1); 197 AutofillProfile storedProfile1 = mHelper.getProfile(profileGuid1);
192 assertEquals("CA", storedProfile1.getCountryCode()); 198 assertEquals("CA", storedProfile1.getCountryCode());
193 199
194 AutofillProfile storedProfile2 = mHelper.getProfile(profileGuid2); 200 AutofillProfile storedProfile2 = mHelper.getProfile(profileGuid2);
195 assertEquals("CA", storedProfile2.getCountryCode()); 201 assertEquals("CA", storedProfile2.getCountryCode());
196 } 202 }
197 203
198 @SmallTest 204 @SmallTest
199 @Feature({"Autofill"}) 205 @Feature({"Autofill"})
206 @RetryOnFailure
200 public void testMultilineStreetAddress() throws InterruptedException, Execut ionException, 207 public void testMultilineStreetAddress() throws InterruptedException, Execut ionException,
201 TimeoutException { 208 TimeoutException {
202 final String streetAddress1 = "Chez Mireille COPEAU Appartment. 2\n" 209 final String streetAddress1 = "Chez Mireille COPEAU Appartment. 2\n"
203 + "Entree A Batiment Jonquille\n" 210 + "Entree A Batiment Jonquille\n"
204 + "25 RUE DE L'EGLISE"; 211 + "25 RUE DE L'EGLISE";
205 final String streetAddress2 = streetAddress1 + "\n" 212 final String streetAddress2 = streetAddress1 + "\n"
206 + "Fourth floor\n" 213 + "Fourth floor\n"
207 + "The red bell"; 214 + "The red bell";
208 AutofillProfile profile = new AutofillProfile( 215 AutofillProfile profile = new AutofillProfile(
209 "" /* guid */, "https://www.example.com" /* origin */, 216 "" /* guid */, "https://www.example.com" /* origin */,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 362
356 List<CreditCard> cards = mHelper.getCreditCardsToSuggest(); 363 List<CreditCard> cards = mHelper.getCreditCardsToSuggest();
357 assertEquals(3, cards.size()); 364 assertEquals(3, cards.size());
358 assertTrue("Card2 should be ranked first", guid2.equals(cards.get(0).get GUID())); 365 assertTrue("Card2 should be ranked first", guid2.equals(cards.get(0).get GUID()));
359 assertTrue("Card3 should be ranked second", guid3.equals(cards.get(1).ge tGUID())); 366 assertTrue("Card3 should be ranked second", guid3.equals(cards.get(1).ge tGUID()));
360 assertTrue("Card1 should be ranked third", guid1.equals(cards.get(2).get GUID())); 367 assertTrue("Card1 should be ranked third", guid1.equals(cards.get(2).get GUID()));
361 } 368 }
362 369
363 @SmallTest 370 @SmallTest
364 @Feature({"Autofill"}) 371 @Feature({"Autofill"})
372 @RetryOnFailure
365 public void testCreditCardsDeduping() throws InterruptedException, Execution Exception, 373 public void testCreditCardsDeduping() throws InterruptedException, Execution Exception,
366 TimeoutException { 374 TimeoutException {
367 // Create a local card and an identical server card. 375 // Create a local card and an identical server card.
368 CreditCard card1 = new CreditCard("" /* guid */, "https://www.example.co m" /* origin */, 376 CreditCard card1 = new CreditCard("" /* guid */, "https://www.example.co m" /* origin */,
369 true /* isLocal */, false /* isCached */, "John Doe", "123412341 2341234", "", "5", 377 true /* isLocal */, false /* isCached */, "John Doe", "123412341 2341234", "", "5",
370 "2020", "Visa", 0 /* issuerIconDrawableId */, "" /* billingAddre ssId */, 378 "2020", "Visa", 0 /* issuerIconDrawableId */, "" /* billingAddre ssId */,
371 "" /* serverId */); 379 "" /* serverId */);
372 380
373 CreditCard card2 = new CreditCard("" /* guid */, "https://www.example.co m" /* origin */, 381 CreditCard card2 = new CreditCard("" /* guid */, "https://www.example.co m" /* origin */,
374 false /* isLocal */, false /* isCached */, "John Doe", "12341234 12341234", "", "5", 382 false /* isLocal */, false /* isCached */, "John Doe", "12341234 12341234", "", "5",
375 "2020", "Visa", 0 /* issuerIconDrawableId */, "" /* billingAddre ssId */, 383 "2020", "Visa", 0 /* issuerIconDrawableId */, "" /* billingAddre ssId */,
376 "" /* serverId */); 384 "" /* serverId */);
377 385
378 mHelper.setCreditCard(card1); 386 mHelper.setCreditCard(card1);
379 mHelper.addServerCreditCard(card2); 387 mHelper.addServerCreditCard(card2);
380 388
381 // Only one card should be suggested to the user since the two are ident ical. 389 // Only one card should be suggested to the user since the two are ident ical.
382 assertEquals(1, mHelper.getNumberOfCreditCardsToSuggest()); 390 assertEquals(1, mHelper.getNumberOfCreditCardsToSuggest());
383 391
384 // Both cards should be seen in the settings even if they are identical. 392 // Both cards should be seen in the settings even if they are identical.
385 assertEquals(2, mHelper.getNumberOfCreditCardsForSettings()); 393 assertEquals(2, mHelper.getNumberOfCreditCardsForSettings());
386 } 394 }
387 395
388 @SmallTest 396 @SmallTest
389 @Feature({"Autofill"}) 397 @Feature({"Autofill"})
398 @RetryOnFailure
390 public void testProfileUseStatsSettingAndGetting() throws InterruptedExcepti on, 399 public void testProfileUseStatsSettingAndGetting() throws InterruptedExcepti on,
391 ExecutionException, TimeoutException { 400 ExecutionException, TimeoutException {
392 String guid = mHelper.setProfile(createTestProfile()); 401 String guid = mHelper.setProfile(createTestProfile());
393 402
394 // Make sure the profile does not have the specific use stats form the s tart. 403 // Make sure the profile does not have the specific use stats form the s tart.
395 assertTrue(1234 != mHelper.getProfileUseCountForTesting(guid)); 404 assertTrue(1234 != mHelper.getProfileUseCountForTesting(guid));
396 assertTrue(1234 != mHelper.getProfileUseDateForTesting(guid)); 405 assertTrue(1234 != mHelper.getProfileUseDateForTesting(guid));
397 406
398 // Set specific use stats for the profile. 407 // Set specific use stats for the profile.
399 mHelper.setProfileUseStatsForTesting(guid, 1234, 1234); 408 mHelper.setProfileUseStatsForTesting(guid, 1234, 1234);
400 409
401 // Make sure the specific use stats were set for the profile. 410 // Make sure the specific use stats were set for the profile.
402 assertEquals(1234, mHelper.getProfileUseCountForTesting(guid)); 411 assertEquals(1234, mHelper.getProfileUseCountForTesting(guid));
403 assertEquals(1234, mHelper.getProfileUseDateForTesting(guid)); 412 assertEquals(1234, mHelper.getProfileUseDateForTesting(guid));
404 } 413 }
405 414
406 415
407 @SmallTest 416 @SmallTest
408 @Feature({"Autofill"}) 417 @Feature({"Autofill"})
418 @RetryOnFailure
409 public void testCreditCardUseStatsSettingAndGetting() throws InterruptedExce ption, 419 public void testCreditCardUseStatsSettingAndGetting() throws InterruptedExce ption,
410 ExecutionException, TimeoutException { 420 ExecutionException, TimeoutException {
411 String guid = mHelper.setCreditCard( 421 String guid = mHelper.setCreditCard(
412 new CreditCard("" /* guid */, "https://www.example.com" /* origi n */, 422 new CreditCard("" /* guid */, "https://www.example.com" /* origi n */,
413 true /* isLocal */, false /* isCached */, "John Doe", "12341 23412341234", "", 423 true /* isLocal */, false /* isCached */, "John Doe", "12341 23412341234", "",
414 "5", "2020", "Visa", 0 /* issuerIconDrawableId */, "" /* bil lingAddressId */, 424 "5", "2020", "Visa", 0 /* issuerIconDrawableId */, "" /* bil lingAddressId */,
415 "" /* serverId */)); 425 "" /* serverId */));
416 426
417 // Make sure the credit card does not have the specific use stats form t he start. 427 // Make sure the credit card does not have the specific use stats form t he start.
418 assertTrue(1234 != mHelper.getCreditCardUseCountForTesting(guid)); 428 assertTrue(1234 != mHelper.getCreditCardUseCountForTesting(guid));
419 assertTrue(1234 != mHelper.getCreditCardUseDateForTesting(guid)); 429 assertTrue(1234 != mHelper.getCreditCardUseDateForTesting(guid));
420 430
421 // Set specific use stats for the credit card. 431 // Set specific use stats for the credit card.
422 mHelper.setCreditCardUseStatsForTesting(guid, 1234, 1234); 432 mHelper.setCreditCardUseStatsForTesting(guid, 1234, 1234);
423 433
424 // Make sure the specific use stats were set for the credit card. 434 // Make sure the specific use stats were set for the credit card.
425 assertEquals(1234, mHelper.getCreditCardUseCountForTesting(guid)); 435 assertEquals(1234, mHelper.getCreditCardUseCountForTesting(guid));
426 assertEquals(1234, mHelper.getCreditCardUseDateForTesting(guid)); 436 assertEquals(1234, mHelper.getCreditCardUseDateForTesting(guid));
427 } 437 }
428 438
429 @SmallTest 439 @SmallTest
430 @Feature({"Autofill"}) 440 @Feature({"Autofill"})
441 @RetryOnFailure
431 public void testRecordAndLogProfileUse() throws InterruptedException, Execut ionException, 442 public void testRecordAndLogProfileUse() throws InterruptedException, Execut ionException,
432 TimeoutException { 443 TimeoutException {
433 String guid = mHelper.setProfile(createTestProfile()); 444 String guid = mHelper.setProfile(createTestProfile());
434 445
435 // Set specific use stats for the profile. 446 // Set specific use stats for the profile.
436 mHelper.setProfileUseStatsForTesting(guid, 1234, 1234); 447 mHelper.setProfileUseStatsForTesting(guid, 1234, 1234);
437 448
438 // Get the current date value just before the call to record and log. 449 // Get the current date value just before the call to record and log.
439 long timeBeforeRecord = mHelper.getCurrentDateForTesting(); 450 long timeBeforeRecord = mHelper.getCurrentDateForTesting();
440 451
441 // Record and log use of the profile. 452 // Record and log use of the profile.
442 mHelper.recordAndLogProfileUse(guid); 453 mHelper.recordAndLogProfileUse(guid);
443 454
444 // Get the current date value just after the call to record and log. 455 // Get the current date value just after the call to record and log.
445 long timeAfterRecord = mHelper.getCurrentDateForTesting(); 456 long timeAfterRecord = mHelper.getCurrentDateForTesting();
446 457
447 // Make sure the use stats of the profile were updated. 458 // Make sure the use stats of the profile were updated.
448 assertEquals(1235, mHelper.getProfileUseCountForTesting(guid)); 459 assertEquals(1235, mHelper.getProfileUseCountForTesting(guid));
449 assertTrue(timeBeforeRecord <= mHelper.getProfileUseDateForTesting(guid) ); 460 assertTrue(timeBeforeRecord <= mHelper.getProfileUseDateForTesting(guid) );
450 assertTrue(timeAfterRecord >= mHelper.getProfileUseDateForTesting(guid)) ; 461 assertTrue(timeAfterRecord >= mHelper.getProfileUseDateForTesting(guid)) ;
451 } 462 }
452 463
453 464
454 @SmallTest 465 @SmallTest
455 @Feature({"Autofill"}) 466 @Feature({"Autofill"})
467 @RetryOnFailure
456 public void testRecordAndLogCreditCardUse() throws InterruptedException, Exe cutionException, 468 public void testRecordAndLogCreditCardUse() throws InterruptedException, Exe cutionException,
457 TimeoutException { 469 TimeoutException {
458 String guid = mHelper.setCreditCard( 470 String guid = mHelper.setCreditCard(
459 new CreditCard("" /* guid */, "https://www.example.com" /* o rigin */, 471 new CreditCard("" /* guid */, "https://www.example.com" /* o rigin */,
460 true /* isLocal */, false /* isCached */, "John Doe" , 472 true /* isLocal */, false /* isCached */, "John Doe" ,
461 "1234123412341234", "", "5", "2020", "Visa", 473 "1234123412341234", "", "5", "2020", "Visa",
462 0 /* issuerIconDrawableId */, "" /* billingAddressId */, 474 0 /* issuerIconDrawableId */, "" /* billingAddressId */,
463 "" /* serverId */)); 475 "" /* serverId */));
464 476
465 // Set specific use stats for the credit card. 477 // Set specific use stats for the credit card.
466 mHelper.setCreditCardUseStatsForTesting(guid, 1234, 1234); 478 mHelper.setCreditCardUseStatsForTesting(guid, 1234, 1234);
467 479
468 // Get the current date value just before the call to record and log. 480 // Get the current date value just before the call to record and log.
469 long timeBeforeRecord = mHelper.getCurrentDateForTesting(); 481 long timeBeforeRecord = mHelper.getCurrentDateForTesting();
470 482
471 // Record and log use of the credit card. 483 // Record and log use of the credit card.
472 mHelper.recordAndLogCreditCardUse(guid); 484 mHelper.recordAndLogCreditCardUse(guid);
473 485
474 // Get the current date value just after the call to record and log. 486 // Get the current date value just after the call to record and log.
475 long timeAfterRecord = mHelper.getCurrentDateForTesting(); 487 long timeAfterRecord = mHelper.getCurrentDateForTesting();
476 488
477 // Make sure the use stats of the credit card were updated. 489 // Make sure the use stats of the credit card were updated.
478 assertEquals(1235, mHelper.getCreditCardUseCountForTesting(guid)); 490 assertEquals(1235, mHelper.getCreditCardUseCountForTesting(guid));
479 assertTrue(timeBeforeRecord <= mHelper.getCreditCardUseDateForTesting(gu id)); 491 assertTrue(timeBeforeRecord <= mHelper.getCreditCardUseDateForTesting(gu id));
480 assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(gui d)); 492 assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(gui d));
481 } 493 }
482 494
483 @SmallTest 495 @SmallTest
484 @Feature({"Autofill"}) 496 @Feature({"Autofill"})
497 @RetryOnFailure
485 public void testGetProfilesToSuggest_NoName() throws InterruptedException, E xecutionException, 498 public void testGetProfilesToSuggest_NoName() throws InterruptedException, E xecutionException,
486 TimeoutException { 499 TimeoutException {
487 mHelper.setProfile(createTestProfile()); 500 mHelper.setProfile(createTestProfile());
488 501
489 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(false /* i ncludeName */); 502 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(false /* i ncludeName */);
490 assertEquals("Acme Inc., 123 Main, Los Angeles, California 90210, United States", 503 assertEquals("Acme Inc., 123 Main, Los Angeles, California 90210, United States",
491 profiles.get(0).getLabel()); 504 profiles.get(0).getLabel());
492 } 505 }
493 506
494 @SmallTest 507 @SmallTest
495 @Feature({"Autofill"}) 508 @Feature({"Autofill"})
509 @RetryOnFailure
496 public void testGetProfilesToSuggest_WithName() throws InterruptedException, ExecutionException, 510 public void testGetProfilesToSuggest_WithName() throws InterruptedException, ExecutionException,
497 TimeoutException { 511 TimeoutException {
498 mHelper.setProfile(createTestProfile()); 512 mHelper.setProfile(createTestProfile());
499 513
500 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(true /* in cludeName */); 514 List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(true /* in cludeName */);
501 assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, California 9 0210, " 515 assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, California 9 0210, "
502 + "United States", profiles.get(0).getLabel()); 516 + "United States", profiles.get(0).getLabel());
503 } 517 }
504 } 518 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698