| 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 <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 void SetIncognitoForTesting(); | 74 void SetIncognitoForTesting(); |
| 75 | 75 |
| 76 // PaymentRequest::ObserverForTest: | 76 // PaymentRequest::ObserverForTest: |
| 77 void OnCanMakePaymentCalled() override; | 77 void OnCanMakePaymentCalled() override; |
| 78 | 78 |
| 79 // PaymentRequestDialogView::ObserverForTest: | 79 // PaymentRequestDialogView::ObserverForTest: |
| 80 void OnDialogOpened() override; | 80 void OnDialogOpened() override; |
| 81 void OnOrderSummaryOpened() override; | 81 void OnOrderSummaryOpened() override; |
| 82 void OnPaymentMethodOpened() override; | 82 void OnPaymentMethodOpened() override; |
| 83 void OnShippingSectionOpened() override; | 83 void OnShippingAddressSectionOpened() override; |
| 84 void OnShippingOptionSectionOpened() override; |
| 84 void OnCreditCardEditorOpened() override; | 85 void OnCreditCardEditorOpened() override; |
| 85 void OnShippingAddressEditorOpened() override; | 86 void OnShippingAddressEditorOpened() override; |
| 86 void OnBackNavigation() override; | 87 void OnBackNavigation() override; |
| 87 void OnContactInfoOpened() override; | 88 void OnContactInfoOpened() override; |
| 88 void OnEditorViewUpdated() override; | 89 void OnEditorViewUpdated() override; |
| 89 void OnErrorMessageShown() override; | 90 void OnErrorMessageShown() override; |
| 90 void OnSpecDoneUpdating() override; | 91 void OnSpecDoneUpdating() override; |
| 91 void OnCvcPromptShown() override; | 92 void OnCvcPromptShown() override; |
| 92 | 93 |
| 93 // views::WidgetObserver | 94 // views::WidgetObserver |
| 94 // Effective way to be warned of all dialog closures. | 95 // Effective way to be warned of all dialog closures. |
| 95 void OnWidgetDestroyed(views::Widget* widget) override; | 96 void OnWidgetDestroyed(views::Widget* widget) override; |
| 96 | 97 |
| 97 // Will call JavaScript to invoke the PaymentRequest dialog and verify that | 98 // Will call JavaScript to invoke the PaymentRequest dialog and verify that |
| 98 // it's open. | 99 // it's open. |
| 99 void InvokePaymentRequestUI(); | 100 void InvokePaymentRequestUI(); |
| 100 | 101 |
| 101 // Will expect that all strings in |expected_strings| are present in output. | 102 // Will expect that all strings in |expected_strings| are present in output. |
| 102 void ExpectBodyContains(const std::vector<base::string16>& expected_strings); | 103 void ExpectBodyContains(const std::vector<base::string16>& expected_strings); |
| 103 | 104 |
| 104 // Utility functions that will click on Dialog views and wait for the | 105 // Utility functions that will click on Dialog views and wait for the |
| 105 // associated action to happen. | 106 // associated action to happen. |
| 106 void OpenOrderSummaryScreen(); | 107 void OpenOrderSummaryScreen(); |
| 107 void OpenPaymentMethodScreen(); | 108 void OpenPaymentMethodScreen(); |
| 108 void OpenShippingSectionScreen(); | 109 void OpenShippingAddressSectionScreen(); |
| 110 void OpenShippingOptionSectionScreen(); |
| 109 void OpenCreditCardEditorScreen(); | 111 void OpenCreditCardEditorScreen(); |
| 110 void OpenShippingAddressEditorScreen(); | 112 void OpenShippingAddressEditorScreen(); |
| 111 void ClickOnBackArrow(); | 113 void ClickOnBackArrow(); |
| 112 | 114 |
| 113 content::WebContents* GetActiveWebContents(); | 115 content::WebContents* GetActiveWebContents(); |
| 114 | 116 |
| 115 // Convenience method to get a list of PaymentRequest associated with | 117 // Convenience method to get a list of PaymentRequest associated with |
| 116 // |web_contents|. | 118 // |web_contents|. |
| 117 const std::vector<PaymentRequest*> GetPaymentRequests( | 119 const std::vector<PaymentRequest*> GetPaymentRequests( |
| 118 content::WebContents* web_contents); | 120 content::WebContents* web_contents); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 net::EmbeddedTestServer* https_server() { return https_server_.get(); } | 177 net::EmbeddedTestServer* https_server() { return https_server_.get(); } |
| 176 | 178 |
| 177 PaymentRequestDialogView* dialog_view() { return delegate_->dialog_view(); } | 179 PaymentRequestDialogView* dialog_view() { return delegate_->dialog_view(); } |
| 178 | 180 |
| 179 // Various events that can be waited on by the DialogEventObserver. | 181 // Various events that can be waited on by the DialogEventObserver. |
| 180 enum DialogEvent : int { | 182 enum DialogEvent : int { |
| 181 DIALOG_OPENED, | 183 DIALOG_OPENED, |
| 182 DIALOG_CLOSED, | 184 DIALOG_CLOSED, |
| 183 ORDER_SUMMARY_OPENED, | 185 ORDER_SUMMARY_OPENED, |
| 184 PAYMENT_METHOD_OPENED, | 186 PAYMENT_METHOD_OPENED, |
| 185 SHIPPING_SECTION_OPENED, | 187 SHIPPING_ADDRESS_SECTION_OPENED, |
| 188 SHIPPING_OPTION_SECTION_OPENED, |
| 186 CREDIT_CARD_EDITOR_OPENED, | 189 CREDIT_CARD_EDITOR_OPENED, |
| 187 SHIPPING_ADDRESS_EDITOR_OPENED, | 190 SHIPPING_ADDRESS_EDITOR_OPENED, |
| 188 BACK_NAVIGATION, | 191 BACK_NAVIGATION, |
| 189 CONTACT_INFO_OPENED, | 192 CONTACT_INFO_OPENED, |
| 190 EDITOR_VIEW_UPDATED, | 193 EDITOR_VIEW_UPDATED, |
| 191 CAN_MAKE_PAYMENT_CALLED, | 194 CAN_MAKE_PAYMENT_CALLED, |
| 192 ERROR_MESSAGE_SHOWN, | 195 ERROR_MESSAGE_SHOWN, |
| 193 SPEC_DONE_UPDATING, | 196 SPEC_DONE_UPDATING, |
| 194 CVC_PROMPT_SHOWN, | 197 CVC_PROMPT_SHOWN, |
| 195 }; | 198 }; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Weak, owned by the PaymentRequest object. | 242 // Weak, owned by the PaymentRequest object. |
| 240 TestChromePaymentRequestDelegate* delegate_; | 243 TestChromePaymentRequestDelegate* delegate_; |
| 241 bool incognito_for_testing_; | 244 bool incognito_for_testing_; |
| 242 | 245 |
| 243 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); | 246 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); |
| 244 }; | 247 }; |
| 245 | 248 |
| 246 } // namespace payments | 249 } // namespace payments |
| 247 | 250 |
| 248 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ | 251 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ |
| OLD | NEW |