| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void PaymentRequestBrowserTestBase::OnCreditCardEditorOpened() { | 135 void PaymentRequestBrowserTestBase::OnCreditCardEditorOpened() { |
| 136 if (event_observer_) | 136 if (event_observer_) |
| 137 event_observer_->Observe(DialogEvent::CREDIT_CARD_EDITOR_OPENED); | 137 event_observer_->Observe(DialogEvent::CREDIT_CARD_EDITOR_OPENED); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void PaymentRequestBrowserTestBase::OnShippingAddressEditorOpened() { | 140 void PaymentRequestBrowserTestBase::OnShippingAddressEditorOpened() { |
| 141 if (event_observer_) | 141 if (event_observer_) |
| 142 event_observer_->Observe(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); | 142 event_observer_->Observe(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void PaymentRequestBrowserTestBase::OnContactInfoEditorOpened() { |
| 146 if (event_observer_) |
| 147 event_observer_->Observe(DialogEvent::CONTACT_INFO_EDITOR_OPENED); |
| 148 } |
| 149 |
| 145 void PaymentRequestBrowserTestBase::OnBackNavigation() { | 150 void PaymentRequestBrowserTestBase::OnBackNavigation() { |
| 146 if (event_observer_) | 151 if (event_observer_) |
| 147 event_observer_->Observe(DialogEvent::BACK_NAVIGATION); | 152 event_observer_->Observe(DialogEvent::BACK_NAVIGATION); |
| 148 } | 153 } |
| 149 | 154 |
| 150 void PaymentRequestBrowserTestBase::OnBackToPaymentSheetNavigation() { | 155 void PaymentRequestBrowserTestBase::OnBackToPaymentSheetNavigation() { |
| 151 if (event_observer_) | 156 if (event_observer_) |
| 152 event_observer_->Observe(DialogEvent::BACK_TO_PAYMENT_SHEET_NAVIGATION); | 157 event_observer_->Observe(DialogEvent::BACK_TO_PAYMENT_SHEET_NAVIGATION); |
| 153 } | 158 } |
| 154 | 159 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION)); | 271 static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION)); |
| 267 if (!view) { | 272 if (!view) { |
| 268 view = delegate_->dialog_view()->GetViewByID(static_cast<int>( | 273 view = delegate_->dialog_view()->GetViewByID(static_cast<int>( |
| 269 DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON)); | 274 DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON)); |
| 270 } | 275 } |
| 271 | 276 |
| 272 EXPECT_TRUE(view); | 277 EXPECT_TRUE(view); |
| 273 | 278 |
| 274 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION); | 279 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION); |
| 275 } | 280 } |
| 281 |
| 282 void PaymentRequestBrowserTestBase::OpenContactInfoScreen() { |
| 283 ResetEventObserver(DialogEvent::CONTACT_INFO_OPENED); |
| 284 |
| 285 views::View* view = delegate_->dialog_view()->GetViewByID( |
| 286 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); |
| 287 if (!view) { |
| 288 view = delegate_->dialog_view()->GetViewByID(static_cast<int>( |
| 289 DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION_BUTTON)); |
| 290 } |
| 291 |
| 292 EXPECT_TRUE(view); |
| 293 ClickOnDialogViewAndWait(view); |
| 294 } |
| 295 |
| 276 void PaymentRequestBrowserTestBase::OpenCreditCardEditorScreen() { | 296 void PaymentRequestBrowserTestBase::OpenCreditCardEditorScreen() { |
| 277 ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED); | 297 ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED); |
| 278 | 298 |
| 279 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON); | 299 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON); |
| 280 } | 300 } |
| 281 | 301 |
| 282 void PaymentRequestBrowserTestBase::OpenShippingAddressEditorScreen() { | 302 void PaymentRequestBrowserTestBase::OpenShippingAddressEditorScreen() { |
| 283 ResetEventObserver(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); | 303 ResetEventObserver(DialogEvent::SHIPPING_ADDRESS_EDITOR_OPENED); |
| 284 | 304 |
| 285 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_SHIPPING_BUTTON); | 305 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_SHIPPING_BUTTON); |
| 286 } | 306 } |
| 287 | 307 |
| 308 void PaymentRequestBrowserTestBase::OpenContactInfoEditorScreen() { |
| 309 ResetEventObserver(DialogEvent::CONTACT_INFO_EDITOR_OPENED); |
| 310 |
| 311 ClickOnDialogViewAndWait(DialogViewID::PAYMENT_METHOD_ADD_CONTACT_BUTTON); |
| 312 } |
| 313 |
| 288 void PaymentRequestBrowserTestBase::ClickOnBackArrow() { | 314 void PaymentRequestBrowserTestBase::ClickOnBackArrow() { |
| 289 ResetEventObserver(DialogEvent::BACK_NAVIGATION); | 315 ResetEventObserver(DialogEvent::BACK_NAVIGATION); |
| 290 | 316 |
| 291 ClickOnDialogViewAndWait(DialogViewID::BACK_BUTTON); | 317 ClickOnDialogViewAndWait(DialogViewID::BACK_BUTTON); |
| 292 } | 318 } |
| 293 | 319 |
| 294 content::WebContents* PaymentRequestBrowserTestBase::GetActiveWebContents() { | 320 content::WebContents* PaymentRequestBrowserTestBase::GetActiveWebContents() { |
| 295 return browser()->tab_strip_model()->GetActiveWebContents(); | 321 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 296 } | 322 } |
| 297 | 323 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 std::list<DialogEvent> event_sequence) { | 617 std::list<DialogEvent> event_sequence) { |
| 592 event_observer_ = | 618 event_observer_ = |
| 593 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); | 619 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); |
| 594 } | 620 } |
| 595 | 621 |
| 596 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { | 622 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { |
| 597 event_observer_->Wait(); | 623 event_observer_->Wait(); |
| 598 } | 624 } |
| 599 | 625 |
| 600 } // namespace payments | 626 } // namespace payments |
| OLD | NEW |