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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 public views::WidgetObserver { | 64 public views::WidgetObserver { |
65 protected: | 65 protected: |
66 // Test will open a browser window to |test_file_path| (relative to | 66 // Test will open a browser window to |test_file_path| (relative to |
67 // chrome/test/data/payments). | 67 // chrome/test/data/payments). |
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 SetIncognito(); |
| 75 void SetInvalidSsl(); |
75 | 76 |
76 // PaymentRequest::ObserverForTest: | 77 // PaymentRequest::ObserverForTest: |
77 void OnCanMakePaymentCalled() override; | 78 void OnCanMakePaymentCalled() override; |
| 79 void OnNotSupportedError() override; |
78 | 80 |
79 // PaymentRequestDialogView::ObserverForTest: | 81 // PaymentRequestDialogView::ObserverForTest: |
80 void OnDialogOpened() override; | 82 void OnDialogOpened() override; |
81 void OnOrderSummaryOpened() override; | 83 void OnOrderSummaryOpened() override; |
82 void OnPaymentMethodOpened() override; | 84 void OnPaymentMethodOpened() override; |
83 void OnShippingAddressSectionOpened() override; | 85 void OnShippingAddressSectionOpened() override; |
84 void OnShippingOptionSectionOpened() override; | 86 void OnShippingOptionSectionOpened() override; |
85 void OnCreditCardEditorOpened() override; | 87 void OnCreditCardEditorOpened() override; |
86 void OnShippingAddressEditorOpened() override; | 88 void OnShippingAddressEditorOpened() override; |
87 void OnBackNavigation() override; | 89 void OnBackNavigation() override; |
88 void OnBackToPaymentSheetNavigation() override; | 90 void OnBackToPaymentSheetNavigation() override; |
89 void OnContactInfoOpened() override; | 91 void OnContactInfoOpened() override; |
90 void OnEditorViewUpdated() override; | 92 void OnEditorViewUpdated() override; |
91 void OnErrorMessageShown() override; | 93 void OnErrorMessageShown() override; |
92 void OnSpecDoneUpdating() override; | 94 void OnSpecDoneUpdating() override; |
93 void OnCvcPromptShown() override; | 95 void OnCvcPromptShown() override; |
94 | 96 |
95 // views::WidgetObserver | 97 // views::WidgetObserver |
96 // Effective way to be warned of all dialog closures. | 98 // Effective way to be warned of all dialog closures. |
97 void OnWidgetDestroyed(views::Widget* widget) override; | 99 void OnWidgetDestroyed(views::Widget* widget) override; |
98 | 100 |
99 // Will call JavaScript to invoke the PaymentRequest dialog and verify that | 101 // Will call JavaScript to invoke the PaymentRequest dialog and verify that |
100 // it's open. | 102 // it's open. |
101 void InvokePaymentRequestUI(); | 103 void InvokePaymentRequestUI(); |
102 | 104 |
103 // Will expect that all strings in |expected_strings| are present in output. | 105 // Will expect that all strings in |expected_strings| are present in output. |
| 106 void ExpectBodyContains(const std::vector<std::string>& expected_strings); |
104 void ExpectBodyContains(const std::vector<base::string16>& expected_strings); | 107 void ExpectBodyContains(const std::vector<base::string16>& expected_strings); |
105 | 108 |
106 // Utility functions that will click on Dialog views and wait for the | 109 // Utility functions that will click on Dialog views and wait for the |
107 // associated action to happen. | 110 // associated action to happen. |
108 void OpenOrderSummaryScreen(); | 111 void OpenOrderSummaryScreen(); |
109 void OpenPaymentMethodScreen(); | 112 void OpenPaymentMethodScreen(); |
110 void OpenShippingAddressSectionScreen(); | 113 void OpenShippingAddressSectionScreen(); |
111 void OpenShippingOptionSectionScreen(); | 114 void OpenShippingOptionSectionScreen(); |
112 void OpenCreditCardEditorScreen(); | 115 void OpenCreditCardEditorScreen(); |
113 void OpenShippingAddressEditorScreen(); | 116 void OpenShippingAddressEditorScreen(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 CREDIT_CARD_EDITOR_OPENED, | 201 CREDIT_CARD_EDITOR_OPENED, |
199 SHIPPING_ADDRESS_EDITOR_OPENED, | 202 SHIPPING_ADDRESS_EDITOR_OPENED, |
200 BACK_NAVIGATION, | 203 BACK_NAVIGATION, |
201 BACK_TO_PAYMENT_SHEET_NAVIGATION, | 204 BACK_TO_PAYMENT_SHEET_NAVIGATION, |
202 CONTACT_INFO_OPENED, | 205 CONTACT_INFO_OPENED, |
203 EDITOR_VIEW_UPDATED, | 206 EDITOR_VIEW_UPDATED, |
204 CAN_MAKE_PAYMENT_CALLED, | 207 CAN_MAKE_PAYMENT_CALLED, |
205 ERROR_MESSAGE_SHOWN, | 208 ERROR_MESSAGE_SHOWN, |
206 SPEC_DONE_UPDATING, | 209 SPEC_DONE_UPDATING, |
207 CVC_PROMPT_SHOWN, | 210 CVC_PROMPT_SHOWN, |
| 211 NOT_SUPPORTED_ERROR, |
208 }; | 212 }; |
209 | 213 |
210 // DialogEventObserver is used to wait on specific events that may have | 214 // 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 | 215 // occured before the call to Wait(), or after, in which case a RunLoop is |
212 // used. | 216 // used. |
213 // | 217 // |
214 // Usage: | 218 // Usage: |
215 // observer_ = | 219 // observer_ = |
216 // base::MakeUnique<DialogEventObserver>(std:list<DialogEvent>(...)); | 220 // base::MakeUnique<DialogEventObserver>(std:list<DialogEvent>(...)); |
217 // | 221 // |
(...skipping 26 matching lines...) Expand all Loading... |
244 void ResetEventObserverForSequence(std::list<DialogEvent> event_sequence); | 248 void ResetEventObserverForSequence(std::list<DialogEvent> event_sequence); |
245 // Wait for the event(s) passed to ResetEventObserver*() to occur. | 249 // Wait for the event(s) passed to ResetEventObserver*() to occur. |
246 void WaitForObservedEvent(); | 250 void WaitForObservedEvent(); |
247 | 251 |
248 private: | 252 private: |
249 std::unique_ptr<DialogEventObserver> event_observer_; | 253 std::unique_ptr<DialogEventObserver> event_observer_; |
250 const std::string test_file_path_; | 254 const std::string test_file_path_; |
251 std::unique_ptr<net::EmbeddedTestServer> https_server_; | 255 std::unique_ptr<net::EmbeddedTestServer> https_server_; |
252 // Weak, owned by the PaymentRequest object. | 256 // Weak, owned by the PaymentRequest object. |
253 TestChromePaymentRequestDelegate* delegate_; | 257 TestChromePaymentRequestDelegate* delegate_; |
254 bool incognito_for_testing_; | 258 bool is_incognito_; |
| 259 bool is_valid_ssl_; |
255 | 260 |
256 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); | 261 DISALLOW_COPY_AND_ASSIGN(PaymentRequestBrowserTestBase); |
257 }; | 262 }; |
258 | 263 |
259 } // namespace payments | 264 } // namespace payments |
260 | 265 |
261 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ | 266 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_BROWSERTEST_BASE_H_ |
OLD | NEW |