| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/web_view/test_runner/test_runner_application_delegate.h" | 5 #include "components/web_view/test_runner/test_runner_application_delegate.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/location.h" | 15 #include "base/location.h" |
| 15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 44 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); | 45 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { | 48 void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { |
| 48 if (!web_view_) { | 49 if (!web_view_) { |
| 49 web_view_.reset(new WebView(this)); | 50 web_view_.reset(new WebView(this)); |
| 50 web_view_->Init(app_, content_); | 51 web_view_->Init(app_, content_); |
| 51 } | 52 } |
| 52 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 53 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 53 request->url = test_url.spec(); | 54 request->url = test_url.spec(); |
| 54 web_view_->web_view()->LoadRequest(request.Pass()); | 55 web_view_->web_view()->LoadRequest(std::move(request)); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void TestRunnerApplicationDelegate::Terminate() { | 58 void TestRunnerApplicationDelegate::Terminate() { |
| 58 if (root_) | 59 if (root_) |
| 59 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); | 60 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); |
| 60 } | 61 } |
| 61 | 62 |
| 62 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
| 63 // mojo::ApplicationDelegate implementation: | 64 // mojo::ApplicationDelegate implementation: |
| 64 | 65 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 mus::WindowTreeConnection* connection) { | 117 mus::WindowTreeConnection* connection) { |
| 117 root_ = nullptr; | 118 root_ = nullptr; |
| 118 app_->Quit(); | 119 app_->Quit(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 //////////////////////////////////////////////////////////////////////////////// | 122 //////////////////////////////////////////////////////////////////////////////// |
| 122 // mojom::WebViewClient implementation: | 123 // mojom::WebViewClient implementation: |
| 123 | 124 |
| 124 void TestRunnerApplicationDelegate::TopLevelNavigateRequest( | 125 void TestRunnerApplicationDelegate::TopLevelNavigateRequest( |
| 125 mojo::URLRequestPtr request) { | 126 mojo::URLRequestPtr request) { |
| 126 web_view_->web_view()->LoadRequest(request.Pass()); | 127 web_view_->web_view()->LoadRequest(std::move(request)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void TestRunnerApplicationDelegate::TopLevelNavigationStarted( | 130 void TestRunnerApplicationDelegate::TopLevelNavigationStarted( |
| 130 const mojo::String& url) {} | 131 const mojo::String& url) {} |
| 131 void TestRunnerApplicationDelegate::LoadingStateChanged(bool is_loading, | 132 void TestRunnerApplicationDelegate::LoadingStateChanged(bool is_loading, |
| 132 double progress) {} | 133 double progress) {} |
| 133 void TestRunnerApplicationDelegate::BackForwardChanged( | 134 void TestRunnerApplicationDelegate::BackForwardChanged( |
| 134 mojom::ButtonState back_button, | 135 mojom::ButtonState back_button, |
| 135 mojom::ButtonState forward_button) {} | 136 mojom::ButtonState forward_button) {} |
| 136 void TestRunnerApplicationDelegate::TitleChanged(const mojo::String& title) {} | 137 void TestRunnerApplicationDelegate::TitleChanged(const mojo::String& title) {} |
| (...skipping 14 matching lines...) Expand all Loading... |
| 151 else | 152 else |
| 152 Terminate(); | 153 Terminate(); |
| 153 } | 154 } |
| 154 | 155 |
| 155 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
| 156 // mojo::InterfaceFactory<LayoutTestRunner> implementation: | 157 // mojo::InterfaceFactory<LayoutTestRunner> implementation: |
| 157 | 158 |
| 158 void TestRunnerApplicationDelegate::Create( | 159 void TestRunnerApplicationDelegate::Create( |
| 159 mojo::ApplicationConnection* connection, | 160 mojo::ApplicationConnection* connection, |
| 160 mojo::InterfaceRequest<web_view::LayoutTestRunner> request) { | 161 mojo::InterfaceRequest<web_view::LayoutTestRunner> request) { |
| 161 layout_test_runner_.AddBinding(this, request.Pass()); | 162 layout_test_runner_.AddBinding(this, std::move(request)); |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace web_view | 165 } // namespace web_view |
| OLD | NEW |