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/webkit_test_controller.h" | 5 #include "content/shell/webkit_test_controller.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 base::AutoLock lock(lock_); | 212 base::AutoLock lock(lock_); |
213 return can_open_windows_; | 213 return can_open_windows_; |
214 } | 214 } |
215 | 215 |
216 bool WebKitTestController::OnMessageReceived(const IPC::Message& message) { | 216 bool WebKitTestController::OnMessageReceived(const IPC::Message& message) { |
217 DCHECK(CalledOnValidThread()); | 217 DCHECK(CalledOnValidThread()); |
218 bool handled = true; | 218 bool handled = true; |
219 IPC_BEGIN_MESSAGE_MAP(WebKitTestController, message) | 219 IPC_BEGIN_MESSAGE_MAP(WebKitTestController, message) |
220 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 220 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
221 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage) | 221 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage) |
| 222 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ReadFileToString, OnReadFileToString) |
222 IPC_MESSAGE_HANDLER(ShellViewHostMsg_RegisterIsolatedFileSystem, | 223 IPC_MESSAGE_HANDLER(ShellViewHostMsg_RegisterIsolatedFileSystem, |
223 OnRegisterIsolatedFileSystem) | 224 OnRegisterIsolatedFileSystem) |
224 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) | 225 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) |
225 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) | 226 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) |
226 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, | 227 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, |
227 OnOverridePreferences) | 228 OnOverridePreferences) |
228 IPC_MESSAGE_HANDLER(ShellViewHostMsg_NotifyDone, OnNotifyDone) | 229 IPC_MESSAGE_HANDLER(ShellViewHostMsg_NotifyDone, OnNotifyDone) |
229 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DumpAsText, OnDumpAsText) | 230 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DumpAsText, OnDumpAsText) |
230 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DumpChildFramesAsText, | 231 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DumpChildFramesAsText, |
231 OnDumpChildFramesAsText) | 232 OnDumpChildFramesAsText) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 if (dump_as_text_ || !enable_pixel_dumping_) { | 354 if (dump_as_text_ || !enable_pixel_dumping_) { |
354 printer_->PrintImageFooter(); | 355 printer_->PrintImageFooter(); |
355 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 356 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
356 } | 357 } |
357 } | 358 } |
358 | 359 |
359 void WebKitTestController::OnPrintMessage(const std::string& message) { | 360 void WebKitTestController::OnPrintMessage(const std::string& message) { |
360 printer_->AddMessageRaw(message); | 361 printer_->AddMessageRaw(message); |
361 } | 362 } |
362 | 363 |
| 364 void WebKitTestController::OnReadFileToString(const FilePath& local_file, |
| 365 std::string* contents) { |
| 366 file_util::ReadFileToString(local_file, contents); |
| 367 } |
| 368 |
363 void WebKitTestController::OnOverridePreferences( | 369 void WebKitTestController::OnOverridePreferences( |
364 const ShellWebPreferences& prefs) { | 370 const ShellWebPreferences& prefs) { |
365 *prefs_.get() = prefs; | 371 *prefs_.get() = prefs; |
366 } | 372 } |
367 | 373 |
368 void WebKitTestController::OnNotifyDone() { | 374 void WebKitTestController::OnNotifyDone() { |
369 if (!wait_until_done_) | 375 if (!wait_until_done_) |
370 return; | 376 return; |
371 watchdog_.Cancel(); | 377 watchdog_.Cancel(); |
372 CaptureDump(); | 378 CaptureDump(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 434 |
429 void WebKitTestController::OnNotImplemented( | 435 void WebKitTestController::OnNotImplemented( |
430 const std::string& object_name, | 436 const std::string& object_name, |
431 const std::string& property_name) { | 437 const std::string& property_name) { |
432 printer_->AddErrorMessage( | 438 printer_->AddErrorMessage( |
433 std::string("FAIL: NOT IMPLEMENTED: ") + | 439 std::string("FAIL: NOT IMPLEMENTED: ") + |
434 object_name + "." + property_name); | 440 object_name + "." + property_name); |
435 } | 441 } |
436 | 442 |
437 } // namespace content | 443 } // namespace content |
OLD | NEW |