| 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_interactive_uitest_ba
se.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_ba
se.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "components/payments/payment_request_web_contents_manager.h" | 23 #include "components/payments/payment_request_web_contents_manager.h" |
| 24 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 24 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 25 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
| 29 #include "services/service_manager/public/cpp/interface_registry.h" | 29 #include "services/service_manager/public/cpp/interface_registry.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 31 #include "ui/base/test/ui_controls.h" | 31 #include "ui/base/test/ui_controls.h" |
| 32 #include "ui/gfx/animation/test_animation_delegate.h" | 32 #include "ui/gfx/animation/test_animation_delegate.h" |
| 33 #include "ui/views/controls/label.h" |
| 33 #include "ui/views/controls/styled_label.h" | 34 #include "ui/views/controls/styled_label.h" |
| 34 | 35 |
| 35 namespace payments { | 36 namespace payments { |
| 36 | 37 |
| 37 PaymentRequestInteractiveTestBase::PaymentRequestInteractiveTestBase( | 38 PaymentRequestInteractiveTestBase::PaymentRequestInteractiveTestBase( |
| 38 const std::string& test_file_path) | 39 const std::string& test_file_path) |
| 39 : test_file_path_(test_file_path), | 40 : test_file_path_(test_file_path), |
| 40 delegate_(nullptr) {} | 41 delegate_(nullptr) {} |
| 41 PaymentRequestInteractiveTestBase::~PaymentRequestInteractiveTestBase() {} | 42 PaymentRequestInteractiveTestBase::~PaymentRequestInteractiveTestBase() {} |
| 42 | 43 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 237 } |
| 237 } | 238 } |
| 238 | 239 |
| 239 const base::string16& PaymentRequestInteractiveTestBase::GetStyledLabelText( | 240 const base::string16& PaymentRequestInteractiveTestBase::GetStyledLabelText( |
| 240 DialogViewID view_id) { | 241 DialogViewID view_id) { |
| 241 views::View* view = dialog_view()->GetViewByID(static_cast<int>(view_id)); | 242 views::View* view = dialog_view()->GetViewByID(static_cast<int>(view_id)); |
| 242 DCHECK(view); | 243 DCHECK(view); |
| 243 return static_cast<views::StyledLabel*>(view)->text(); | 244 return static_cast<views::StyledLabel*>(view)->text(); |
| 244 } | 245 } |
| 245 | 246 |
| 247 const base::string16& PaymentRequestInteractiveTestBase::GetErrorLabelForType( |
| 248 autofill::ServerFieldType type) { |
| 249 views::View* view = dialog_view()->GetViewByID( |
| 250 static_cast<int>(DialogViewID::ERROR_LABEL_OFFSET) + type); |
| 251 DCHECK(view); |
| 252 return static_cast<views::Label*>(view)->text(); |
| 253 } |
| 254 |
| 246 PaymentRequestInteractiveTestBase::DialogEventObserver::DialogEventObserver( | 255 PaymentRequestInteractiveTestBase::DialogEventObserver::DialogEventObserver( |
| 247 PaymentRequestInteractiveTestBase::DialogEvent event) | 256 PaymentRequestInteractiveTestBase::DialogEvent event) |
| 248 : event_(event), seen_(false) {} | 257 : event_(event), seen_(false) {} |
| 249 PaymentRequestInteractiveTestBase::DialogEventObserver::~DialogEventObserver() { | 258 PaymentRequestInteractiveTestBase::DialogEventObserver::~DialogEventObserver() { |
| 250 } | 259 } |
| 251 | 260 |
| 252 void PaymentRequestInteractiveTestBase::DialogEventObserver::Wait() { | 261 void PaymentRequestInteractiveTestBase::DialogEventObserver::Wait() { |
| 253 if (seen_) | 262 if (seen_) |
| 254 return; | 263 return; |
| 255 | 264 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 270 | 279 |
| 271 void PaymentRequestInteractiveTestBase::ResetEventObserver(DialogEvent event) { | 280 void PaymentRequestInteractiveTestBase::ResetEventObserver(DialogEvent event) { |
| 272 event_observer_ = base::MakeUnique<DialogEventObserver>(event); | 281 event_observer_ = base::MakeUnique<DialogEventObserver>(event); |
| 273 } | 282 } |
| 274 | 283 |
| 275 void PaymentRequestInteractiveTestBase::WaitForObservedEvent() { | 284 void PaymentRequestInteractiveTestBase::WaitForObservedEvent() { |
| 276 event_observer_->Wait(); | 285 event_observer_->Wait(); |
| 277 } | 286 } |
| 278 | 287 |
| 279 } // namespace payments | 288 } // namespace payments |
| OLD | NEW |