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_runner_host.h" | 5 #include "content/shell/webkit_test_runner_host.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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 printer_->PrintTextFooter(); | 173 printer_->PrintTextFooter(); |
174 printer_->PrintImageFooter(); | 174 printer_->PrintImageFooter(); |
175 enable_pixel_dumping_ = false; | 175 enable_pixel_dumping_ = false; |
176 expected_pixel_hash_.clear(); | 176 expected_pixel_hash_.clear(); |
177 captured_dump_ = false; | 177 captured_dump_ = false; |
178 dump_as_text_ = false; | 178 dump_as_text_ = false; |
179 dump_child_frames_ = false; | 179 dump_child_frames_ = false; |
180 is_printing_ = false; | 180 is_printing_ = false; |
181 should_stay_on_page_after_handling_before_unload_ = false; | 181 should_stay_on_page_after_handling_before_unload_ = false; |
182 wait_until_done_ = false; | 182 wait_until_done_ = false; |
| 183 prefs_ = ShellWebPreferences(); |
183 watchdog_.Cancel(); | 184 watchdog_.Cancel(); |
184 if (main_window_) { | 185 if (main_window_) { |
185 Observe(NULL); | 186 Observe(NULL); |
186 main_window_ = NULL; | 187 main_window_ = NULL; |
187 } | 188 } |
188 Shell::CloseAllWindows(); | 189 Shell::CloseAllWindows(); |
189 Send(new ShellViewMsg_ResetAll); | 190 Send(new ShellViewMsg_ResetAll); |
190 return true; | 191 return true; |
191 } | 192 } |
192 | 193 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 object_name + "." + property_name); | 225 object_name + "." + property_name); |
225 } | 226 } |
226 | 227 |
227 bool WebKitTestController::OnMessageReceived(const IPC::Message& message) { | 228 bool WebKitTestController::OnMessageReceived(const IPC::Message& message) { |
228 bool handled = true; | 229 bool handled = true; |
229 IPC_BEGIN_MESSAGE_MAP(WebKitTestController, message) | 230 IPC_BEGIN_MESSAGE_MAP(WebKitTestController, message) |
230 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 231 IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
231 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage) | 232 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage) |
232 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) | 233 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) |
233 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) | 234 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) |
| 235 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, |
| 236 OnOverridePreferences) |
234 IPC_MESSAGE_UNHANDLED(handled = false) | 237 IPC_MESSAGE_UNHANDLED(handled = false) |
235 IPC_END_MESSAGE_MAP() | 238 IPC_END_MESSAGE_MAP() |
236 | 239 |
237 return handled; | 240 return handled; |
238 } | 241 } |
239 | 242 |
240 void WebKitTestController::PluginCrashed(const FilePath& plugin_path) { | 243 void WebKitTestController::PluginCrashed(const FilePath& plugin_path) { |
241 printer_->AddErrorMessage("#CRASHED - plugin"); | 244 printer_->AddErrorMessage("#CRASHED - plugin"); |
242 } | 245 } |
243 | 246 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (dump_as_text_ || !enable_pixel_dumping_) { | 344 if (dump_as_text_ || !enable_pixel_dumping_) { |
342 printer_->PrintImageFooter(); | 345 printer_->PrintImageFooter(); |
343 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 346 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
344 } | 347 } |
345 } | 348 } |
346 | 349 |
347 void WebKitTestController::OnPrintMessage(const std::string& message) { | 350 void WebKitTestController::OnPrintMessage(const std::string& message) { |
348 printer_->AddMessageRaw(message); | 351 printer_->AddMessageRaw(message); |
349 } | 352 } |
350 | 353 |
| 354 void WebKitTestController::OnOverridePreferences( |
| 355 const ShellWebPreferences& prefs) { |
| 356 prefs_ = prefs; |
| 357 } |
| 358 |
351 // WebKitTestRunnerHost ------------------------------------------------------- | 359 // WebKitTestRunnerHost ------------------------------------------------------- |
352 | 360 |
353 WebKitTestRunnerHost::WebKitTestRunnerHost( | 361 WebKitTestRunnerHost::WebKitTestRunnerHost( |
354 RenderViewHost* render_view_host) | 362 RenderViewHost* render_view_host) |
355 : RenderViewHostObserver(render_view_host) { | 363 : RenderViewHostObserver(render_view_host) { |
356 } | 364 } |
357 | 365 |
358 WebKitTestRunnerHost::~WebKitTestRunnerHost() { | 366 WebKitTestRunnerHost::~WebKitTestRunnerHost() { |
359 } | 367 } |
360 | 368 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 WebKitTestController::Get()->WaitUntilDone(); | 413 WebKitTestController::Get()->WaitUntilDone(); |
406 } | 414 } |
407 | 415 |
408 void WebKitTestRunnerHost::OnNotImplemented( | 416 void WebKitTestRunnerHost::OnNotImplemented( |
409 const std::string& object_name, | 417 const std::string& object_name, |
410 const std::string& property_name) { | 418 const std::string& property_name) { |
411 WebKitTestController::Get()->NotImplemented(object_name, property_name); | 419 WebKitTestController::Get()->NotImplemented(object_name, property_name); |
412 } | 420 } |
413 | 421 |
414 } // namespace content | 422 } // namespace content |
OLD | NEW |