| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <clocale> | 8 #include <clocale> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "content/shell/renderer/layout_test/leak_detector.h" | 49 #include "content/shell/renderer/layout_test/leak_detector.h" |
| 50 #include "net/base/filename_util.h" | 50 #include "net/base/filename_util.h" |
| 51 #include "net/base/net_errors.h" | 51 #include "net/base/net_errors.h" |
| 52 #include "skia/ext/platform_canvas.h" | 52 #include "skia/ext/platform_canvas.h" |
| 53 #include "third_party/WebKit/public/platform/Platform.h" | 53 #include "third_party/WebKit/public/platform/Platform.h" |
| 54 #include "third_party/WebKit/public/platform/WebCString.h" | 54 #include "third_party/WebKit/public/platform/WebCString.h" |
| 55 #include "third_party/WebKit/public/platform/WebPoint.h" | 55 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 56 #include "third_party/WebKit/public/platform/WebRect.h" | 56 #include "third_party/WebKit/public/platform/WebRect.h" |
| 57 #include "third_party/WebKit/public/platform/WebSize.h" | 57 #include "third_party/WebKit/public/platform/WebSize.h" |
| 58 #include "third_party/WebKit/public/platform/WebString.h" | 58 #include "third_party/WebKit/public/platform/WebString.h" |
| 59 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
| 59 #include "third_party/WebKit/public/platform/WebThread.h" | 60 #include "third_party/WebKit/public/platform/WebThread.h" |
| 60 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 61 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 61 #include "third_party/WebKit/public/platform/WebURL.h" | 62 #include "third_party/WebKit/public/platform/WebURL.h" |
| 62 #include "third_party/WebKit/public/platform/WebURLError.h" | 63 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 63 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 64 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 64 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 65 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 65 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" | 66 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm
ptReply.h" |
| 66 #include "third_party/WebKit/public/web/WebArrayBufferView.h" | 67 #include "third_party/WebKit/public/web/WebArrayBufferView.h" |
| 67 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 68 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| 68 #include "third_party/WebKit/public/web/WebDataSource.h" | 69 #include "third_party/WebKit/public/web/WebDataSource.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 using blink::WebTestingSupport; | 101 using blink::WebTestingSupport; |
| 101 using blink::WebTraceLocation; | 102 using blink::WebTraceLocation; |
| 102 using blink::WebThread; | 103 using blink::WebThread; |
| 103 using blink::WebVector; | 104 using blink::WebVector; |
| 104 using blink::WebView; | 105 using blink::WebView; |
| 105 | 106 |
| 106 namespace content { | 107 namespace content { |
| 107 | 108 |
| 108 namespace { | 109 namespace { |
| 109 | 110 |
| 110 class InvokeTaskHelper : public WebThread::Task { | 111 class InvokeTaskHelper : public blink::WebTaskRunner::Task { |
| 111 public: | 112 public: |
| 112 InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) | 113 InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) |
| 113 : task_(task.Pass()) {} | 114 : task_(task.Pass()) {} |
| 114 | 115 |
| 115 // WebThread::Task implementation: | 116 // WebThread::Task implementation: |
| 116 void run() override { task_->run(); } | 117 void run() override { task_->run(); } |
| 117 | 118 |
| 118 private: | 119 private: |
| 119 scoped_ptr<test_runner::WebTask> task_; | 120 scoped_ptr<test_runner::WebTask> task_; |
| 120 }; | 121 }; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 void BlinkTestRunner::DidChangeBatteryStatus( | 284 void BlinkTestRunner::DidChangeBatteryStatus( |
| 284 const blink::WebBatteryStatus& status) { | 285 const blink::WebBatteryStatus& status) { |
| 285 MockBatteryStatusChanged(status); | 286 MockBatteryStatusChanged(status); |
| 286 } | 287 } |
| 287 | 288 |
| 288 void BlinkTestRunner::PrintMessage(const std::string& message) { | 289 void BlinkTestRunner::PrintMessage(const std::string& message) { |
| 289 Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); | 290 Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); |
| 290 } | 291 } |
| 291 | 292 |
| 292 void BlinkTestRunner::PostTask(test_runner::WebTask* task) { | 293 void BlinkTestRunner::PostTask(test_runner::WebTask* task) { |
| 293 Platform::current()->currentThread()->postTask( | 294 Platform::current()->currentThread()->taskRunner()->postTask( |
| 294 WebTraceLocation(__FUNCTION__, __FILE__), | 295 WebTraceLocation(__FUNCTION__, __FILE__), |
| 295 new InvokeTaskHelper(make_scoped_ptr(task))); | 296 new InvokeTaskHelper(make_scoped_ptr(task))); |
| 296 } | 297 } |
| 297 | 298 |
| 298 void BlinkTestRunner::PostDelayedTask(test_runner::WebTask* task, | 299 void BlinkTestRunner::PostDelayedTask(test_runner::WebTask* task, |
| 299 long long ms) { | 300 long long ms) { |
| 300 Platform::current()->currentThread()->postDelayedTask( | 301 Platform::current()->currentThread()->taskRunner()->postDelayedTask( |
| 301 WebTraceLocation(__FUNCTION__, __FILE__), | 302 WebTraceLocation(__FUNCTION__, __FILE__), |
| 302 new InvokeTaskHelper(make_scoped_ptr(task)), ms); | 303 new InvokeTaskHelper(make_scoped_ptr(task)), ms); |
| 303 } | 304 } |
| 304 | 305 |
| 305 WebString BlinkTestRunner::RegisterIsolatedFileSystem( | 306 WebString BlinkTestRunner::RegisterIsolatedFileSystem( |
| 306 const blink::WebVector<blink::WebString>& absolute_filenames) { | 307 const blink::WebVector<blink::WebString>& absolute_filenames) { |
| 307 std::vector<base::FilePath> files; | 308 std::vector<base::FilePath> files; |
| 308 for (size_t i = 0; i < absolute_filenames.size(); ++i) | 309 for (size_t i = 0; i < absolute_filenames.size(); ++i) |
| 309 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); | 310 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); |
| 310 std::string filesystem_id; | 311 std::string filesystem_id; |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 | 905 |
| 905 leak_detector_->TryLeakDetection(main_frame); | 906 leak_detector_->TryLeakDetection(main_frame); |
| 906 } | 907 } |
| 907 | 908 |
| 908 void BlinkTestRunner::ReportLeakDetectionResult( | 909 void BlinkTestRunner::ReportLeakDetectionResult( |
| 909 const LeakDetectionResult& report) { | 910 const LeakDetectionResult& report) { |
| 910 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 911 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 911 } | 912 } |
| 912 | 913 |
| 913 } // namespace content | 914 } // namespace content |
| OLD | NEW |