| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 16 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 17 #include "chrome/browser/ui/views/payments/validating_combobox.h" | 17 #include "chrome/browser/ui/views/payments/validating_combobox.h" |
| 18 #include "chrome/browser/ui/views/payments/validating_textfield.h" | 18 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
| 19 #include "chrome/browser/ui/views/payments/view_stack.h" | 19 #include "chrome/browser/ui/views/payments/view_stack.h" |
| 20 #include "chrome/test/base/interactive_test_utils.h" | 20 #include "chrome/test/base/interactive_test_utils.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "components/payments/payment_request.h" | 22 #include "components/payments/payment_request.h" |
| 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_features.h" |
| 27 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 29 #include "content/public/test/browser_test_utils.h" |
| 29 #include "services/service_manager/public/cpp/interface_registry.h" | 30 #include "services/service_manager/public/cpp/interface_registry.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 31 #include "ui/base/test/ui_controls.h" | 32 #include "ui/base/test/ui_controls.h" |
| 32 #include "ui/gfx/animation/test_animation_delegate.h" | 33 #include "ui/gfx/animation/test_animation_delegate.h" |
| 33 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
| 34 #include "ui/views/controls/styled_label.h" | 35 #include "ui/views/controls/styled_label.h" |
| 35 | 36 |
| 36 namespace payments { | 37 namespace payments { |
| 37 | 38 |
| 38 PaymentRequestInteractiveTestBase::PaymentRequestInteractiveTestBase( | 39 PaymentRequestInteractiveTestBase::PaymentRequestInteractiveTestBase( |
| 39 const std::string& test_file_path) | 40 const std::string& test_file_path) |
| 40 : test_file_path_(test_file_path), | 41 : test_file_path_(test_file_path), |
| 41 delegate_(nullptr) {} | 42 delegate_(nullptr) {} |
| 42 PaymentRequestInteractiveTestBase::~PaymentRequestInteractiveTestBase() {} | 43 PaymentRequestInteractiveTestBase::~PaymentRequestInteractiveTestBase() {} |
| 43 | 44 |
| 44 void PaymentRequestInteractiveTestBase::SetUpCommandLine( | 45 void PaymentRequestInteractiveTestBase::SetUpCommandLine( |
| 45 base::CommandLine* command_line) { | 46 base::CommandLine* command_line) { |
| 46 InProcessBrowserTest::SetUpCommandLine(command_line); | 47 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 47 command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); | 48 command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); |
| 49 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
| 50 features::kWebPayments.name); |
| 48 } | 51 } |
| 49 | 52 |
| 50 void PaymentRequestInteractiveTestBase::SetUpOnMainThread() { | 53 void PaymentRequestInteractiveTestBase::SetUpOnMainThread() { |
| 51 https_server_ = base::MakeUnique<net::EmbeddedTestServer>( | 54 https_server_ = base::MakeUnique<net::EmbeddedTestServer>( |
| 52 net::EmbeddedTestServer::TYPE_HTTPS); | 55 net::EmbeddedTestServer::TYPE_HTTPS); |
| 53 ASSERT_TRUE(https_server_->InitializeAndListen()); | 56 ASSERT_TRUE(https_server_->InitializeAndListen()); |
| 54 https_server_->ServeFilesFromSourceDirectory("chrome/test/data/payments"); | 57 https_server_->ServeFilesFromSourceDirectory("chrome/test/data/payments"); |
| 55 https_server_->StartAcceptingConnections(); | 58 https_server_->StartAcceptingConnections(); |
| 56 | 59 |
| 57 GURL url = https_server()->GetURL(test_file_path_); | 60 GURL url = https_server()->GetURL(test_file_path_); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 282 |
| 280 void PaymentRequestInteractiveTestBase::ResetEventObserver(DialogEvent event) { | 283 void PaymentRequestInteractiveTestBase::ResetEventObserver(DialogEvent event) { |
| 281 event_observer_ = base::MakeUnique<DialogEventObserver>(event); | 284 event_observer_ = base::MakeUnique<DialogEventObserver>(event); |
| 282 } | 285 } |
| 283 | 286 |
| 284 void PaymentRequestInteractiveTestBase::WaitForObservedEvent() { | 287 void PaymentRequestInteractiveTestBase::WaitForObservedEvent() { |
| 285 event_observer_->Wait(); | 288 event_observer_->Wait(); |
| 286 } | 289 } |
| 287 | 290 |
| 288 } // namespace payments | 291 } // namespace payments |
| OLD | NEW |