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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 explicit PaymentRequestBrowserTestBase(const std::string& test_file_path); | 68 explicit PaymentRequestBrowserTestBase(const std::string& test_file_path); |
69 ~PaymentRequestBrowserTestBase() override; | 69 ~PaymentRequestBrowserTestBase() override; |
70 | 70 |
71 void SetUpCommandLine(base::CommandLine* command_line) override; | 71 void SetUpCommandLine(base::CommandLine* command_line) override; |
72 void SetUpOnMainThread() override; | 72 void SetUpOnMainThread() override; |
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 void OnNotSupportedError() override; |
78 | 79 |
79 // PaymentRequestDialogView::ObserverForTest: | 80 // PaymentRequestDialogView::ObserverForTest: |
80 void OnDialogOpened() override; | 81 void OnDialogOpened() override; |
81 void OnOrderSummaryOpened() override; | 82 void OnOrderSummaryOpened() override; |
82 void OnPaymentMethodOpened() override; | 83 void OnPaymentMethodOpened() override; |
83 void OnShippingAddressSectionOpened() override; | 84 void OnShippingAddressSectionOpened() override; |
84 void OnShippingOptionSectionOpened() override; | 85 void OnShippingOptionSectionOpened() override; |
85 void OnCreditCardEditorOpened() override; | 86 void OnCreditCardEditorOpened() override; |
86 void OnShippingAddressEditorOpened() override; | 87 void OnShippingAddressEditorOpened() override; |
87 void OnBackNavigation() override; | 88 void OnBackNavigation() override; |
88 void OnBackToPaymentSheetNavigation() override; | 89 void OnBackToPaymentSheetNavigation() override; |
89 void OnContactInfoOpened() override; | 90 void OnContactInfoOpened() override; |
90 void OnEditorViewUpdated() override; | 91 void OnEditorViewUpdated() override; |
91 void OnErrorMessageShown() override; | 92 void OnErrorMessageShown() override; |
92 void OnSpecDoneUpdating() override; | 93 void OnSpecDoneUpdating() override; |
93 void OnCvcPromptShown() override; | 94 void OnCvcPromptShown() override; |
94 | 95 |
95 // views::WidgetObserver | 96 // views::WidgetObserver |
96 // Effective way to be warned of all dialog closures. | 97 // Effective way to be warned of all dialog closures. |
97 void OnWidgetDestroyed(views::Widget* widget) override; | 98 void OnWidgetDestroyed(views::Widget* widget) override; |
98 | 99 |
99 // Will call JavaScript to invoke the PaymentRequest dialog and verify that | 100 // Will call JavaScript to invoke the PaymentRequest dialog and verify that |
100 // it's open. | 101 // it's open. |
101 void InvokePaymentRequestUI(); | 102 void InvokePaymentRequestUI(); |
102 | 103 |
103 // Will expect that all strings in |expected_strings| are present in output. | 104 // Will expect that all strings in |expected_strings| are present in output. |
| 105 void ExpectBodyContains(const std::vector<std::string>& expected_strings); |
104 void ExpectBodyContains(const std::vector<base::string16>& expected_strings); | 106 void ExpectBodyContains(const std::vector<base::string16>& expected_strings); |
105 | 107 |
106 // Utility functions that will click on Dialog views and wait for the | 108 // Utility functions that will click on Dialog views and wait for the |
107 // associated action to happen. | 109 // associated action to happen. |
108 void OpenOrderSummaryScreen(); | 110 void OpenOrderSummaryScreen(); |
109 void OpenPaymentMethodScreen(); | 111 void OpenPaymentMethodScreen(); |
110 void OpenShippingAddressSectionScreen(); | 112 void OpenShippingAddressSectionScreen(); |
111 void OpenShippingOptionSectionScreen(); | 113 void OpenShippingOptionSectionScreen(); |
112 void OpenCreditCardEditorScreen(); | 114 void OpenCreditCardEditorScreen(); |
113 void OpenShippingAddressEditorScreen(); | 115 void OpenShippingAddressEditorScreen(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 CREDIT_CARD_EDITOR_OPENED, | 200 CREDIT_CARD_EDITOR_OPENED, |
199 SHIPPING_ADDRESS_EDITOR_OPENED, | 201 SHIPPING_ADDRESS_EDITOR_OPENED, |
200 BACK_NAVIGATION, | 202 BACK_NAVIGATION, |
201 BACK_TO_PAYMENT_SHEET_NAVIGATION, | 203 BACK_TO_PAYMENT_SHEET_NAVIGATION, |
202 CONTACT_INFO_OPENED, | 204 CONTACT_INFO_OPENED, |
203 EDITOR_VIEW_UPDATED, | 205 EDITOR_VIEW_UPDATED, |
204 CAN_MAKE_PAYMENT_CALLED, | 206 CAN_MAKE_PAYMENT_CALLED, |
205 ERROR_MESSAGE_SHOWN, | 207 ERROR_MESSAGE_SHOWN, |
206 SPEC_DONE_UPDATING, | 208 SPEC_DONE_UPDATING, |
207 CVC_PROMPT_SHOWN, | 209 CVC_PROMPT_SHOWN, |
| 210 NOT_SUPPORTED_ERROR, |
208 }; | 211 }; |
209 | 212 |
210 // DialogEventObserver is used to wait on specific events that may have | 213 // DialogEventObserver is used to wait on specific events that may have |
211 // occured before the call to Wait(), or after, in which case a RunLoop is | 214 // occured before the call to Wait(), or after, in which case a RunLoop is |
212 // used. | 215 // used. |
213 // | 216 // |
214 // Usage: | 217 // Usage: |
215 // observer_ = | 218 // observer_ = |
216 // base::MakeUnique<DialogEventObserver>(std:list<DialogEvent>(...)); | 219 // base::MakeUnique<DialogEventObserver>(std:list<DialogEvent>(...)); |
217 // | 220 // |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // Weak, owned by the PaymentRequest object. | 255 // Weak, owned by the PaymentRequest object. |
253 TestChromePaymentRequestDelegate* delegate_; | 256 TestChromePaymentRequestDelegate* delegate_; |
254 bool incognito_for_testing_; | 257 bool incognito_for_testing_; |
255 | 258 |
256 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); | 259 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); |
257 }; | 260 }; |
258 | 261 |
259 } // namespace payments | 262 } // namespace payments |
260 | 263 |
261 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ | 264 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ |
OLD | NEW |