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 android.widget.EditText; | 7 import android.widget.EditText; |
| 8 import android.widget.TextView; | |
| 8 | 9 |
| 9 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.test.util.CommandLineFlags; | 11 import org.chromium.base.test.util.CommandLineFlags; |
| 11 import org.chromium.base.test.util.UrlUtils; | 12 import org.chromium.base.test.util.UrlUtils; |
| 13 import org.chromium.chrome.R; | |
| 12 import org.chromium.chrome.browser.ChromeActivity; | 14 import org.chromium.chrome.browser.ChromeActivity; |
| 13 import org.chromium.chrome.browser.ChromeSwitches; | 15 import org.chromium.chrome.browser.ChromeSwitches; |
| 14 import org.chromium.chrome.browser.autofill.CardUnmaskPrompt; | 16 import org.chromium.chrome.browser.autofill.CardUnmaskPrompt; |
| 15 import org.chromium.chrome.browser.autofill.CardUnmaskPrompt.CardUnmaskObserverF orTest; | 17 import org.chromium.chrome.browser.autofill.CardUnmaskPrompt.CardUnmaskObserverF orTest; |
| 16 import org.chromium.chrome.browser.payments.ui.PaymentRequestUI; | 18 import org.chromium.chrome.browser.payments.ui.PaymentRequestUI; |
| 17 import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestOb serverForTest; | 19 import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestOb serverForTest; |
| 18 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 20 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 19 import org.chromium.content.browser.ContentViewCore; | 21 import org.chromium.content.browser.ContentViewCore; |
| 20 import org.chromium.content.browser.test.util.CallbackHelper; | 22 import org.chromium.content.browser.test.util.CallbackHelper; |
| 21 import org.chromium.content.browser.test.util.Criteria; | 23 import org.chromium.content.browser.test.util.Criteria; |
| 22 import org.chromium.content.browser.test.util.CriteriaHelper; | 24 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 23 import org.chromium.content.browser.test.util.DOMUtils; | 25 import org.chromium.content.browser.test.util.DOMUtils; |
| 24 import org.chromium.content_public.browser.WebContents; | 26 import org.chromium.content_public.browser.WebContents; |
| 25 | 27 |
| 28 import java.util.concurrent.Callable; | |
| 26 import java.util.concurrent.ExecutionException; | 29 import java.util.concurrent.ExecutionException; |
| 27 import java.util.concurrent.TimeoutException; | 30 import java.util.concurrent.TimeoutException; |
| 28 import java.util.concurrent.atomic.AtomicReference; | 31 import java.util.concurrent.atomic.AtomicReference; |
| 29 | 32 |
| 30 /** | 33 /** |
| 31 * A base integration test for payments. | 34 * A base integration test for payments. |
| 32 */ | 35 */ |
| 33 @CommandLineFlags.Add({ChromeSwitches.EXPERIMENTAL_WEB_PLAFTORM_FEATURES}) | 36 @CommandLineFlags.Add({ChromeSwitches.EXPERIMENTAL_WEB_PLAFTORM_FEATURES}) |
| 34 abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA ctivity> | 37 abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA ctivity> |
| 35 implements PaymentRequestObserverForTest, CardUnmaskObserverForTest { | 38 implements PaymentRequestObserverForTest, CardUnmaskObserverForTest { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 int callCount = helper.getCallCount(); | 95 int callCount = helper.getCallCount(); |
| 93 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 96 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 94 @Override | 97 @Override |
| 95 public void run() { | 98 public void run() { |
| 96 mUI.getDialogForTest().findViewById(resourceId).performClick(); | 99 mUI.getDialogForTest().findViewById(resourceId).performClick(); |
| 97 } | 100 } |
| 98 }); | 101 }); |
| 99 helper.waitForCallback(callCount); | 102 helper.waitForCallback(callCount); |
| 100 } | 103 } |
| 101 | 104 |
| 105 protected String getAddressSectionLabel() throws ExecutionException { | |
| 106 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { | |
| 107 @Override | |
| 108 public String call() { | |
| 109 return ((TextView) mUI.getShippingAddressSectionForTest().findVi ewById( | |
|
gone
2016/05/27 23:47:29
I think you'll actually be able to get by just by
please use gerrit instead
2016/05/28 05:29:12
I was under the impression that every section will
| |
| 110 R.id.payments_left_summary_label)).getText().toString(); | |
| 111 } | |
| 112 }); | |
| 113 } | |
| 114 | |
| 102 protected void typeInCardUnmaskDialogAndWait(final int resourceId, final Str ing input, | 115 protected void typeInCardUnmaskDialogAndWait(final int resourceId, final Str ing input, |
| 103 final CardUnmaskPrompt prompt, CallbackHelper helper) throws Interru ptedException, | 116 final CardUnmaskPrompt prompt, CallbackHelper helper) throws Interru ptedException, |
| 104 TimeoutException { | 117 TimeoutException { |
| 105 int callCount = helper.getCallCount(); | 118 int callCount = helper.getCallCount(); |
| 106 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 119 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 107 @Override | 120 @Override |
| 108 public void run() { | 121 public void run() { |
| 109 ((EditText) prompt.getDialogForTest().findViewById(resourceId)). setText(input); | 122 ((EditText) prompt.getDialogForTest().findViewById(resourceId)). setText(input); |
| 110 } | 123 } |
| 111 }); | 124 }); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 * | 230 * |
| 218 * @param ui The UI that is ready for input. | 231 * @param ui The UI that is ready for input. |
| 219 */ | 232 */ |
| 220 public void notifyCalled(T target) { | 233 public void notifyCalled(T target) { |
| 221 ThreadUtils.assertOnUiThread(); | 234 ThreadUtils.assertOnUiThread(); |
| 222 mTarget = target; | 235 mTarget = target; |
| 223 notifyCalled(); | 236 notifyCalled(); |
| 224 } | 237 } |
| 225 } | 238 } |
| 226 } | 239 } |
| OLD | NEW |