Commit 9b4c6cd5 authored by jochen@chromium.org's avatar jochen@chromium.org

[content shell] rename layout_test_controller{,_host,_bindings}.* to webkit_test_runner

BUG=111316
TEST=none
TBR=jam@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10860037

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152311 0039d316-1c4b-4281-b951-d872f2087c98
parent 0fc4e6ef
...@@ -45,12 +45,6 @@ ...@@ -45,12 +45,6 @@
'sources': [ 'sources': [
'shell/geolocation/shell_access_token_store.cc', 'shell/geolocation/shell_access_token_store.cc',
'shell/geolocation/shell_access_token_store.h', 'shell/geolocation/shell_access_token_store.h',
'shell/layout_test_controller.cc',
'shell/layout_test_controller.h',
'shell/layout_test_controller_bindings.cc',
'shell/layout_test_controller_bindings.h',
'shell/layout_test_controller_host.cc',
'shell/layout_test_controller_host.h',
'shell/paths_mac.h', 'shell/paths_mac.h',
'shell/paths_mac.mm', 'shell/paths_mac.mm',
'shell/shell.cc', 'shell/shell.cc',
...@@ -106,6 +100,12 @@ ...@@ -106,6 +100,12 @@
'shell/shell_switches.h', 'shell/shell_switches.h',
'shell/shell_url_request_context_getter.cc', 'shell/shell_url_request_context_getter.cc',
'shell/shell_url_request_context_getter.h', 'shell/shell_url_request_context_getter.h',
'shell/webkit_test_runner.cc',
'shell/webkit_test_runner.h',
'shell/webkit_test_runner_bindings.cc',
'shell/webkit_test_runner_bindings.h',
'shell/webkit_test_runner_host.cc',
'shell/webkit_test_runner_host.h',
], ],
'msvs_settings': { 'msvs_settings': {
'VCLinkerTool': { 'VCLinkerTool': {
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_main_runner.h"
#include "content/shell/layout_test_controller_host.h"
#include "content/shell/shell.h" #include "content/shell/shell.h"
#include "content/shell/shell_browser_context.h" #include "content/shell/shell_browser_context.h"
#include "content/shell/shell_content_browser_client.h" #include "content/shell/shell_content_browser_client.h"
#include "content/shell/shell_switches.h" #include "content/shell/shell_switches.h"
#include "content/shell/webkit_test_runner_host.h"
#include "webkit/support/webkit_support.h" #include "webkit/support/webkit_support.h"
namespace { namespace {
...@@ -86,7 +86,7 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) { ...@@ -86,7 +86,7 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) {
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
NULL); NULL);
content::LayoutTestControllerHost::Init(pixel_hash); content::WebKitTestRunnerHost::Init(pixel_hash);
main_runner_->Run(); main_runner_->Run();
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#include "base/file_path.h" #include "base/file_path.h"
#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_dispatcher_host.h"
#include "content/shell/geolocation/shell_access_token_store.h" #include "content/shell/geolocation/shell_access_token_store.h"
#include "content/shell/layout_test_controller_host.h"
#include "content/shell/shell.h" #include "content/shell/shell.h"
#include "content/shell/shell_browser_context.h" #include "content/shell/shell_browser_context.h"
#include "content/shell/shell_browser_main_parts.h" #include "content/shell/shell_browser_main_parts.h"
#include "content/shell/shell_devtools_delegate.h" #include "content/shell/shell_devtools_delegate.h"
#include "content/shell/shell_resource_dispatcher_host_delegate.h" #include "content/shell/shell_resource_dispatcher_host_delegate.h"
#include "content/shell/shell_switches.h" #include "content/shell/shell_switches.h"
#include "content/shell/webkit_test_runner_host.h"
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -43,7 +43,7 @@ void ShellContentBrowserClient::RenderViewHostCreated( ...@@ -43,7 +43,7 @@ void ShellContentBrowserClient::RenderViewHostCreated(
RenderViewHost* render_view_host) { RenderViewHost* render_view_host) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
return; return;
new LayoutTestControllerHost(render_view_host); new WebKitTestRunnerHost(render_view_host);
} }
void ShellContentBrowserClient::AppendExtraCommandLineSwitches( void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include "content/shell/shell_content_renderer_client.h" #include "content/shell/shell_content_renderer_client.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "content/shell/layout_test_controller.h"
#include "content/shell/shell_render_process_observer.h" #include "content/shell/shell_render_process_observer.h"
#include "content/shell/shell_switches.h" #include "content/shell/shell_switches.h"
#include "content/shell/webkit_test_runner.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
namespace content { namespace content {
...@@ -26,7 +26,7 @@ void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { ...@@ -26,7 +26,7 @@ void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
return; return;
new LayoutTestController(render_view); new WebKitTestRunner(render_view);
} }
} // namespace content } // namespace content
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents_view.h"
#include "content/shell/layout_test_controller_host.h"
#include "content/shell/shell_javascript_dialog.h" #include "content/shell/shell_javascript_dialog.h"
#include "content/shell/shell_switches.h" #include "content/shell/shell_switches.h"
#include "content/shell/webkit_test_runner_host.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
namespace content { namespace content {
...@@ -87,8 +87,8 @@ void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog( ...@@ -87,8 +87,8 @@ void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog(
const DialogClosedCallback& callback) { const DialogClosedCallback& callback) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str()); printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str());
LayoutTestControllerHost* controller = WebKitTestRunnerHost* controller =
LayoutTestControllerHost::FromRenderViewHost( WebKitTestRunnerHost::FromRenderViewHost(
web_contents->GetRenderViewHost()); web_contents->GetRenderViewHost());
callback.Run( callback.Run(
!controller->should_stay_on_page_after_handling_before_unload(), !controller->should_stay_on_page_after_handling_before_unload(),
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "content/shell/layout_test_controller_bindings.h"
#include "content/shell/shell_switches.h" #include "content/shell/shell_switches.h"
#include "content/shell/webkit_test_runner_bindings.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
#include "webkit/support/gc_extension.h" #include "webkit/support/gc_extension.h"
...@@ -26,7 +26,7 @@ void ShellRenderProcessObserver::WebKitInitialized() { ...@@ -26,7 +26,7 @@ void ShellRenderProcessObserver::WebKitInitialized() {
// To implement a catch-all for not yet implemented controller properties. // To implement a catch-all for not yet implemented controller properties.
webkit_glue::SetJavaScriptFlags(" --harmony_proxies"); webkit_glue::SetJavaScriptFlags(" --harmony_proxies");
RenderThread::Get()->RegisterExtension(new LayoutTestControllerBindings()); RenderThread::Get()->RegisterExtension(new WebKitTestRunnerBindings());
// We always expose GC to layout tests. // We always expose GC to layout tests.
webkit_glue::SetJavaScriptFlags(" --expose-gc"); webkit_glue::SetJavaScriptFlags(" --expose-gc");
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<release seq="1"> <release seq="1">
<includes> <includes>
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="shell_devtools_discovery_page.html" type="BINDATA" /> <include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="shell_devtools_discovery_page.html" type="BINDATA" />
<include name="IDR_CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_JS" file="layout_test_controller.js" type="BINDATA" /> <include name="IDR_CONTENT_SHELL_WEBKIT_TEST_RUNNER_JS" file="webkit_test_runner.js" type="BINDATA" />
</includes> </includes>
</release> </release>
</grit> </grit>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/shell/layout_test_controller.h" #include "content/shell/webkit_test_runner.h"
#include "base/md5.h" #include "base/md5.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -137,25 +137,25 @@ void CaptureSnapshot(WebView* view, SkBitmap* snapshot) { ...@@ -137,25 +137,25 @@ void CaptureSnapshot(WebView* view, SkBitmap* snapshot) {
} // namespace } // namespace
LayoutTestController::LayoutTestController(RenderView* render_view) WebKitTestRunner::WebKitTestRunner(RenderView* render_view)
: RenderViewObserver(render_view) { : RenderViewObserver(render_view) {
} }
LayoutTestController::~LayoutTestController() { WebKitTestRunner::~WebKitTestRunner() {
} }
void LayoutTestController::DidClearWindowObject(WebFrame* frame) { void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
WebTestingSupport::injectInternalsObject(frame); WebTestingSupport::injectInternalsObject(frame);
} }
void LayoutTestController::DidFinishLoad(WebFrame* frame) { void WebKitTestRunner::DidFinishLoad(WebFrame* frame) {
if (!frame->parent()) if (!frame->parent())
Send(new ShellViewHostMsg_DidFinishLoad(routing_id())); Send(new ShellViewHostMsg_DidFinishLoad(routing_id()));
} }
bool LayoutTestController::OnMessageReceived(const IPC::Message& message) { bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(LayoutTestController, message) IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message)
IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureTextDump, OnCaptureTextDump) IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureTextDump, OnCaptureTextDump)
IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureImageDump, OnCaptureImageDump) IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureImageDump, OnCaptureImageDump)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
...@@ -164,7 +164,7 @@ bool LayoutTestController::OnMessageReceived(const IPC::Message& message) { ...@@ -164,7 +164,7 @@ bool LayoutTestController::OnMessageReceived(const IPC::Message& message) {
return handled; return handled;
} }
void LayoutTestController::OnCaptureTextDump(bool as_text, void WebKitTestRunner::OnCaptureTextDump(bool as_text,
bool printing, bool printing,
bool recursive) { bool recursive) {
WebFrame* frame = render_view()->GetWebView()->mainFrame(); WebFrame* frame = render_view()->GetWebView()->mainFrame();
...@@ -182,7 +182,7 @@ void LayoutTestController::OnCaptureTextDump(bool as_text, ...@@ -182,7 +182,7 @@ void LayoutTestController::OnCaptureTextDump(bool as_text,
Send(new ShellViewHostMsg_TextDump(routing_id(), dump)); Send(new ShellViewHostMsg_TextDump(routing_id(), dump));
} }
void LayoutTestController::OnCaptureImageDump( void WebKitTestRunner::OnCaptureImageDump(
const std::string& expected_pixel_hash) { const std::string& expected_pixel_hash) {
SkBitmap snapshot; SkBitmap snapshot;
CaptureSnapshot(render_view()->GetWebView(), &snapshot); CaptureSnapshot(render_view()->GetWebView(), &snapshot);
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_H_ #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_
#define CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_H_ #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_
#include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer.h"
namespace content { namespace content {
// This is the renderer side of the layout test controller. // This is the renderer side of the webkit test runner.
class LayoutTestController : public RenderViewObserver { class WebKitTestRunner : public RenderViewObserver {
public: public:
explicit LayoutTestController(RenderView* render_view); explicit WebKitTestRunner(RenderView* render_view);
virtual ~LayoutTestController(); virtual ~WebKitTestRunner();
// RenderViewObserver implementation. // RenderViewObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
...@@ -25,9 +25,9 @@ class LayoutTestController : public RenderViewObserver { ...@@ -25,9 +25,9 @@ class LayoutTestController : public RenderViewObserver {
void OnCaptureTextDump(bool as_text, bool printing, bool recursive); void OnCaptureTextDump(bool as_text, bool printing, bool recursive);
void OnCaptureImageDump(const std::string& expected_pixel_hash); void OnCaptureImageDump(const std::string& expected_pixel_hash);
DISALLOW_COPY_AND_ASSIGN(LayoutTestController); DISALLOW_COPY_AND_ASSIGN(WebKitTestRunner);
}; };
} // namespace content } // namespace content
#endif // CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_H_ #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_
...@@ -29,7 +29,7 @@ var textInputController = textInputController || {}; ...@@ -29,7 +29,7 @@ var textInputController = textInputController || {};
return Proxy.create(handler); return Proxy.create(handler);
} }
var LayoutTestController = function() { var TestRunner = function() {
Object.defineProperty(this, "notifyDone", {value: NotifyDone}); Object.defineProperty(this, "notifyDone", {value: NotifyDone});
Object.defineProperty(this, "dumpAsText", {value: SetDumpAsText}); Object.defineProperty(this, "dumpAsText", {value: SetDumpAsText});
Object.defineProperty(this, Object.defineProperty(this,
...@@ -42,8 +42,8 @@ var textInputController = textInputController || {}; ...@@ -42,8 +42,8 @@ var textInputController = textInputController || {};
{value: SetShouldStayOnPageAfterHandlingBeforeUnload}); {value: SetShouldStayOnPageAfterHandlingBeforeUnload});
Object.defineProperty(this, "waitUntilDone", {value: SetWaitUntilDone}); Object.defineProperty(this, "waitUntilDone", {value: SetWaitUntilDone});
} }
LayoutTestController.prototype = DefaultHandler("testRunner"); TestRunner.prototype = DefaultHandler("testRunner");
testRunner = new LayoutTestController(); testRunner = new TestRunner();
var AccessibilityController = function() {} var AccessibilityController = function() {}
AccessibilityController.prototype = DefaultHandler("accessibilityController"); AccessibilityController.prototype = DefaultHandler("accessibilityController");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/shell/layout_test_controller_bindings.h" #include "content/shell/webkit_test_runner_bindings.h"
#include "base/string_piece.h" #include "base/string_piece.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
...@@ -116,21 +116,21 @@ v8::Handle<v8::Value> NotImplemented(const v8::Arguments& args) { ...@@ -116,21 +116,21 @@ v8::Handle<v8::Value> NotImplemented(const v8::Arguments& args) {
} // namespace } // namespace
LayoutTestControllerBindings::LayoutTestControllerBindings() WebKitTestRunnerBindings::WebKitTestRunnerBindings()
: v8::Extension("layout_test_controller.js", : v8::Extension("webkit_test_runner.js",
GetStringResource( GetStringResource(
IDR_CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_JS).data(), IDR_CONTENT_SHELL_WEBKIT_TEST_RUNNER_JS).data(),
0, // num dependencies. 0, // num dependencies.
NULL, // dependencies array. NULL, // dependencies array.
GetStringResource( GetStringResource(
IDR_CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_JS).size()) { IDR_CONTENT_SHELL_WEBKIT_TEST_RUNNER_JS).size()) {
} }
LayoutTestControllerBindings::~LayoutTestControllerBindings() { WebKitTestRunnerBindings::~WebKitTestRunnerBindings() {
} }
v8::Handle<v8::FunctionTemplate> v8::Handle<v8::FunctionTemplate>
LayoutTestControllerBindings::GetNativeFunction(v8::Handle<v8::String> name) { WebKitTestRunnerBindings::GetNativeFunction(v8::Handle<v8::String> name) {
if (name->Equals(v8::String::New("NotifyDone"))) if (name->Equals(v8::String::New("NotifyDone")))
return v8::FunctionTemplate::New(NotifyDone); return v8::FunctionTemplate::New(NotifyDone);
if (name->Equals(v8::String::New("SetDumpAsText"))) if (name->Equals(v8::String::New("SetDumpAsText")))
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_BINDINGS_H_ #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_BINDINGS_H_
#define CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_BINDINGS_H_ #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_BINDINGS_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
...@@ -11,19 +11,19 @@ ...@@ -11,19 +11,19 @@
namespace content { namespace content {
class LayoutTestControllerBindings : public v8::Extension { class WebKitTestRunnerBindings : public v8::Extension {
public: public:
LayoutTestControllerBindings(); WebKitTestRunnerBindings();
virtual ~LayoutTestControllerBindings(); virtual ~WebKitTestRunnerBindings();
// v8::Extension implementation. // v8::Extension implementation.
virtual v8::Handle<v8::FunctionTemplate> virtual v8::Handle<v8::FunctionTemplate>
GetNativeFunction(v8::Handle<v8::String> name) OVERRIDE; GetNativeFunction(v8::Handle<v8::String> name) OVERRIDE;
private: private:
DISALLOW_COPY_AND_ASSIGN(LayoutTestControllerBindings); DISALLOW_COPY_AND_ASSIGN(WebKitTestRunnerBindings);
}; };
} // namespace content } // namespace content
#endif // CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_BINDINGS_H_ #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_BINDINGS_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/shell/layout_test_controller_host.h" #include "content/shell/webkit_test_runner_host.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/message_loop.h" #include "base/message_loop.h"
...@@ -17,14 +17,14 @@ namespace { ...@@ -17,14 +17,14 @@ namespace {
const int kTestTimeoutMilliseconds = 30 * 1000; const int kTestTimeoutMilliseconds = 30 * 1000;
} // namespace } // namespace
std::map<RenderViewHost*, LayoutTestControllerHost*> std::map<RenderViewHost*, WebKitTestRunnerHost*>
LayoutTestControllerHost::controllers_; WebKitTestRunnerHost::controllers_;
std::string LayoutTestControllerHost::expected_pixel_hash_; std::string WebKitTestRunnerHost::expected_pixel_hash_;
// static // static
LayoutTestControllerHost* LayoutTestControllerHost::FromRenderViewHost( WebKitTestRunnerHost* WebKitTestRunnerHost::FromRenderViewHost(
RenderViewHost* render_view_host) { RenderViewHost* render_view_host) {
const std::map<RenderViewHost*, LayoutTestControllerHost*>::iterator it = const std::map<RenderViewHost*, WebKitTestRunnerHost*>::iterator it =
controllers_.find(render_view_host); controllers_.find(render_view_host);
if (it == controllers_.end()) if (it == controllers_.end())
return NULL; return NULL;
...@@ -32,12 +32,12 @@ LayoutTestControllerHost* LayoutTestControllerHost::FromRenderViewHost( ...@@ -32,12 +32,12 @@ LayoutTestControllerHost* LayoutTestControllerHost::FromRenderViewHost(
} }
// static // static
void LayoutTestControllerHost::Init(const std::string& expected_pixel_hash) { void WebKitTestRunnerHost::Init(const std::string& expected_pixel_hash) {
// TODO(jochen): We should only dump the results for the "main window". // TODO(jochen): We should only dump the results for the "main window".
expected_pixel_hash_ = expected_pixel_hash; expected_pixel_hash_ = expected_pixel_hash;
} }
LayoutTestControllerHost::LayoutTestControllerHost( WebKitTestRunnerHost::WebKitTestRunnerHost(
RenderViewHost* render_view_host) RenderViewHost* render_view_host)
: RenderViewHostObserver(render_view_host), : RenderViewHostObserver(render_view_host),
captured_dump_(false), captured_dump_(false),
...@@ -49,12 +49,12 @@ LayoutTestControllerHost::LayoutTestControllerHost( ...@@ -49,12 +49,12 @@ LayoutTestControllerHost::LayoutTestControllerHost(
controllers_[render_view_host] = this; controllers_[render_view_host] = this;
} }
LayoutTestControllerHost::~LayoutTestControllerHost() { WebKitTestRunnerHost::~WebKitTestRunnerHost() {
controllers_.erase(render_view_host()); controllers_.erase(render_view_host());
watchdog_.Cancel(); watchdog_.Cancel();
} }
void LayoutTestControllerHost::CaptureDump() { void WebKitTestRunnerHost::CaptureDump() {
if (captured_dump_) if (captured_dump_)
return; return;
captured_dump_ = true; captured_dump_ = true;
...@@ -71,16 +71,16 @@ void LayoutTestControllerHost::CaptureDump() { ...@@ -71,16 +71,16 @@ void LayoutTestControllerHost::CaptureDump() {
} }
} }
void LayoutTestControllerHost::TimeoutHandler() { void WebKitTestRunnerHost::TimeoutHandler() {
printf("FAIL: Timed out waiting for notifyDone to be called\n"); printf("FAIL: Timed out waiting for notifyDone to be called\n");
fprintf(stderr, "FAIL: Timed out waiting for notifyDone to be called\n"); fprintf(stderr, "FAIL: Timed out waiting for notifyDone to be called\n");
CaptureDump(); CaptureDump();
} }
bool LayoutTestControllerHost::OnMessageReceived( bool WebKitTestRunnerHost::OnMessageReceived(
const IPC::Message& message) { const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(LayoutTestControllerHost, message) IPC_BEGIN_MESSAGE_MAP(WebKitTestRunnerHost, message)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad) IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump)
...@@ -100,14 +100,14 @@ bool LayoutTestControllerHost::OnMessageReceived( ...@@ -100,14 +100,14 @@ bool LayoutTestControllerHost::OnMessageReceived(
return handled; return handled;
} }
void LayoutTestControllerHost::OnDidFinishLoad() { void WebKitTestRunnerHost::OnDidFinishLoad() {
if (wait_until_done_) if (wait_until_done_)
return; return;
CaptureDump(); CaptureDump();
} }
void LayoutTestControllerHost::OnTextDump(const std::string& dump) { void WebKitTestRunnerHost::OnTextDump(const std::string& dump) {
printf("%s#EOF\n", dump.c_str()); printf("%s#EOF\n", dump.c_str());
fprintf(stderr, "#EOF\n"); fprintf(stderr, "#EOF\n");
...@@ -115,7 +115,7 @@ void LayoutTestControllerHost::OnTextDump(const std::string& dump) { ...@@ -115,7 +115,7 @@ void LayoutTestControllerHost::OnTextDump(const std::string& dump) {
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
} }
void LayoutTestControllerHost::OnImageDump( void WebKitTestRunnerHost::OnImageDump(
const std::string& actual_pixel_hash, const std::string& actual_pixel_hash,
const SkBitmap& image) { const SkBitmap& image) {
SkAutoLockPixels image_lock(image); SkAutoLockPixels image_lock(image);
...@@ -166,35 +166,35 @@ void LayoutTestControllerHost::OnImageDump( ...@@ -166,35 +166,35 @@ void LayoutTestControllerHost::OnImageDump(
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
} }
void LayoutTestControllerHost::OnNotifyDone() { void WebKitTestRunnerHost::OnNotifyDone() {
if (!wait_until_done_) if (!wait_until_done_)
return; return;
watchdog_.Cancel(); watchdog_.Cancel();
CaptureDump(); CaptureDump();
} }
void LayoutTestControllerHost::OnDumpAsText() { void WebKitTestRunnerHost::OnDumpAsText() {
dump_as_text_ = true; dump_as_text_ = true;
} }
void LayoutTestControllerHost::OnSetPrinting() { void WebKitTestRunnerHost::OnSetPrinting() {
is_printing_ = true; is_printing_ = true;
} }
void LayoutTestControllerHost::OnSetShouldStayOnPageAfterHandlingBeforeUnload( void WebKitTestRunnerHost::OnSetShouldStayOnPageAfterHandlingBeforeUnload(
bool should_stay_on_page) { bool should_stay_on_page) {
should_stay_on_page_after_handling_before_unload_ = should_stay_on_page; should_stay_on_page_after_handling_before_unload_ = should_stay_on_page;
} }
void LayoutTestControllerHost::OnDumpChildFramesAsText() { void WebKitTestRunnerHost::OnDumpChildFramesAsText() {
dump_child_frames_ = true; dump_child_frames_ = true;
} }
void LayoutTestControllerHost::OnWaitUntilDone() { void WebKitTestRunnerHost::OnWaitUntilDone() {
if (wait_until_done_) if (wait_until_done_)
return; return;
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoTimeout)) { if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoTimeout)) {
watchdog_.Reset(base::Bind(&LayoutTestControllerHost::TimeoutHandler, watchdog_.Reset(base::Bind(&WebKitTestRunnerHost::TimeoutHandler,
base::Unretained(this))); base::Unretained(this)));
MessageLoop::current()->PostDelayedTask( MessageLoop::current()->PostDelayedTask(
FROM_HERE, FROM_HERE,
...@@ -204,7 +204,7 @@ void LayoutTestControllerHost::OnWaitUntilDone() { ...@@ -204,7 +204,7 @@ void LayoutTestControllerHost::OnWaitUntilDone() {
wait_until_done_ = true; wait_until_done_ = true;
} }
void LayoutTestControllerHost::OnNotImplemented( void WebKitTestRunnerHost::OnNotImplemented(
const std::string& object_name, const std::string& object_name,
const std::string& property_name) { const std::string& property_name) {
if (captured_dump_) if (captured_dump_)
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_ #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_
#define CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_ #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_
#include <map> #include <map>
#include <string> #include <string>
...@@ -15,16 +15,16 @@ class SkBitmap; ...@@ -15,16 +15,16 @@ class SkBitmap;
namespace content { namespace content {
class LayoutTestControllerHost : public RenderViewHostObserver { class WebKitTestRunnerHost : public RenderViewHostObserver {
public: public:
static LayoutTestControllerHost* FromRenderViewHost( static WebKitTestRunnerHost* FromRenderViewHost(
RenderViewHost* render_view_host); RenderViewHost* render_view_host);
// Initialize the LayoutTestControllerHost for a given test. // Initialize the WebKitTestRunnerHost for a given test.
static void Init(const std::string& expected_pixel_hash); static void Init(const std::string& expected_pixel_hash);
explicit LayoutTestControllerHost(RenderViewHost* render_view_host); explicit WebKitTestRunnerHost(RenderViewHost* render_view_host);
virtual ~LayoutTestControllerHost(); virtual ~WebKitTestRunnerHost();
bool should_stay_on_page_after_handling_before_unload() const { bool should_stay_on_page_after_handling_before_unload() const {
return should_stay_on_page_after_handling_before_unload_; return should_stay_on_page_after_handling_before_unload_;
...@@ -53,7 +53,7 @@ class LayoutTestControllerHost : public RenderViewHostObserver { ...@@ -53,7 +53,7 @@ class LayoutTestControllerHost : public RenderViewHostObserver {
void OnNotImplemented(const std::string& object_name, void OnNotImplemented(const std::string& object_name,
const std::string& method_name); const std::string& method_name);
static std::map<RenderViewHost*, LayoutTestControllerHost*> controllers_; static std::map<RenderViewHost*, WebKitTestRunnerHost*> controllers_;
static std::string expected_pixel_hash_; static std::string expected_pixel_hash_;
bool captured_dump_; bool captured_dump_;
...@@ -66,9 +66,9 @@ class LayoutTestControllerHost : public RenderViewHostObserver { ...@@ -66,9 +66,9 @@ class LayoutTestControllerHost : public RenderViewHostObserver {
base::CancelableClosure watchdog_; base::CancelableClosure watchdog_;
DISALLOW_COPY_AND_ASSIGN(LayoutTestControllerHost); DISALLOW_COPY_AND_ASSIGN(WebKitTestRunnerHost);
}; };
} // namespace content } // namespace content
#endif // CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_ #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment