| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.payments; | 5 package org.chromium.chrome.browser.payments; |
| 6 | 6 |
| 7 import static java.util.Arrays.asList; | 7 import static java.util.Arrays.asList; |
| 8 | 8 |
| 9 import android.os.Handler; | 9 import android.os.Handler; |
| 10 import android.view.KeyEvent; |
| 10 import android.view.View; | 11 import android.view.View; |
| 11 import android.view.ViewGroup; | 12 import android.view.ViewGroup; |
| 12 import android.widget.CheckBox; | 13 import android.widget.CheckBox; |
| 13 import android.widget.EditText; | 14 import android.widget.EditText; |
| 14 import android.widget.Spinner; | 15 import android.widget.Spinner; |
| 15 | 16 |
| 16 import org.chromium.base.ThreadUtils; | 17 import org.chromium.base.ThreadUtils; |
| 17 import org.chromium.base.test.util.CallbackHelper; | 18 import org.chromium.base.test.util.CallbackHelper; |
| 18 import org.chromium.base.test.util.RetryOnFailure; | 19 import org.chromium.base.test.util.RetryOnFailure; |
| 19 import org.chromium.base.test.util.UrlUtils; | 20 import org.chromium.base.test.util.UrlUtils; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 int callCount = helper.getCallCount(); | 275 int callCount = helper.getCallCount(); |
| 275 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 276 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 276 @Override | 277 @Override |
| 277 public void run() { | 278 public void run() { |
| 278 mUI.getEditorView().findViewById(resourceId).performClick(); | 279 mUI.getEditorView().findViewById(resourceId).performClick(); |
| 279 } | 280 } |
| 280 }); | 281 }); |
| 281 helper.waitForCallback(callCount); | 282 helper.waitForCallback(callCount); |
| 282 } | 283 } |
| 283 | 284 |
| 285 protected void clickAndroidBackButtonInEditorAndWait(CallbackHelper helper) |
| 286 throws InterruptedException, TimeoutException { |
| 287 int callCount = helper.getCallCount(); |
| 288 ThreadUtils.runOnUiThread(new Runnable() { |
| 289 @Override |
| 290 public void run() { |
| 291 mUI.getEditorView().dispatchKeyEvent( |
| 292 new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK
)); |
| 293 mUI.getEditorView().dispatchKeyEvent( |
| 294 new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK))
; |
| 295 } |
| 296 }); |
| 297 helper.waitForCallback(callCount); |
| 298 } |
| 299 |
| 284 /** Clicks on a button in the card unmask UI. */ | 300 /** Clicks on a button in the card unmask UI. */ |
| 285 protected void clickCardUnmaskButtonAndWait(final int dialogButtonId, Callba
ckHelper helper) | 301 protected void clickCardUnmaskButtonAndWait(final int dialogButtonId, Callba
ckHelper helper) |
| 286 throws InterruptedException, TimeoutException { | 302 throws InterruptedException, TimeoutException { |
| 287 int callCount = helper.getCallCount(); | 303 int callCount = helper.getCallCount(); |
| 288 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 304 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 289 @Override | 305 @Override |
| 290 public void run() { | 306 public void run() { |
| 291 mCardUnmaskPrompt.getDialogForTest().getButton(dialogButtonId).p
erformClick(); | 307 mCardUnmaskPrompt.getDialogForTest().getButton(dialogButtonId).p
erformClick(); |
| 292 } | 308 } |
| 293 }); | 309 }); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi
er> modifiers, | 978 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi
er> modifiers, |
| 963 InstrumentDetailsCallback detailsCallback) { | 979 InstrumentDetailsCallback detailsCallback) { |
| 964 detailsCallback.onInstrumentDetailsReady( | 980 detailsCallback.onInstrumentDetailsReady( |
| 965 mMethodName, "{\"transaction\": 1337}"); | 981 mMethodName, "{\"transaction\": 1337}"); |
| 966 } | 982 } |
| 967 | 983 |
| 968 @Override | 984 @Override |
| 969 public void dismissInstrument() {} | 985 public void dismissInstrument() {} |
| 970 } | 986 } |
| 971 } | 987 } |
| OLD | NEW |