| 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.Context; | 7 import android.content.Context; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady; | 72 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady; |
| 73 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInpu
t; | 73 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInpu
t; |
| 74 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; | 74 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; |
| 75 protected final CallbackHelper mReadyToEdit; | 75 protected final CallbackHelper mReadyToEdit; |
| 76 protected final CallbackHelper mEditorValidationError; | 76 protected final CallbackHelper mEditorValidationError; |
| 77 protected final CallbackHelper mEditorTextUpdate; | 77 protected final CallbackHelper mEditorTextUpdate; |
| 78 protected final CallbackHelper mDismissed; | 78 protected final CallbackHelper mDismissed; |
| 79 protected final CallbackHelper mUnableToAbort; | 79 protected final CallbackHelper mUnableToAbort; |
| 80 protected final CallbackHelper mBillingAddressChangeProcessed; | 80 protected final CallbackHelper mBillingAddressChangeProcessed; |
| 81 protected final CallbackHelper mShowFailed; | 81 protected final CallbackHelper mShowFailed; |
| 82 protected final CallbackHelper mActivePaymentQueryResponded; |
| 82 protected final CallbackHelper mExpirationMonthChange; | 83 protected final CallbackHelper mExpirationMonthChange; |
| 83 protected PaymentRequestUI mUI; | 84 protected PaymentRequestUI mUI; |
| 84 | 85 |
| 85 private final AtomicReference<ContentViewCore> mViewCoreRef; | 86 private final AtomicReference<ContentViewCore> mViewCoreRef; |
| 86 private final AtomicReference<WebContents> mWebContentsRef; | 87 private final AtomicReference<WebContents> mWebContentsRef; |
| 87 private final String mTestFilePath; | 88 private final String mTestFilePath; |
| 88 private CardUnmaskPrompt mCardUnmaskPrompt; | 89 private CardUnmaskPrompt mCardUnmaskPrompt; |
| 89 | 90 |
| 90 protected PaymentRequestTestBase(String testFileName) { | 91 protected PaymentRequestTestBase(String testFileName) { |
| 91 super(ChromeTabbedActivity.class); | 92 super(ChromeTabbedActivity.class); |
| 92 mReadyForInput = new PaymentsCallbackHelper<>(); | 93 mReadyForInput = new PaymentsCallbackHelper<>(); |
| 93 mReadyToPay = new PaymentsCallbackHelper<>(); | 94 mReadyToPay = new PaymentsCallbackHelper<>(); |
| 94 mSelectionChecked = new PaymentsCallbackHelper<>(); | 95 mSelectionChecked = new PaymentsCallbackHelper<>(); |
| 95 mResultReady = new PaymentsCallbackHelper<>(); | 96 mResultReady = new PaymentsCallbackHelper<>(); |
| 96 mReadyForUnmaskInput = new PaymentsCallbackHelper<>(); | 97 mReadyForUnmaskInput = new PaymentsCallbackHelper<>(); |
| 97 mReadyToUnmask = new PaymentsCallbackHelper<>(); | 98 mReadyToUnmask = new PaymentsCallbackHelper<>(); |
| 98 mReadyToEdit = new CallbackHelper(); | 99 mReadyToEdit = new CallbackHelper(); |
| 99 mEditorValidationError = new CallbackHelper(); | 100 mEditorValidationError = new CallbackHelper(); |
| 100 mEditorTextUpdate = new CallbackHelper(); | 101 mEditorTextUpdate = new CallbackHelper(); |
| 101 mDismissed = new CallbackHelper(); | 102 mDismissed = new CallbackHelper(); |
| 102 mUnableToAbort = new CallbackHelper(); | 103 mUnableToAbort = new CallbackHelper(); |
| 103 mBillingAddressChangeProcessed = new CallbackHelper(); | 104 mBillingAddressChangeProcessed = new CallbackHelper(); |
| 104 mExpirationMonthChange = new CallbackHelper(); | 105 mExpirationMonthChange = new CallbackHelper(); |
| 105 mShowFailed = new CallbackHelper(); | 106 mShowFailed = new CallbackHelper(); |
| 107 mActivePaymentQueryResponded = new CallbackHelper(); |
| 106 mViewCoreRef = new AtomicReference<>(); | 108 mViewCoreRef = new AtomicReference<>(); |
| 107 mWebContentsRef = new AtomicReference<>(); | 109 mWebContentsRef = new AtomicReference<>(); |
| 108 mTestFilePath = UrlUtils.getIsolatedTestFilePath( | 110 mTestFilePath = UrlUtils.getIsolatedTestFilePath( |
| 109 String.format("chrome/test/data/android/payments/%s", testFileNa
me)); | 111 String.format("chrome/test/data/android/payments/%s", testFileNa
me)); |
| 110 } | 112 } |
| 111 | 113 |
| 112 @Override | 114 @Override |
| 113 public void startMainActivity() throws InterruptedException {} | 115 public void startMainActivity() throws InterruptedException {} |
| 114 | 116 |
| 115 protected abstract void onMainActivityStarted() | 117 protected abstract void onMainActivityStarted() |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 mExpirationMonthChange.notifyCalled(); | 627 mExpirationMonthChange.notifyCalled(); |
| 626 } | 628 } |
| 627 | 629 |
| 628 @Override | 630 @Override |
| 629 public void onPaymentRequestServiceShowFailed() { | 631 public void onPaymentRequestServiceShowFailed() { |
| 630 ThreadUtils.assertOnUiThread(); | 632 ThreadUtils.assertOnUiThread(); |
| 631 mShowFailed.notifyCalled(); | 633 mShowFailed.notifyCalled(); |
| 632 } | 634 } |
| 633 | 635 |
| 634 @Override | 636 @Override |
| 637 public void onPaymentRequestServiceActivePaymentQueryResponded() { |
| 638 ThreadUtils.assertOnUiThread(); |
| 639 mActivePaymentQueryResponded.notifyCalled(); |
| 640 } |
| 641 |
| 642 @Override |
| 635 public void onCardUnmaskPromptReadyForInput(CardUnmaskPrompt prompt) { | 643 public void onCardUnmaskPromptReadyForInput(CardUnmaskPrompt prompt) { |
| 636 ThreadUtils.assertOnUiThread(); | 644 ThreadUtils.assertOnUiThread(); |
| 637 mReadyForUnmaskInput.notifyCalled(prompt); | 645 mReadyForUnmaskInput.notifyCalled(prompt); |
| 638 mCardUnmaskPrompt = prompt; | 646 mCardUnmaskPrompt = prompt; |
| 639 } | 647 } |
| 640 | 648 |
| 641 @Override | 649 @Override |
| 642 public void onCardUnmaskPromptReadyToUnmask(CardUnmaskPrompt prompt) { | 650 public void onCardUnmaskPromptReadyToUnmask(CardUnmaskPrompt prompt) { |
| 643 ThreadUtils.assertOnUiThread(); | 651 ThreadUtils.assertOnUiThread(); |
| 644 mReadyToUnmask.notifyCalled(prompt); | 652 mReadyToUnmask.notifyCalled(prompt); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 List<PaymentItem> cart, JSONObject details, | 787 List<PaymentItem> cart, JSONObject details, |
| 780 InstrumentDetailsCallback detailsCallback) { | 788 InstrumentDetailsCallback detailsCallback) { |
| 781 detailsCallback.onInstrumentDetailsReady( | 789 detailsCallback.onInstrumentDetailsReady( |
| 782 mMethodName, "{\"transaction\": 1337}"); | 790 mMethodName, "{\"transaction\": 1337}"); |
| 783 } | 791 } |
| 784 | 792 |
| 785 @Override | 793 @Override |
| 786 public void dismissInstrument() {} | 794 public void dismissInstrument() {} |
| 787 } | 795 } |
| 788 } | 796 } |
| OLD | NEW |