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 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION_BUTTON)); | 289 DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION_BUTTON)); |
290 } | 290 } |
291 | 291 |
292 EXPECT_TRUE(view); | 292 EXPECT_TRUE(view); |
293 ClickOnDialogViewAndWait(view); | 293 ClickOnDialogViewAndWait(view); |
294 } | 294 } |
295 | 295 |
296 void PaymentRequestBrowserTestBase::OpenCreditCardEditorScreen() { | 296 void PaymentRequestBrowserTestBase::OpenCreditCardEditorScreen() { |
297 ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED); | 297 ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED); |
298 | 298 |
299 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON); | 299 views::View* view = delegate_->dialog_view()->GetViewByID( |
| 300 static_cast<int>(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON)); |
| 301 if (!view) { |
| 302 view = delegate_->dialog_view()->GetViewByID(static_cast<int>( |
| 303 DialogViewID::PAYMENT_SHEET_PAYMENT_METHOD_SECTION_BUTTON)); |
| 304 } |
| 305 |
| 306 EXPECT_TRUE(view); |
| 307 ClickOnDialogViewAndWait(view); |
300 } | 308 } |
301 | 309 |
302 void PaymentRequestBrowserTestBase::OpenShippingAddressEditorScreen() { | 310 void PaymentRequestBrowserTestBase::OpenShippingAddressEditorScreen() { |
303 ResetEventObserver(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); | 311 ResetEventObserver(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); |
304 | 312 |
305 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_SHIPPING_BUTTON); | 313 views::View* view = delegate_->dialog_view()->GetViewByID( |
| 314 static_cast<int>(DialogViewID::PAYMENT_METHOD_ADD_SHIPPING_BUTTON)); |
| 315 if (!view) { |
| 316 view = delegate_->dialog_view()->GetViewByID(static_cast<int>( |
| 317 DialogViewID::PAYMENT_SHEET_SHIPPING_ADDRESS_SECTION_BUTTON)); |
| 318 } |
| 319 |
| 320 EXPECT_TRUE(view); |
| 321 ClickOnDialogViewAndWait(view); |
306 } | 322 } |
307 | 323 |
308 void PaymentRequestBrowserTestBase::OpenContactInfoEditorScreen() { | 324 void PaymentRequestBrowserTestBase::OpenContactInfoEditorScreen() { |
309 ResetEventObserver(DialogEvent::CONTACT_INFO_EDITOR_OPENED); | 325 ResetEventObserver(DialogEvent::CONTACT_INFO_EDITOR_OPENED); |
310 | 326 |
311 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_CONTACT_BUTTON); | 327 views::View* view = delegate_->dialog_view()->GetViewByID( |
| 328 static_cast<int>(DialogViewID::PAYMENT_METHOD_ADD_CONTACT_BUTTON)); |
| 329 if (!view) { |
| 330 view = delegate_->dialog_view()->GetViewByID(static_cast<int>( |
| 331 DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION_BUTTON)); |
| 332 } |
| 333 |
| 334 EXPECT_TRUE(view); |
| 335 ClickOnDialogViewAndWait(view); |
312 } | 336 } |
313 | 337 |
314 void PaymentRequestBrowserTestBase::ClickOnBackArrow() { | 338 void PaymentRequestBrowserTestBase::ClickOnBackArrow() { |
315 ResetEventObserver(DialogEvent::BACK_NAVIGATION); | 339 ResetEventObserver(DialogEvent::BACK_NAVIGATION); |
316 | 340 |
317 ClickOnDialogViewAndWait(DialogViewID::BACK_BUTTON); | 341 ClickOnDialogViewAndWait(DialogViewID::BACK_BUTTON); |
318 } | 342 } |
319 | 343 |
320 content::WebContents* PaymentRequestBrowserTestBase::GetActiveWebContents() { | 344 content::WebContents* PaymentRequestBrowserTestBase::GetActiveWebContents() { |
321 return browser()->tab_strip_model()->GetActiveWebContents(); | 345 return browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 std::list<DialogEvent> event_sequence) { | 645 std::list<DialogEvent> event_sequence) { |
622 event_observer_ = | 646 event_observer_ = |
623 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); | 647 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); |
624 } | 648 } |
625 | 649 |
626 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { | 650 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { |
627 event_observer_->Wait(); | 651 event_observer_->Wait(); |
628 } | 652 } |
629 | 653 |
630 } // namespace payments | 654 } // namespace payments |
OLD | NEW |