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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/shell/shell.h" | 16 #include "content/shell/shell.h" |
17 #include "content/shell/shell_browser_context.h" | 17 #include "content/shell/shell_browser_context.h" |
18 #include "content/shell/shell_content_browser_client.h" | 18 #include "content/shell/shell_content_browser_client.h" |
19 #include "content/shell/shell_messages.h" | 19 #include "content/shell/shell_messages.h" |
20 #include "content/shell/shell_switches.h" | 20 #include "content/shell/shell_switches.h" |
| 21 #include "content/shell/shell_webpreferences.h" |
21 #include "webkit/fileapi/isolated_context.h" | 22 #include "webkit/fileapi/isolated_context.h" |
22 #include "webkit/support/webkit_support_gfx.h" | 23 #include "webkit/support/webkit_support_gfx.h" |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 namespace { | 27 namespace { |
27 const int kTestTimeoutMilliseconds = 30 * 1000; | 28 const int kTestTimeoutMilliseconds = 30 * 1000; |
28 } // namespace | 29 } // namespace |
29 | 30 |
30 // WebKitTestResultPrinter ---------------------------------------------------- | 31 // WebKitTestResultPrinter ---------------------------------------------------- |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 printer_->PrintTextFooter(); | 180 printer_->PrintTextFooter(); |
180 printer_->PrintImageFooter(); | 181 printer_->PrintImageFooter(); |
181 enable_pixel_dumping_ = false; | 182 enable_pixel_dumping_ = false; |
182 expected_pixel_hash_.clear(); | 183 expected_pixel_hash_.clear(); |
183 captured_dump_ = false; | 184 captured_dump_ = false; |
184 dump_as_text_ = false; | 185 dump_as_text_ = false; |
185 dump_child_frames_ = false; | 186 dump_child_frames_ = false; |
186 is_printing_ = false; | 187 is_printing_ = false; |
187 should_stay_on_page_after_handling_before_unload_ = false; | 188 should_stay_on_page_after_handling_before_unload_ = false; |
188 wait_until_done_ = false; | 189 wait_until_done_ = false; |
189 prefs_ = ShellWebPreferences(); | 190 prefs_.reset(new ShellWebPreferences); |
190 { | 191 { |
191 base::AutoLock lock(lock_); | 192 base::AutoLock lock(lock_); |
192 can_open_windows_ = false; | 193 can_open_windows_ = false; |
193 } | 194 } |
194 watchdog_.Cancel(); | 195 watchdog_.Cancel(); |
195 if (main_window_) { | 196 if (main_window_) { |
196 Observe(NULL); | 197 Observe(NULL); |
197 main_window_ = NULL; | 198 main_window_ = NULL; |
198 } | 199 } |
199 Shell::CloseAllWindows(); | 200 Shell::CloseAllWindows(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 355 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
355 } | 356 } |
356 } | 357 } |
357 | 358 |
358 void WebKitTestController::OnPrintMessage(const std::string& message) { | 359 void WebKitTestController::OnPrintMessage(const std::string& message) { |
359 printer_->AddMessageRaw(message); | 360 printer_->AddMessageRaw(message); |
360 } | 361 } |
361 | 362 |
362 void WebKitTestController::OnOverridePreferences( | 363 void WebKitTestController::OnOverridePreferences( |
363 const ShellWebPreferences& prefs) { | 364 const ShellWebPreferences& prefs) { |
364 prefs_ = prefs; | 365 *prefs_.get() = prefs; |
365 } | 366 } |
366 | 367 |
367 void WebKitTestController::OnNotifyDone() { | 368 void WebKitTestController::OnNotifyDone() { |
368 if (!wait_until_done_) | 369 if (!wait_until_done_) |
369 return; | 370 return; |
370 watchdog_.Cancel(); | 371 watchdog_.Cancel(); |
371 CaptureDump(); | 372 CaptureDump(); |
372 } | 373 } |
373 | 374 |
374 void WebKitTestController::OnDumpAsText() { | 375 void WebKitTestController::OnDumpAsText() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 428 |
428 void WebKitTestController::OnNotImplemented( | 429 void WebKitTestController::OnNotImplemented( |
429 const std::string& object_name, | 430 const std::string& object_name, |
430 const std::string& property_name) { | 431 const std::string& property_name) { |
431 printer_->AddErrorMessage( | 432 printer_->AddErrorMessage( |
432 std::string("FAIL: NOT IMPLEMENTED: ") + | 433 std::string("FAIL: NOT IMPLEMENTED: ") + |
433 object_name + "." + property_name); | 434 object_name + "." + property_name); |
434 } | 435 } |
435 | 436 |
436 } // namespace content | 437 } // namespace content |
OLD | NEW |