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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java

Issue 1982623002: [Autofill] Sort profiles and credit cards by frecency in PaymentRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary method Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java
index 20467b77401de6cd607e7c92c81633012ed8abfd..675adfcfa0b7586a2fbee5c497fc7e7bdbd49921 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTestHelper.java
@@ -34,20 +34,20 @@ public class AutofillTestHelper {
});
}
- List<AutofillProfile> getProfiles() throws ExecutionException {
+ List<AutofillProfile> getProfilesToSuggest() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<List<AutofillProfile>>() {
@Override
public List<AutofillProfile> call() {
- return PersonalDataManager.getInstance().getProfiles();
+ return PersonalDataManager.getInstance().getProfilesToSuggest();
}
});
}
- int getNumberOfProfiles() throws ExecutionException {
+ int getNumberOfProfilesToSuggest() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
- return PersonalDataManager.getInstance().getProfiles().size();
+ return PersonalDataManager.getInstance().getProfilesToSuggest().size();
}
}).intValue();
}
@@ -83,11 +83,31 @@ public class AutofillTestHelper {
});
}
- int getNumberOfCreditCards() throws ExecutionException {
+ List<CreditCard> getCreditCardsToSuggest() throws ExecutionException {
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<List<CreditCard>>() {
+ @Override
+ public List<CreditCard> call() {
+ return PersonalDataManager.getInstance().getCreditCardsToSuggest();
+ }
+ });
+ }
+
+ int getNumberOfCreditCardsToSuggest() throws ExecutionException {
+ return ThreadUtils
+ .runOnUiThreadBlocking(new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ return PersonalDataManager.getInstance().getCreditCardsToSuggest().size();
+ }
+ })
+ .intValue();
+ }
+
+ int getNumberOfCreditCardsForSettings() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
- return PersonalDataManager.getInstance().getCreditCards().size();
+ return PersonalDataManager.getInstance().getCreditCardsForSettings().size();
}
}).intValue();
}
@@ -104,6 +124,17 @@ public class AutofillTestHelper {
return guid;
}
+ public void addServerCreditCard(final CreditCard card)
+ throws InterruptedException, ExecutionException {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ PersonalDataManager.getInstance().addServerCreditCardForTest(card);
+ }
+ });
+ waitForDataChanged();
+ }
+
void deleteCreditCard(final String guid) throws InterruptedException {
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
@@ -114,6 +145,35 @@ public class AutofillTestHelper {
waitForDataChanged();
}
+ // Both |count| and |date| should be non-negative. |date| represents an absolute point in
+ // coordinated universal time (UTC) represented as microseconds since the Windows epoch. For
+ // more details see the comment header in time.h.
please use gerrit instead 2016/05/27 21:47:30 Let's use jsdoc style comments in Java: /** * Ge
sebsg 2016/05/31 15:26:14 Done.
+ void setProfileUseStatsForTesting(final String guid, final int count, final int date)
+ throws InterruptedException {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ PersonalDataManager.getInstance().setProfileUseStatsForTesting(guid, count, date);
+ }
+ });
+ waitForDataChanged();
+ }
+
+ // Both |count| and |date| should be non-negative. |date| represents an absolute point in
+ // coordinated universal time (UTC) represented as microseconds since the Windows epoch. For
+ // more details see the comment header in time.h
+ void setCreditCardUseStatsForTesting(final String guid, final int count, final int date)
please use gerrit instead 2016/05/27 21:47:30 jsdoc here as well.
sebsg 2016/05/31 15:26:14 Done.
+ throws InterruptedException {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ PersonalDataManager.getInstance().setCreditCardUseStatsForTesting(
+ guid, count, date);
+ }
+ });
+ waitForDataChanged();
+ }
+
private void registerDataObserver() {
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override

Powered by Google App Engine
This is Rietveld 408576698