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