| 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.content.DialogInterface; | 7 import android.content.DialogInterface; |
| 8 | 8 |
| 9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.test.util.CommandLineFlags; | 10 import org.chromium.base.test.util.CommandLineFlags; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * A base integration test for payments. | 31 * A base integration test for payments. |
| 32 */ | 32 */ |
| 33 @CommandLineFlags.Add({ChromeSwitches.EXPERIMENTAL_WEB_PLAFTORM_FEATURES}) | 33 @CommandLineFlags.Add({ChromeSwitches.EXPERIMENTAL_WEB_PLAFTORM_FEATURES}) |
| 34 abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
ctivity> | 34 abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
ctivity> |
| 35 implements PaymentRequestObserverForTest, CardUnmaskObserverForTest { | 35 implements PaymentRequestObserverForTest, CardUnmaskObserverForTest { |
| 36 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput; | 36 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput; |
| 37 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay; | 37 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay; |
| 38 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToClose; | 38 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToClose; |
| 39 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady; |
| 39 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; | 40 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; |
| 40 protected final CallbackHelper mDismissed; | 41 protected final CallbackHelper mDismissed; |
| 41 private final AtomicReference<ContentViewCore> mViewCoreRef; | 42 private final AtomicReference<ContentViewCore> mViewCoreRef; |
| 42 private final AtomicReference<WebContents> mWebContentsRef; | 43 private final AtomicReference<WebContents> mWebContentsRef; |
| 43 private final String mTestFilePath; | 44 private final String mTestFilePath; |
| 44 private PaymentRequestUI mUI; | 45 private PaymentRequestUI mUI; |
| 45 | 46 |
| 46 protected PaymentRequestTestBase(String testFileName) { | 47 protected PaymentRequestTestBase(String testFileName) { |
| 47 super(ChromeActivity.class); | 48 super(ChromeActivity.class); |
| 48 mReadyForInput = new PaymentsCallbackHelper<>(); | 49 mReadyForInput = new PaymentsCallbackHelper<>(); |
| 49 mReadyToPay = new PaymentsCallbackHelper<>(); | 50 mReadyToPay = new PaymentsCallbackHelper<>(); |
| 50 mReadyToClose = new PaymentsCallbackHelper<>(); | 51 mReadyToClose = new PaymentsCallbackHelper<>(); |
| 52 mResultReady = new PaymentsCallbackHelper<>(); |
| 51 mReadyToUnmask = new PaymentsCallbackHelper<>(); | 53 mReadyToUnmask = new PaymentsCallbackHelper<>(); |
| 52 mDismissed = new CallbackHelper(); | 54 mDismissed = new CallbackHelper(); |
| 53 mViewCoreRef = new AtomicReference<>(); | 55 mViewCoreRef = new AtomicReference<>(); |
| 54 mWebContentsRef = new AtomicReference<>(); | 56 mWebContentsRef = new AtomicReference<>(); |
| 55 mTestFilePath = UrlUtils.getIsolatedTestFilePath( | 57 mTestFilePath = UrlUtils.getIsolatedTestFilePath( |
| 56 String.format("chrome/test/data/android/payments/%s", testFileNa
me)); | 58 String.format("chrome/test/data/android/payments/%s", testFileNa
me)); |
| 57 } | 59 } |
| 58 | 60 |
| 59 @Override | 61 @Override |
| 60 public void startMainActivity() throws InterruptedException {} | 62 public void startMainActivity() throws InterruptedException {} |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 mReadyToPay.notifyCalled(ui); | 150 mReadyToPay.notifyCalled(ui); |
| 149 } | 151 } |
| 150 | 152 |
| 151 @Override | 153 @Override |
| 152 public void onPaymentRequestReadyToClose(PaymentRequestUI ui) { | 154 public void onPaymentRequestReadyToClose(PaymentRequestUI ui) { |
| 153 ThreadUtils.assertOnUiThread(); | 155 ThreadUtils.assertOnUiThread(); |
| 154 mReadyToClose.notifyCalled(ui); | 156 mReadyToClose.notifyCalled(ui); |
| 155 } | 157 } |
| 156 | 158 |
| 157 @Override | 159 @Override |
| 160 public void onPaymentRequestResultReady(PaymentRequestUI ui) { |
| 161 ThreadUtils.assertOnUiThread(); |
| 162 mResultReady.notifyCalled(ui); |
| 163 } |
| 164 |
| 165 |
| 166 @Override |
| 158 public void onPaymentRequestDismiss() { | 167 public void onPaymentRequestDismiss() { |
| 159 ThreadUtils.assertOnUiThread(); | 168 ThreadUtils.assertOnUiThread(); |
| 160 mDismissed.notifyCalled(); | 169 mDismissed.notifyCalled(); |
| 161 } | 170 } |
| 162 | 171 |
| 163 @Override | 172 @Override |
| 164 public void onCardUnmaskReadyForInput(CardUnmaskPrompt prompt) { | 173 public void onCardUnmaskReadyForInput(CardUnmaskPrompt prompt) { |
| 165 ThreadUtils.assertOnUiThread(); | 174 ThreadUtils.assertOnUiThread(); |
| 166 mReadyToUnmask.notifyCalled(prompt); | 175 mReadyToUnmask.notifyCalled(prompt); |
| 167 } | 176 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 186 * | 195 * |
| 187 * @param ui The UI that is ready for input. | 196 * @param ui The UI that is ready for input. |
| 188 */ | 197 */ |
| 189 public void notifyCalled(T target) { | 198 public void notifyCalled(T target) { |
| 190 ThreadUtils.assertOnUiThread(); | 199 ThreadUtils.assertOnUiThread(); |
| 191 mTarget = target; | 200 mTarget = target; |
| 192 notifyCalled(); | 201 notifyCalled(); |
| 193 } | 202 } |
| 194 } | 203 } |
| 195 } | 204 } |
| OLD | NEW |