| 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.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 8 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
| 10 import org.chromium.chrome.browser.autofill.PersonalDataManager.PersonalDataMana
gerObserver; | 10 import org.chromium.chrome.browser.autofill.PersonalDataManager.PersonalDataMana
gerObserver; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 public long getCurrentDateForTesting() throws InterruptedException, Executio
nException { | 319 public long getCurrentDateForTesting() throws InterruptedException, Executio
nException { |
| 320 return ThreadUtils.runOnUiThreadBlocking(new Callable<Long>() { | 320 return ThreadUtils.runOnUiThreadBlocking(new Callable<Long>() { |
| 321 @Override | 321 @Override |
| 322 public Long call() { | 322 public Long call() { |
| 323 return PersonalDataManager.getInstance().getCurrentDateForTestin
g(); | 323 return PersonalDataManager.getInstance().getCurrentDateForTestin
g(); |
| 324 } | 324 } |
| 325 }); | 325 }); |
| 326 } | 326 } |
| 327 | 327 |
| 328 private void registerDataObserver() { | 328 private void registerDataObserver() { |
| 329 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 329 try { |
| 330 @Override | 330 int callCount = mOnPersonalDataChangedHelper.getCallCount(); |
| 331 public void run() { | 331 boolean isDataLoaded = ThreadUtils.runOnUiThreadBlocking(new Callabl
e<Boolean>() { |
| 332 PersonalDataManager.getInstance().registerDataObserver( | 332 @Override |
| 333 new PersonalDataManagerObserver() { | 333 public Boolean call() { |
| 334 @Override | 334 return PersonalDataManager.getInstance().registerDataObserve
r( |
| 335 public void onPersonalDataChanged() { | 335 new PersonalDataManagerObserver() { |
| 336 mOnPersonalDataChangedHelper.notifyCalled(); | 336 @Override |
| 337 } | 337 public void onPersonalDataChanged() { |
| 338 } | 338 mOnPersonalDataChangedHelper.notifyCalled(); |
| 339 ); | 339 } |
| 340 } | 340 }); |
| 341 }); | 341 } |
| 342 }); |
| 343 if (isDataLoaded) return; |
| 344 mOnPersonalDataChangedHelper.waitForCallback(callCount); |
| 345 } catch (TimeoutException | InterruptedException | ExecutionException e)
{ |
| 346 throw new AssertionError(e); |
| 347 } |
| 342 } | 348 } |
| 343 } | 349 } |
| OLD | NEW |