| 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 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; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 public AutofillTestHelper() { | 25 public AutofillTestHelper() { |
| 26 registerDataObserver(); | 26 registerDataObserver(); |
| 27 setNormalizationTimeoutForTesting(); | 27 setNormalizationTimeoutForTesting(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void setNormalizationTimeoutForTesting() { | 30 void setNormalizationTimeoutForTesting() { |
| 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(1); | 34 PersonalDataManager.getInstance().setNormalizationTimeoutForTest
ing(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 Loading... |
| 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 } |
| OLD | NEW |