Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Side by Side Diff: components/web_view/test_runner/test_runner_application_delegate.cc

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "components/mus/public/cpp/scoped_window_ptr.h" 20 #include "components/mus/public/cpp/scoped_window_ptr.h"
21 #include "components/mus/public/cpp/window.h" 21 #include "components/mus/public/cpp/window.h"
22 #include "components/mus/public/cpp/window_tree_connection.h" 22 #include "components/mus/public/cpp/window_tree_connection.h"
23 #include "components/mus/public/cpp/window_tree_host_factory.h" 23 #include "components/mus/public/cpp/window_tree_host_factory.h"
24 #include "components/test_runner/blink_test_platform_support.h" 24 #include "components/test_runner/blink_test_platform_support.h"
25 #include "mojo/converters/geometry/geometry_type_converters.h" 25 #include "mojo/converters/geometry/geometry_type_converters.h"
26 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" 26 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
27 #include "mojo/shell/public/cpp/application_connection.h" 27 #include "mojo/shell/public/cpp/connection.h"
28 #include "mojo/shell/public/cpp/shell.h" 28 #include "mojo/shell/public/cpp/shell.h"
29 #include "ui/gfx/geometry/rect.h" 29 #include "ui/gfx/geometry/rect.h"
30 #include "ui/gfx/geometry/size.h" 30 #include "ui/gfx/geometry/size.h"
31 #include "url/gurl.h" 31 #include "url/gurl.h"
32 32
33 #if defined(OS_WIN) 33 #if defined(OS_WIN)
34 #include "base/strings/sys_string_conversions.h" 34 #include "base/strings/sys_string_conversions.h"
35 #include "base/strings/utf_string_conversions.h" 35 #include "base/strings/utf_string_conversions.h"
36 #endif 36 #endif
37 37
(...skipping 16 matching lines...) Expand all
54 request->url = test_url.spec(); 54 request->url = test_url.spec();
55 web_view_->web_view()->LoadRequest(std::move(request)); 55 web_view_->web_view()->LoadRequest(std::move(request));
56 } 56 }
57 57
58 void TestRunnerApplicationDelegate::Terminate() { 58 void TestRunnerApplicationDelegate::Terminate() {
59 if (root_) 59 if (root_)
60 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); 60 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_);
61 } 61 }
62 62
63 //////////////////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////////////////
64 // mojo::ApplicationDelegate implementation: 64 // mojo::ShellClient implementation:
65 65
66 void TestRunnerApplicationDelegate::Initialize(mojo::Shell* shell, 66 void TestRunnerApplicationDelegate::Initialize(mojo::Shell* shell,
67 const std::string& url, 67 const std::string& url,
68 uint32_t id) { 68 uint32_t id) {
69 if (!test_runner::BlinkTestPlatformInitialize()) { 69 if (!test_runner::BlinkTestPlatformInitialize()) {
70 NOTREACHED() << "Test environment could not be properly set up for blink."; 70 NOTREACHED() << "Test environment could not be properly set up for blink.";
71 } 71 }
72 shell_ = shell; 72 shell_ = shell;
73 mus::CreateWindowTreeHost(shell_, this, &host_, nullptr); 73 mus::CreateWindowTreeHost(shell_, this, &host_, nullptr);
74 } 74 }
75 75
76 bool TestRunnerApplicationDelegate::AcceptConnection( 76 bool TestRunnerApplicationDelegate::AcceptConnection(
77 mojo::ApplicationConnection* connection) { 77 mojo::Connection* connection) {
78 connection->AddService<web_view::LayoutTestRunner>(this); 78 connection->AddService<web_view::LayoutTestRunner>(this);
79 return true; 79 return true;
80 } 80 }
81 81
82 //////////////////////////////////////////////////////////////////////////////// 82 ////////////////////////////////////////////////////////////////////////////////
83 // mus::WindowTreeDelegate implementation: 83 // mus::WindowTreeDelegate implementation:
84 84
85 void TestRunnerApplicationDelegate::OnEmbed(mus::Window* root) { 85 void TestRunnerApplicationDelegate::OnEmbed(mus::Window* root) {
86 root_ = root; 86 root_ = root;
87 87
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (test_info) 151 if (test_info)
152 LaunchURL(test_info->url); 152 LaunchURL(test_info->url);
153 else 153 else
154 Terminate(); 154 Terminate();
155 } 155 }
156 156
157 //////////////////////////////////////////////////////////////////////////////// 157 ////////////////////////////////////////////////////////////////////////////////
158 // mojo::InterfaceFactory<LayoutTestRunner> implementation: 158 // mojo::InterfaceFactory<LayoutTestRunner> implementation:
159 159
160 void TestRunnerApplicationDelegate::Create( 160 void TestRunnerApplicationDelegate::Create(
161 mojo::ApplicationConnection* connection, 161 mojo::Connection* connection,
162 mojo::InterfaceRequest<web_view::LayoutTestRunner> request) { 162 mojo::InterfaceRequest<web_view::LayoutTestRunner> request) {
163 layout_test_runner_.AddBinding(this, std::move(request)); 163 layout_test_runner_.AddBinding(this, std::move(request));
164 } 164 }
165 165
166 } // namespace web_view 166 } // namespace web_view
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698