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

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

Issue 2879853003: [Payments] Code Refactoring for the Subkey Request (Closed)
Patch Set: Changing a comment. Created 3 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 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 org.chromium.base.ThreadUtils; 7 import org.chromium.base.ThreadUtils;
8 import org.chromium.base.test.util.CallbackHelper; 8 import org.chromium.base.test.util.CallbackHelper;
9 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
10 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; 10 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
11 import org.chromium.chrome.browser.autofill.PersonalDataManager.PersonalDataMana gerObserver; 11 import org.chromium.chrome.browser.autofill.PersonalDataManager.PersonalDataMana gerObserver;
12 12
13 import java.util.List; 13 import java.util.List;
14 import java.util.concurrent.Callable; 14 import java.util.concurrent.Callable;
15 import java.util.concurrent.ExecutionException; 15 import java.util.concurrent.ExecutionException;
16 import java.util.concurrent.TimeoutException; 16 import java.util.concurrent.TimeoutException;
17 17
18 /** 18 /**
19 * Helper class for testing AutofillProfiles. 19 * Helper class for testing AutofillProfiles.
20 */ 20 */
21 public class AutofillTestHelper { 21 public class AutofillTestHelper {
22 22
23 private final CallbackHelper mOnPersonalDataChangedHelper = new CallbackHelp er(); 23 private final CallbackHelper mOnPersonalDataChangedHelper = new CallbackHelp er();
24 24
25 public AutofillTestHelper() { 25 public AutofillTestHelper() {
26 registerDataObserver(); 26 registerDataObserver();
27 setNormalizationTimeoutForTesting(); 27 setRequestTimeoutForTesting();
28 } 28 }
29 29
30 void setNormalizationTimeoutForTesting() { 30 void setRequestTimeoutForTesting() {
31 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 31 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
32 @Override 32 @Override
33 public void run() { 33 public void run() {
34 PersonalDataManager.getInstance().setNormalizationTimeoutForTest ing(0); 34 PersonalDataManager.getInstance().setRequestTimeoutForTesting(0) ;
35 } 35 }
36 }); 36 });
37 } 37 }
38 38
39 AutofillProfile getProfile(final String guid) throws ExecutionException { 39 AutofillProfile getProfile(final String guid) throws ExecutionException {
40 return ThreadUtils.runOnUiThreadBlocking(new Callable<AutofillProfile>() { 40 return ThreadUtils.runOnUiThreadBlocking(new Callable<AutofillProfile>() {
41 @Override 41 @Override
42 public AutofillProfile call() { 42 public AutofillProfile call() {
43 return PersonalDataManager.getInstance().getProfile(guid); 43 return PersonalDataManager.getInstance().getProfile(guid);
44 } 44 }
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 }); 350 });
351 } 351 }
352 }); 352 });
353 if (isDataLoaded) return; 353 if (isDataLoaded) return;
354 mOnPersonalDataChangedHelper.waitForCallback(callCount); 354 mOnPersonalDataChangedHelper.waitForCallback(callCount);
355 } catch (TimeoutException | InterruptedException | ExecutionException e) { 355 } catch (TimeoutException | InterruptedException | ExecutionException e) {
356 throw new AssertionError(e); 356 throw new AssertionError(e);
357 } 357 }
358 } 358 }
359 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698