Chromium Code Reviews| 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 getInstrumentation().waitForIdleSync(); | |
|
please use gerrit instead
2017/02/21 19:33:08
Why is this line necessary in this method? It's no
gogerald1
2017/02/21 20:44:03
Done.
| |
| 298 helper.waitForCallback(callCount); | |
| 299 } | |
| 300 | |
| 284 /** Clicks on a button in the card unmask UI. */ | 301 /** Clicks on a button in the card unmask UI. */ |
| 285 protected void clickCardUnmaskButtonAndWait(final int dialogButtonId, Callba ckHelper helper) | 302 protected void clickCardUnmaskButtonAndWait(final int dialogButtonId, Callba ckHelper helper) |
| 286 throws InterruptedException, TimeoutException { | 303 throws InterruptedException, TimeoutException { |
| 287 int callCount = helper.getCallCount(); | 304 int callCount = helper.getCallCount(); |
| 288 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 305 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 289 @Override | 306 @Override |
| 290 public void run() { | 307 public void run() { |
| 291 mCardUnmaskPrompt.getDialogForTest().getButton(dialogButtonId).p erformClick(); | 308 mCardUnmaskPrompt.getDialogForTest().getButton(dialogButtonId).p erformClick(); |
| 292 } | 309 } |
| 293 }); | 310 }); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi er> modifiers, | 979 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi er> modifiers, |
| 963 InstrumentDetailsCallback detailsCallback) { | 980 InstrumentDetailsCallback detailsCallback) { |
| 964 detailsCallback.onInstrumentDetailsReady( | 981 detailsCallback.onInstrumentDetailsReady( |
| 965 mMethodName, "{\"transaction\": 1337}"); | 982 mMethodName, "{\"transaction\": 1337}"); |
| 966 } | 983 } |
| 967 | 984 |
| 968 @Override | 985 @Override |
| 969 public void dismissInstrument() {} | 986 public void dismissInstrument() {} |
| 970 } | 987 } |
| 971 } | 988 } |
| OLD | NEW |