OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/renderer/layout_test/blink_test_runner.h" | 5 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <clocale> | 9 #include <clocale> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "base/values.h" | 29 #include "base/values.h" |
30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
31 #include "components/plugins/renderer/plugin_placeholder.h" | 31 #include "components/plugins/renderer/plugin_placeholder.h" |
32 #include "components/test_runner/gamepad_controller.h" | 32 #include "components/test_runner/gamepad_controller.h" |
33 #include "components/test_runner/test_interfaces.h" | |
Łukasz Anforowicz
2016/03/16 01:41:22
Removing include of test_interfaces.h is not reall
| |
34 #include "components/test_runner/web_task.h" | |
35 #include "components/test_runner/web_test_interfaces.h" | 33 #include "components/test_runner/web_test_interfaces.h" |
36 #include "components/test_runner/web_test_proxy.h" | 34 #include "components/test_runner/web_test_proxy.h" |
37 #include "components/test_runner/web_test_runner.h" | 35 #include "components/test_runner/web_test_runner.h" |
38 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
39 #include "content/public/common/url_constants.h" | 37 #include "content/public/common/url_constants.h" |
40 #include "content/public/common/web_preferences.h" | 38 #include "content/public/common/web_preferences.h" |
41 #include "content/public/renderer/media_stream_api.h" | 39 #include "content/public/renderer/media_stream_api.h" |
42 #include "content/public/renderer/render_frame.h" | 40 #include "content/public/renderer/render_frame.h" |
43 #include "content/public/renderer/render_view.h" | 41 #include "content/public/renderer/render_view.h" |
44 #include "content/public/renderer/render_view_visitor.h" | 42 #include "content/public/renderer/render_view_visitor.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 using blink::WebTestingSupport; | 105 using blink::WebTestingSupport; |
108 using blink::WebTraceLocation; | 106 using blink::WebTraceLocation; |
109 using blink::WebThread; | 107 using blink::WebThread; |
110 using blink::WebVector; | 108 using blink::WebVector; |
111 using blink::WebView; | 109 using blink::WebView; |
112 | 110 |
113 namespace content { | 111 namespace content { |
114 | 112 |
115 namespace { | 113 namespace { |
116 | 114 |
117 class InvokeTaskHelper : public blink::WebTaskRunner::Task { | |
118 public: | |
119 InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) | |
120 : task_(std::move(task)) {} | |
121 | |
122 // WebThread::Task implementation: | |
123 void run() override { task_->run(); } | |
124 | |
125 private: | |
126 scoped_ptr<test_runner::WebTask> task_; | |
127 }; | |
128 | |
129 class SyncNavigationStateVisitor : public RenderViewVisitor { | 115 class SyncNavigationStateVisitor : public RenderViewVisitor { |
130 public: | 116 public: |
131 SyncNavigationStateVisitor() {} | 117 SyncNavigationStateVisitor() {} |
132 ~SyncNavigationStateVisitor() override {} | 118 ~SyncNavigationStateVisitor() override {} |
133 | 119 |
134 bool Visit(RenderView* render_view) override { | 120 bool Visit(RenderView* render_view) override { |
135 SyncNavigationState(render_view); | 121 SyncNavigationState(render_view); |
136 return true; | 122 return true; |
137 } | 123 } |
138 private: | 124 private: |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 | 269 |
284 void BlinkTestRunner::SetDeviceOrientationData( | 270 void BlinkTestRunner::SetDeviceOrientationData( |
285 const WebDeviceOrientationData& data) { | 271 const WebDeviceOrientationData& data) { |
286 SetMockDeviceOrientationData(data); | 272 SetMockDeviceOrientationData(data); |
287 } | 273 } |
288 | 274 |
289 void BlinkTestRunner::PrintMessage(const std::string& message) { | 275 void BlinkTestRunner::PrintMessage(const std::string& message) { |
290 Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); | 276 Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); |
291 } | 277 } |
292 | 278 |
293 void BlinkTestRunner::PostTask(test_runner::WebTask* task) { | 279 void BlinkTestRunner::PostTask(blink::WebTaskRunner::Task* task) { |
294 Platform::current()->currentThread()->getWebTaskRunner()->postTask( | 280 Platform::current()->currentThread()->getWebTaskRunner()->postTask( |
295 WebTraceLocation(__FUNCTION__, __FILE__), | 281 WebTraceLocation(__FUNCTION__, __FILE__), task); |
296 new InvokeTaskHelper(make_scoped_ptr(task))); | |
297 } | 282 } |
298 | 283 |
299 void BlinkTestRunner::PostDelayedTask(test_runner::WebTask* task, | 284 void BlinkTestRunner::PostDelayedTask(blink::WebTaskRunner::Task* task, |
300 long long ms) { | 285 long long ms) { |
301 Platform::current()->currentThread()->getWebTaskRunner()->postDelayedTask( | 286 Platform::current()->currentThread()->getWebTaskRunner()->postDelayedTask( |
302 WebTraceLocation(__FUNCTION__, __FILE__), | 287 WebTraceLocation(__FUNCTION__, __FILE__), task, ms); |
303 new InvokeTaskHelper(make_scoped_ptr(task)), ms); | |
304 } | 288 } |
305 | 289 |
306 WebString BlinkTestRunner::RegisterIsolatedFileSystem( | 290 WebString BlinkTestRunner::RegisterIsolatedFileSystem( |
307 const blink::WebVector<blink::WebString>& absolute_filenames) { | 291 const blink::WebVector<blink::WebString>& absolute_filenames) { |
308 std::vector<base::FilePath> files; | 292 std::vector<base::FilePath> files; |
309 for (size_t i = 0; i < absolute_filenames.size(); ++i) | 293 for (size_t i = 0; i < absolute_filenames.size(); ++i) |
310 files.push_back(blink::WebStringToFilePath(absolute_filenames[i])); | 294 files.push_back(blink::WebStringToFilePath(absolute_filenames[i])); |
311 std::string filesystem_id; | 295 std::string filesystem_id; |
312 Send(new LayoutTestHostMsg_RegisterIsolatedFileSystem( | 296 Send(new LayoutTestHostMsg_RegisterIsolatedFileSystem( |
313 routing_id(), files, &filesystem_id)); | 297 routing_id(), files, &filesystem_id)); |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1026 get_bluetooth_events_callbacks_.pop_front(); | 1010 get_bluetooth_events_callbacks_.pop_front(); |
1027 callback.Run(events); | 1011 callback.Run(events); |
1028 } | 1012 } |
1029 | 1013 |
1030 void BlinkTestRunner::ReportLeakDetectionResult( | 1014 void BlinkTestRunner::ReportLeakDetectionResult( |
1031 const LeakDetectionResult& report) { | 1015 const LeakDetectionResult& report) { |
1032 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1016 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1033 } | 1017 } |
1034 | 1018 |
1035 } // namespace content | 1019 } // namespace content |
OLD | NEW |