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/html_viewer/web_test_delegate_impl.h" | 5 #include "components/html_viewer/web_test_delegate_impl.h" |
6 | 6 |
| 7 #include <iostream> |
| 8 |
7 #include "base/time/time.h" | 9 #include "base/time/time.h" |
8 #include "cc/layers/texture_layer.h" | 10 #include "cc/layers/texture_layer.h" |
9 #include "components/test_runner/web_task.h" | 11 #include "components/test_runner/web_task.h" |
10 #include "components/test_runner/web_test_interfaces.h" | 12 #include "components/test_runner/web_test_interfaces.h" |
11 #include "components/test_runner/web_test_proxy.h" | 13 #include "components/test_runner/web_test_proxy.h" |
12 #include "third_party/WebKit/public/platform/Platform.h" | 14 #include "third_party/WebKit/public/platform/Platform.h" |
13 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
14 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 16 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
15 #include "third_party/WebKit/public/platform/WebThread.h" | 17 #include "third_party/WebKit/public/platform/WebThread.h" |
16 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 18 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void WebTestDelegateImpl::ResetScreenOrientation() { | 80 void WebTestDelegateImpl::ResetScreenOrientation() { |
79 NOTIMPLEMENTED(); | 81 NOTIMPLEMENTED(); |
80 } | 82 } |
81 | 83 |
82 void WebTestDelegateImpl::DidChangeBatteryStatus( | 84 void WebTestDelegateImpl::DidChangeBatteryStatus( |
83 const blink::WebBatteryStatus& status) { | 85 const blink::WebBatteryStatus& status) { |
84 NOTIMPLEMENTED(); | 86 NOTIMPLEMENTED(); |
85 } | 87 } |
86 | 88 |
87 void WebTestDelegateImpl::PrintMessage(const std::string& message) { | 89 void WebTestDelegateImpl::PrintMessage(const std::string& message) { |
88 fprintf(stderr, "%s", message.c_str()); | 90 std::cout << message; |
89 } | 91 } |
90 | 92 |
91 void WebTestDelegateImpl::PostTask(test_runner::WebTask* task) { | 93 void WebTestDelegateImpl::PostTask(test_runner::WebTask* task) { |
92 blink::Platform::current()->currentThread()->taskRunner()->postTask( | 94 blink::Platform::current()->currentThread()->taskRunner()->postTask( |
93 blink::WebTraceLocation(__FUNCTION__, __FILE__), | 95 blink::WebTraceLocation(__FUNCTION__, __FILE__), |
94 new InvokeTaskHelper(make_scoped_ptr(task))); | 96 new InvokeTaskHelper(make_scoped_ptr(task))); |
95 } | 97 } |
96 | 98 |
97 void WebTestDelegateImpl::PostDelayedTask(test_runner::WebTask* task, | 99 void WebTestDelegateImpl::PostDelayedTask(test_runner::WebTask* task, |
98 long long ms) { | 100 long long ms) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 const std::string& resource) { | 223 const std::string& resource) { |
222 NOTIMPLEMENTED(); | 224 NOTIMPLEMENTED(); |
223 return std::string(); | 225 return std::string(); |
224 } | 226 } |
225 | 227 |
226 void WebTestDelegateImpl::SetLocale(const std::string& locale) { | 228 void WebTestDelegateImpl::SetLocale(const std::string& locale) { |
227 NOTIMPLEMENTED(); | 229 NOTIMPLEMENTED(); |
228 } | 230 } |
229 | 231 |
230 void WebTestDelegateImpl::TestFinished() { | 232 void WebTestDelegateImpl::TestFinished() { |
| 233 std::cout << "Content-Type: text/plain\n"; |
| 234 std::cout << (proxy_ ? proxy_->CaptureTree(false, false) : dump_tree_); |
| 235 std::cout << "#EOF\n"; |
| 236 |
231 test_interfaces_->SetTestIsRunning(false); | 237 test_interfaces_->SetTestIsRunning(false); |
232 fprintf(stderr, "%s", proxy_ ? proxy_->CaptureTree(false, false).c_str() | 238 if (!completion_callback_.is_null()) |
233 : dump_tree_.c_str()); | 239 completion_callback_.Run(); |
234 } | 240 } |
235 | 241 |
236 void WebTestDelegateImpl::CloseRemainingWindows() { | 242 void WebTestDelegateImpl::CloseRemainingWindows() { |
237 NOTIMPLEMENTED(); | 243 NOTIMPLEMENTED(); |
238 } | 244 } |
239 | 245 |
240 void WebTestDelegateImpl::DeleteAllCookies() { | 246 void WebTestDelegateImpl::DeleteAllCookies() { |
241 NOTIMPLEMENTED(); | 247 NOTIMPLEMENTED(); |
242 } | 248 } |
243 | 249 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 320 } |
315 | 321 |
316 void WebTestDelegateImpl::OnWebTestProxyBaseDestroy( | 322 void WebTestDelegateImpl::OnWebTestProxyBaseDestroy( |
317 test_runner::WebTestProxyBase* base) { | 323 test_runner::WebTestProxyBase* base) { |
318 DCHECK_EQ(proxy_, base); | 324 DCHECK_EQ(proxy_, base); |
319 dump_tree_ = proxy_->CaptureTree(false, false); | 325 dump_tree_ = proxy_->CaptureTree(false, false); |
320 proxy_ = nullptr; | 326 proxy_ = nullptr; |
321 } | 327 } |
322 | 328 |
323 } // namespace html_viewer | 329 } // namespace html_viewer |
OLD | NEW |