Index: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java |
index c0be4f4ca7a50d9bfc41d88fc0ebbd94b64502e4..d737a8d9471d507044a05c90c01af81b0e925313 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java |
@@ -4,6 +4,7 @@ |
package org.chromium.chrome.browser.autofill; |
+import android.os.SystemClock; |
import android.test.suitebuilder.annotation.SmallTest; |
import org.chromium.base.test.util.Feature; |
@@ -515,4 +516,49 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase { |
assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, California 90210, " |
+ "United States", profiles.get(0).getLabel()); |
} |
+ |
+ @SmallTest |
+ @Feature({"Autofill"}) |
+ public void testAreRegionRulesLoaded_SuccessfullLoad() |
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ mHelper.setMockAddressValidatorForTesting(true); |
+ |
+ mHelper.loadRulesForRegion("CA"); |
+ assertTrue(mHelper.areRulesDoneLoadingForRegion("CA")); |
+ assertTrue(mHelper.areRulesSuccessfullyLoadedForRegion("CA")); |
+ } |
+ |
+ @SmallTest |
+ @Feature({"Autofill"}) |
+ public void testAreRegionRulesLoaded_UnsuccessfullLoad() |
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ mHelper.setMockAddressValidatorForTesting(false); |
+ |
+ mHelper.loadRulesForRegion("CA"); |
+ assertTrue(mHelper.areRulesDoneLoadingForRegion("CA")); |
+ assertFalse(mHelper.areRulesSuccessfullyLoadedForRegion("CA")); |
+ } |
+ |
+ @SmallTest |
+ @Feature({"Autofill"}) |
+ public void testgetNormalizedProfile_Timeout() |
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ // Make sure to not load the rules. |
+ mHelper.setMockAddressValidatorForTesting(false); |
+ |
+ // Create a profile. |
+ String profileGUID = mHelper.setProfile(createTestProfile()); |
+ |
+ // Start a timer. |
+ long start = SystemClock.uptimeMillis(); |
+ |
+ // Try to normalize the profile. |
+ mHelper.getNormalizedProfile(profileGUID, "CA"); |
+ |
+ // Make sure the timout happened between 4 and 5 seconds. |
+ long finish = SystemClock.uptimeMillis(); |
+ long duration = finish - start; |
+ assertTrue(duration > 4000); |
+ assertTrue(duration < 6000); |
please use gerrit instead
2016/09/16 22:30:41
Yikes! Nuke this test, quick! These tests will fla
sebsg
2016/09/22 19:50:40
Haha, yeah this was not meant to get into producti
|
+ } |
} |