| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/ui/views/payments/view_stack.h" | 25 #include "chrome/browser/ui/views/payments/view_stack.h" |
| 26 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
| 27 #include "components/autofill/core/browser/autofill_profile.h" | 27 #include "components/autofill/core/browser/autofill_profile.h" |
| 28 #include "components/autofill/core/browser/credit_card.h" | 28 #include "components/autofill/core/browser/credit_card.h" |
| 29 #include "components/autofill/core/browser/personal_data_manager.h" | 29 #include "components/autofill/core/browser/personal_data_manager.h" |
| 30 #include "components/payments/content/payment_request.h" | 30 #include "components/payments/content/payment_request.h" |
| 31 #include "components/payments/content/payment_request_web_contents_manager.h" | 31 #include "components/payments/content/payment_request_web_contents_manager.h" |
| 32 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 32 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 33 #include "content/public/browser/render_frame_host.h" | 33 #include "content/public/browser/render_frame_host.h" |
| 34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/common/content_features.h" | |
| 36 #include "content/public/common/content_switches.h" | |
| 37 #include "content/public/test/browser_test_utils.h" | 35 #include "content/public/test/browser_test_utils.h" |
| 38 #include "services/service_manager/public/cpp/binder_registry.h" | 36 #include "services/service_manager/public/cpp/binder_registry.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| 40 #include "ui/base/test/ui_controls.h" | 38 #include "ui/base/test/ui_controls.h" |
| 41 #include "ui/events/base_event_utils.h" | 39 #include "ui/events/base_event_utils.h" |
| 42 #include "ui/events/event.h" | 40 #include "ui/events/event.h" |
| 43 #include "ui/gfx/animation/test_animation_delegate.h" | 41 #include "ui/gfx/animation/test_animation_delegate.h" |
| 44 #include "ui/gfx/geometry/point.h" | 42 #include "ui/gfx/geometry/point.h" |
| 45 #include "ui/views/controls/button/button.h" | 43 #include "ui/views/controls/button/button.h" |
| 46 #include "ui/views/controls/label.h" | 44 #include "ui/views/controls/label.h" |
| 47 #include "ui/views/controls/styled_label.h" | 45 #include "ui/views/controls/styled_label.h" |
| 48 | 46 |
| 49 namespace payments { | 47 namespace payments { |
| 50 | 48 |
| 51 PersonalDataLoadedObserverMock::PersonalDataLoadedObserverMock() {} | 49 PersonalDataLoadedObserverMock::PersonalDataLoadedObserverMock() {} |
| 52 PersonalDataLoadedObserverMock::~PersonalDataLoadedObserverMock() {} | 50 PersonalDataLoadedObserverMock::~PersonalDataLoadedObserverMock() {} |
| 53 | 51 |
| 54 PaymentRequestBrowserTestBase::PaymentRequestBrowserTestBase( | 52 PaymentRequestBrowserTestBase::PaymentRequestBrowserTestBase( |
| 55 const std::string& test_file_path) | 53 const std::string& test_file_path) |
| 56 : test_file_path_(test_file_path), | 54 : test_file_path_(test_file_path), |
| 57 delegate_(nullptr), | 55 delegate_(nullptr), |
| 58 is_incognito_(false), | 56 is_incognito_(false), |
| 59 is_valid_ssl_(true) {} | 57 is_valid_ssl_(true) {} |
| 60 PaymentRequestBrowserTestBase::~PaymentRequestBrowserTestBase() {} | 58 PaymentRequestBrowserTestBase::~PaymentRequestBrowserTestBase() {} |
| 61 | 59 |
| 62 void PaymentRequestBrowserTestBase::SetUpCommandLine( | |
| 63 base::CommandLine* command_line) { | |
| 64 InProcessBrowserTest::SetUpCommandLine(command_line); | |
| 65 command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); | |
| 66 command_line->AppendSwitchASCII(switches::kEnableFeatures, | |
| 67 features::kWebPayments.name); | |
| 68 } | |
| 69 | |
| 70 void PaymentRequestBrowserTestBase::SetUpOnMainThread() { | 60 void PaymentRequestBrowserTestBase::SetUpOnMainThread() { |
| 71 https_server_ = base::MakeUnique<net::EmbeddedTestServer>( | 61 https_server_ = base::MakeUnique<net::EmbeddedTestServer>( |
| 72 net::EmbeddedTestServer::TYPE_HTTPS); | 62 net::EmbeddedTestServer::TYPE_HTTPS); |
| 73 ASSERT_TRUE(https_server_->InitializeAndListen()); | 63 ASSERT_TRUE(https_server_->InitializeAndListen()); |
| 74 https_server_->ServeFilesFromSourceDirectory("chrome/test/data/payments"); | 64 https_server_->ServeFilesFromSourceDirectory("chrome/test/data/payments"); |
| 75 https_server_->StartAcceptingConnections(); | 65 https_server_->StartAcceptingConnections(); |
| 76 | 66 |
| 77 GURL url = https_server()->GetURL(test_file_path_); | 67 GURL url = https_server()->GetURL(test_file_path_); |
| 78 ui_test_utils::NavigateToURL(browser(), url); | 68 ui_test_utils::NavigateToURL(browser(), url); |
| 79 | 69 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 std::list<DialogEvent> event_sequence) { | 611 std::list<DialogEvent> event_sequence) { |
| 622 event_observer_ = | 612 event_observer_ = |
| 623 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); | 613 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); |
| 624 } | 614 } |
| 625 | 615 |
| 626 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { | 616 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { |
| 627 event_observer_->Wait(); | 617 event_observer_->Wait(); |
| 628 } | 618 } |
| 629 | 619 |
| 630 } // namespace payments | 620 } // namespace payments |
| OLD | NEW |