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/webkit_test_runner.h" | 5 #include "content/shell/renderer/layout_test/webkit_test_runner.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <clocale> | 8 #include <clocale> |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "content/shell/renderer/test_runner/web_test_runner.h" | 42 #include "content/shell/renderer/test_runner/web_test_runner.h" |
43 #include "net/base/filename_util.h" | 43 #include "net/base/filename_util.h" |
44 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
45 #include "skia/ext/platform_canvas.h" | 45 #include "skia/ext/platform_canvas.h" |
46 #include "third_party/WebKit/public/platform/Platform.h" | 46 #include "third_party/WebKit/public/platform/Platform.h" |
47 #include "third_party/WebKit/public/platform/WebCString.h" | 47 #include "third_party/WebKit/public/platform/WebCString.h" |
48 #include "third_party/WebKit/public/platform/WebPoint.h" | 48 #include "third_party/WebKit/public/platform/WebPoint.h" |
49 #include "third_party/WebKit/public/platform/WebRect.h" | 49 #include "third_party/WebKit/public/platform/WebRect.h" |
50 #include "third_party/WebKit/public/platform/WebSize.h" | 50 #include "third_party/WebKit/public/platform/WebSize.h" |
51 #include "third_party/WebKit/public/platform/WebString.h" | 51 #include "third_party/WebKit/public/platform/WebString.h" |
| 52 #include "third_party/WebKit/public/platform/WebThread.h" |
52 #include "third_party/WebKit/public/platform/WebURL.h" | 53 #include "third_party/WebKit/public/platform/WebURL.h" |
53 #include "third_party/WebKit/public/platform/WebURLError.h" | 54 #include "third_party/WebKit/public/platform/WebURLError.h" |
54 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 55 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
55 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 56 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
56 #include "third_party/WebKit/public/web/WebArrayBufferView.h" | 57 #include "third_party/WebKit/public/web/WebArrayBufferView.h" |
57 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 58 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
58 #include "third_party/WebKit/public/web/WebDataSource.h" | 59 #include "third_party/WebKit/public/web/WebDataSource.h" |
59 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | 60 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" |
60 #include "third_party/WebKit/public/web/WebDocument.h" | 61 #include "third_party/WebKit/public/web/WebDocument.h" |
61 #include "third_party/WebKit/public/web/WebElement.h" | 62 #include "third_party/WebKit/public/web/WebElement.h" |
(...skipping 19 matching lines...) Expand all Loading... |
81 using blink::WebPoint; | 82 using blink::WebPoint; |
82 using blink::WebRect; | 83 using blink::WebRect; |
83 using blink::WebScriptSource; | 84 using blink::WebScriptSource; |
84 using blink::WebSize; | 85 using blink::WebSize; |
85 using blink::WebString; | 86 using blink::WebString; |
86 using blink::WebURL; | 87 using blink::WebURL; |
87 using blink::WebURLError; | 88 using blink::WebURLError; |
88 using blink::WebURLRequest; | 89 using blink::WebURLRequest; |
89 using blink::WebScreenOrientationType; | 90 using blink::WebScreenOrientationType; |
90 using blink::WebTestingSupport; | 91 using blink::WebTestingSupport; |
| 92 using blink::WebThread; |
91 using blink::WebVector; | 93 using blink::WebVector; |
92 using blink::WebView; | 94 using blink::WebView; |
93 | 95 |
94 namespace content { | 96 namespace content { |
95 | 97 |
96 namespace { | 98 namespace { |
97 | 99 |
98 void InvokeTaskHelper(void* context) { | 100 class InvokeTaskHelper : public WebThread::Task { |
99 WebTask* task = reinterpret_cast<WebTask*>(context); | 101 public: |
100 task->run(); | 102 InvokeTaskHelper(scoped_ptr<WebTask> task) : task_(task.Pass()) {} |
101 delete task; | 103 |
102 } | 104 // WebThread::Task implementation: |
| 105 void run() override { task_->run(); } |
| 106 |
| 107 private: |
| 108 scoped_ptr<WebTask> task_; |
| 109 }; |
103 | 110 |
104 class SyncNavigationStateVisitor : public RenderViewVisitor { | 111 class SyncNavigationStateVisitor : public RenderViewVisitor { |
105 public: | 112 public: |
106 SyncNavigationStateVisitor() {} | 113 SyncNavigationStateVisitor() {} |
107 ~SyncNavigationStateVisitor() override {} | 114 ~SyncNavigationStateVisitor() override {} |
108 | 115 |
109 bool Visit(RenderView* render_view) override { | 116 bool Visit(RenderView* render_view) override { |
110 SyncNavigationState(render_view); | 117 SyncNavigationState(render_view); |
111 return true; | 118 return true; |
112 } | 119 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 void WebKitTestRunner::DidChangeBatteryStatus( | 246 void WebKitTestRunner::DidChangeBatteryStatus( |
240 const blink::WebBatteryStatus& status) { | 247 const blink::WebBatteryStatus& status) { |
241 MockBatteryStatusChanged(status); | 248 MockBatteryStatusChanged(status); |
242 } | 249 } |
243 | 250 |
244 void WebKitTestRunner::PrintMessage(const std::string& message) { | 251 void WebKitTestRunner::PrintMessage(const std::string& message) { |
245 Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); | 252 Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); |
246 } | 253 } |
247 | 254 |
248 void WebKitTestRunner::PostTask(WebTask* task) { | 255 void WebKitTestRunner::PostTask(WebTask* task) { |
249 Platform::current()->callOnMainThread(InvokeTaskHelper, task); | 256 Platform::current()->currentThread()->postTask( |
| 257 new InvokeTaskHelper(make_scoped_ptr(task))); |
250 } | 258 } |
251 | 259 |
252 void WebKitTestRunner::PostDelayedTask(WebTask* task, long long ms) { | 260 void WebKitTestRunner::PostDelayedTask(WebTask* task, long long ms) { |
253 base::MessageLoop::current()->PostDelayedTask( | 261 Platform::current()->currentThread()->postDelayedTask( |
254 FROM_HERE, | 262 new InvokeTaskHelper(make_scoped_ptr(task)), ms); |
255 base::Bind(&WebTask::run, base::Owned(task)), | |
256 base::TimeDelta::FromMilliseconds(ms)); | |
257 } | 263 } |
258 | 264 |
259 WebString WebKitTestRunner::RegisterIsolatedFileSystem( | 265 WebString WebKitTestRunner::RegisterIsolatedFileSystem( |
260 const blink::WebVector<blink::WebString>& absolute_filenames) { | 266 const blink::WebVector<blink::WebString>& absolute_filenames) { |
261 std::vector<base::FilePath> files; | 267 std::vector<base::FilePath> files; |
262 for (size_t i = 0; i < absolute_filenames.size(); ++i) | 268 for (size_t i = 0; i < absolute_filenames.size(); ++i) |
263 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); | 269 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); |
264 std::string filesystem_id; | 270 std::string filesystem_id; |
265 Send(new LayoutTestHostMsg_RegisterIsolatedFileSystem( | 271 Send(new LayoutTestHostMsg_RegisterIsolatedFileSystem( |
266 routing_id(), files, &filesystem_id)); | 272 routing_id(), files, &filesystem_id)); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 764 |
759 leak_detector_->TryLeakDetection(main_frame); | 765 leak_detector_->TryLeakDetection(main_frame); |
760 } | 766 } |
761 | 767 |
762 void WebKitTestRunner::ReportLeakDetectionResult( | 768 void WebKitTestRunner::ReportLeakDetectionResult( |
763 const LeakDetectionResult& report) { | 769 const LeakDetectionResult& report) { |
764 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 770 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
765 } | 771 } |
766 | 772 |
767 } // namespace content | 773 } // namespace content |
OLD | NEW |