| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // PaymentRequestDialogView::ObserverForTest: | 78 // PaymentRequestDialogView::ObserverForTest: |
| 79 void OnDialogOpened() override; | 79 void OnDialogOpened() override; |
| 80 void OnOrderSummaryOpened() override; | 80 void OnOrderSummaryOpened() override; |
| 81 void OnPaymentMethodOpened() override; | 81 void OnPaymentMethodOpened() override; |
| 82 void OnShippingSectionOpened() override; | 82 void OnShippingSectionOpened() override; |
| 83 void OnCreditCardEditorOpened() override; | 83 void OnCreditCardEditorOpened() override; |
| 84 void OnShippingAddressEditorOpened() override; | 84 void OnShippingAddressEditorOpened() override; |
| 85 void OnBackNavigation() override; | 85 void OnBackNavigation() override; |
| 86 void OnContactInfoOpened() override; | 86 void OnContactInfoOpened() override; |
| 87 void OnEditorViewUpdated() override; | 87 void OnEditorViewUpdated() override; |
| 88 void OnErrorMessageShown() override; |
| 88 | 89 |
| 89 // views::WidgetObserver | 90 // views::WidgetObserver |
| 90 // Effective way to be warned of all dialog closures. | 91 // Effective way to be warned of all dialog closures. |
| 91 void OnWidgetDestroyed(views::Widget* widget) override; | 92 void OnWidgetDestroyed(views::Widget* widget) override; |
| 92 | 93 |
| 93 // Will call JavaScript to invoke the PaymentRequest dialog and verify that | 94 // Will call JavaScript to invoke the PaymentRequest dialog and verify that |
| 94 // it's open. | 95 // it's open. |
| 95 void InvokePaymentRequestUI(); | 96 void InvokePaymentRequestUI(); |
| 96 | 97 |
| 97 // Will expect that all strings in |expected_strings| are present in output. | 98 // Will expect that all strings in |expected_strings| are present in output. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 120 // are added close to each other. | 121 // are added close to each other. |
| 121 void AddAutofillProfile(const autofill::AutofillProfile& profile); | 122 void AddAutofillProfile(const autofill::AutofillProfile& profile); |
| 122 void AddCreditCard(const autofill::CreditCard& card); | 123 void AddCreditCard(const autofill::CreditCard& card); |
| 123 | 124 |
| 124 void CreatePaymentRequestForTest( | 125 void CreatePaymentRequestForTest( |
| 125 content::WebContents* web_contents, | 126 content::WebContents* web_contents, |
| 126 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); | 127 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); |
| 127 | 128 |
| 128 // Click on a view from within the dialog and waits for an observed event | 129 // Click on a view from within the dialog and waits for an observed event |
| 129 // to be observed. | 130 // to be observed. |
| 130 void ClickOnDialogViewAndWait(DialogViewID view_id); | 131 void ClickOnDialogViewAndWait(DialogViewID view_id, |
| 131 void ClickOnDialogViewAndWait(views::View* view); | 132 bool wait_for_animation = true); |
| 133 void ClickOnDialogViewAndWait(views::View* view, |
| 134 bool wait_for_animation = true); |
| 132 | 135 |
| 133 // Setting the |value| in the textfield of a given |type|. | 136 // Setting the |value| in the textfield of a given |type|. |
| 134 void SetEditorTextfieldValue(const base::string16& value, | 137 void SetEditorTextfieldValue(const base::string16& value, |
| 135 autofill::ServerFieldType type); | 138 autofill::ServerFieldType type); |
| 136 // Setting the |value| in the combobox of a given |type|. | 139 // Setting the |value| in the combobox of a given |type|. |
| 137 void SetComboboxValue(const base::string16& value, | 140 void SetComboboxValue(const base::string16& value, |
| 138 autofill::ServerFieldType type); | 141 autofill::ServerFieldType type); |
| 139 | 142 |
| 140 // Whether the editor textfield/combobox for the given |type| is currently in | 143 // Whether the editor textfield/combobox for the given |type| is currently in |
| 141 // an invalid state. | 144 // an invalid state. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 163 DIALOG_CLOSED, | 166 DIALOG_CLOSED, |
| 164 ORDER_SUMMARY_OPENED, | 167 ORDER_SUMMARY_OPENED, |
| 165 PAYMENT_METHOD_OPENED, | 168 PAYMENT_METHOD_OPENED, |
| 166 SHIPPING_SECTION_OPENED, | 169 SHIPPING_SECTION_OPENED, |
| 167 CREDIT_CARD_EDITOR_OPENED, | 170 CREDIT_CARD_EDITOR_OPENED, |
| 168 SHIPPING_ADDRESS_EDITOR_OPENED, | 171 SHIPPING_ADDRESS_EDITOR_OPENED, |
| 169 BACK_NAVIGATION, | 172 BACK_NAVIGATION, |
| 170 CONTACT_INFO_OPENED, | 173 CONTACT_INFO_OPENED, |
| 171 EDITOR_VIEW_UPDATED, | 174 EDITOR_VIEW_UPDATED, |
| 172 CAN_MAKE_PAYMENT_CALLED, | 175 CAN_MAKE_PAYMENT_CALLED, |
| 176 ERROR_MESSAGE_SHOWN, |
| 173 }; | 177 }; |
| 174 | 178 |
| 175 // DialogEventObserver is used to wait on specific events that may have | 179 // DialogEventObserver is used to wait on specific events that may have |
| 176 // occured before the call to Wait(), or after, in which case a RunLoop is | 180 // occured before the call to Wait(), or after, in which case a RunLoop is |
| 177 // used. | 181 // used. |
| 178 // | 182 // |
| 179 // Usage: | 183 // Usage: |
| 180 // observer_.reset(new DialogEventObserver([DialogEvent])); | 184 // observer_.reset(new DialogEventObserver([DialogEvent])); |
| 181 // | 185 // |
| 182 // Do stuff, which (a)synchronously calls observer_->Observe([DialogEvent]). | 186 // Do stuff, which (a)synchronously calls observer_->Observe([DialogEvent]). |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Weak, owned by the PaymentRequest object. | 219 // Weak, owned by the PaymentRequest object. |
| 216 TestChromePaymentRequestDelegate* delegate_; | 220 TestChromePaymentRequestDelegate* delegate_; |
| 217 bool incognito_for_testing_; | 221 bool incognito_for_testing_; |
| 218 | 222 |
| 219 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); | 223 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); |
| 220 }; | 224 }; |
| 221 | 225 |
| 222 } // namespace payments | 226 } // namespace payments |
| 223 | 227 |
| 224 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ | 228 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ |
| OLD | NEW |