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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady; | 71 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady; |
72 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInpu
t; | 72 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInpu
t; |
73 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; | 73 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; |
74 protected final CallbackHelper mReadyToEdit; | 74 protected final CallbackHelper mReadyToEdit; |
75 protected final CallbackHelper mEditorValidationError; | 75 protected final CallbackHelper mEditorValidationError; |
76 protected final CallbackHelper mEditorTextUpdate; | 76 protected final CallbackHelper mEditorTextUpdate; |
77 protected final CallbackHelper mDismissed; | 77 protected final CallbackHelper mDismissed; |
78 protected final CallbackHelper mUnableToAbort; | 78 protected final CallbackHelper mUnableToAbort; |
79 protected final CallbackHelper mBillingAddressChangeProcessed; | 79 protected final CallbackHelper mBillingAddressChangeProcessed; |
80 protected final CallbackHelper mShowFailed; | 80 protected final CallbackHelper mShowFailed; |
| 81 protected final CallbackHelper mActivePaymentQueryResponded; |
81 protected final CallbackHelper mExpirationMonthChange; | 82 protected final CallbackHelper mExpirationMonthChange; |
82 protected PaymentRequestUI mUI; | 83 protected PaymentRequestUI mUI; |
83 | 84 |
84 private final AtomicReference<ContentViewCore> mViewCoreRef; | 85 private final AtomicReference<ContentViewCore> mViewCoreRef; |
85 private final AtomicReference<WebContents> mWebContentsRef; | 86 private final AtomicReference<WebContents> mWebContentsRef; |
86 private final String mTestFilePath; | 87 private final String mTestFilePath; |
87 private CardUnmaskPrompt mCardUnmaskPrompt; | 88 private CardUnmaskPrompt mCardUnmaskPrompt; |
88 | 89 |
89 protected PaymentRequestTestBase(String testFileName) { | 90 protected PaymentRequestTestBase(String testFileName) { |
90 super(ChromeTabbedActivity.class); | 91 super(ChromeTabbedActivity.class); |
91 mReadyForInput = new PaymentsCallbackHelper<>(); | 92 mReadyForInput = new PaymentsCallbackHelper<>(); |
92 mReadyToPay = new PaymentsCallbackHelper<>(); | 93 mReadyToPay = new PaymentsCallbackHelper<>(); |
93 mSelectionChecked = new PaymentsCallbackHelper<>(); | 94 mSelectionChecked = new PaymentsCallbackHelper<>(); |
94 mResultReady = new PaymentsCallbackHelper<>(); | 95 mResultReady = new PaymentsCallbackHelper<>(); |
95 mReadyForUnmaskInput = new PaymentsCallbackHelper<>(); | 96 mReadyForUnmaskInput = new PaymentsCallbackHelper<>(); |
96 mReadyToUnmask = new PaymentsCallbackHelper<>(); | 97 mReadyToUnmask = new PaymentsCallbackHelper<>(); |
97 mReadyToEdit = new CallbackHelper(); | 98 mReadyToEdit = new CallbackHelper(); |
98 mEditorValidationError = new CallbackHelper(); | 99 mEditorValidationError = new CallbackHelper(); |
99 mEditorTextUpdate = new CallbackHelper(); | 100 mEditorTextUpdate = new CallbackHelper(); |
100 mDismissed = new CallbackHelper(); | 101 mDismissed = new CallbackHelper(); |
101 mUnableToAbort = new CallbackHelper(); | 102 mUnableToAbort = new CallbackHelper(); |
102 mBillingAddressChangeProcessed = new CallbackHelper(); | 103 mBillingAddressChangeProcessed = new CallbackHelper(); |
103 mExpirationMonthChange = new CallbackHelper(); | 104 mExpirationMonthChange = new CallbackHelper(); |
104 mShowFailed = new CallbackHelper(); | 105 mShowFailed = new CallbackHelper(); |
| 106 mActivePaymentQueryResponded = new CallbackHelper(); |
105 mViewCoreRef = new AtomicReference<>(); | 107 mViewCoreRef = new AtomicReference<>(); |
106 mWebContentsRef = new AtomicReference<>(); | 108 mWebContentsRef = new AtomicReference<>(); |
107 mTestFilePath = UrlUtils.getIsolatedTestFilePath( | 109 mTestFilePath = UrlUtils.getIsolatedTestFilePath( |
108 String.format("chrome/test/data/android/payments/%s", testFileNa
me)); | 110 String.format("chrome/test/data/android/payments/%s", testFileNa
me)); |
109 } | 111 } |
110 | 112 |
111 @Override | 113 @Override |
112 public void startMainActivity() throws InterruptedException {} | 114 public void startMainActivity() throws InterruptedException {} |
113 | 115 |
114 protected abstract void onMainActivityStarted() | 116 protected abstract void onMainActivityStarted() |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 mExpirationMonthChange.notifyCalled(); | 641 mExpirationMonthChange.notifyCalled(); |
640 } | 642 } |
641 | 643 |
642 @Override | 644 @Override |
643 public void onPaymentRequestServiceShowFailed() { | 645 public void onPaymentRequestServiceShowFailed() { |
644 ThreadUtils.assertOnUiThread(); | 646 ThreadUtils.assertOnUiThread(); |
645 mShowFailed.notifyCalled(); | 647 mShowFailed.notifyCalled(); |
646 } | 648 } |
647 | 649 |
648 @Override | 650 @Override |
| 651 public void onPaymentRequestServiceActivePaymentQueryResponded() { |
| 652 ThreadUtils.assertOnUiThread(); |
| 653 mActivePaymentQueryResponded.notifyCalled(); |
| 654 } |
| 655 |
| 656 @Override |
649 public void onCardUnmaskPromptReadyForInput(CardUnmaskPrompt prompt) { | 657 public void onCardUnmaskPromptReadyForInput(CardUnmaskPrompt prompt) { |
650 ThreadUtils.assertOnUiThread(); | 658 ThreadUtils.assertOnUiThread(); |
651 mReadyForUnmaskInput.notifyCalled(prompt); | 659 mReadyForUnmaskInput.notifyCalled(prompt); |
652 mCardUnmaskPrompt = prompt; | 660 mCardUnmaskPrompt = prompt; |
653 } | 661 } |
654 | 662 |
655 @Override | 663 @Override |
656 public void onCardUnmaskPromptReadyToUnmask(CardUnmaskPrompt prompt) { | 664 public void onCardUnmaskPromptReadyToUnmask(CardUnmaskPrompt prompt) { |
657 ThreadUtils.assertOnUiThread(); | 665 ThreadUtils.assertOnUiThread(); |
658 mReadyToUnmask.notifyCalled(prompt); | 666 mReadyToUnmask.notifyCalled(prompt); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 List<PaymentItem> cart, PaymentMethodData details, | 801 List<PaymentItem> cart, PaymentMethodData details, |
794 InstrumentDetailsCallback detailsCallback) { | 802 InstrumentDetailsCallback detailsCallback) { |
795 detailsCallback.onInstrumentDetailsReady( | 803 detailsCallback.onInstrumentDetailsReady( |
796 mMethodName, "{\"transaction\": 1337}"); | 804 mMethodName, "{\"transaction\": 1337}"); |
797 } | 805 } |
798 | 806 |
799 @Override | 807 @Override |
800 public void dismissInstrument() {} | 808 public void dismissInstrument() {} |
801 } | 809 } |
802 } | 810 } |
OLD | NEW |