summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/content_shell.gypi2
-rw-r--r--content/public/renderer/render_view.h5
-rw-r--r--content/public/renderer/render_view_observer.h4
-rw-r--r--content/renderer/render_view_impl.cc16
-rw-r--r--content/renderer/render_view_impl.h3
-rw-r--r--content/shell/DEPS3
-rw-r--r--content/shell/shell_messages.h11
-rw-r--r--content/shell/shell_render_process_observer.cc64
-rw-r--r--content/shell/shell_render_process_observer.h25
-rw-r--r--content/shell/webkit_test_runner.cc114
-rw-r--r--content/shell/webkit_test_runner.h32
-rw-r--r--content/shell/webkit_test_runner.js20
-rw-r--r--content/shell/webkit_test_runner_host.cc24
-rw-r--r--content/shell/webkit_test_runner_host.h5
14 files changed, 298 insertions, 30 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index b47450c..deabfdd 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -39,6 +39,7 @@
'../webkit/support/webkit_support.gyp:webkit_support',
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit_test_support',
+ '<(webkit_src_dir)/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:TestRunner',
],
'include_dirs': [
'..',
@@ -286,7 +287,6 @@
'content_shell_lib',
'content_shell_pak',
'../third_party/mesa/mesa.gyp:osmesa',
- '<(webkit_src_dir)/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:TestRunner_resources',
],
'include_dirs': [
'..',
diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h
index a128445..aaa719c 100644
--- a/content/public/renderer/render_view.h
+++ b/content/public/renderer/render_view.h
@@ -146,6 +146,11 @@ class CONTENT_EXPORT RenderView : public IPC::Sender {
// passed in.
virtual void Repaint(const gfx::Size& size) = 0;
+ // Inject edit commands to be used for the next keyboard event.
+ virtual void SetEditCommandForNextKeyEvent(const std::string& name,
+ const std::string& value) = 0;
+ virtual void ClearEditCommands() = 0;
+
protected:
virtual ~RenderView() {}
};
diff --git a/content/public/renderer/render_view_observer.h b/content/public/renderer/render_view_observer.h
index 6999159..b3f63b9 100644
--- a/content/public/renderer/render_view_observer.h
+++ b/content/public/renderer/render_view_observer.h
@@ -27,6 +27,7 @@ class WebMouseEvent;
class WebNode;
class WebTouchEvent;
class WebURL;
+struct WebContextMenuData;
struct WebURLError;
}
@@ -82,6 +83,9 @@ class CONTENT_EXPORT RenderViewObserver : public IPC::Listener,
virtual void ZoomLevelChanged() {};
virtual void DidChangeScrollOffset(WebKit::WebFrame* frame) {}
virtual void DraggableRegionsChanged(WebKit::WebFrame* frame) {}
+ virtual void DidRequestShowContextMenu(
+ WebKit::WebFrame* frame,
+ const WebKit::WebContextMenuData& data) {}
// These match the RenderView methods.
virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index cbd27af..c834903 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2169,6 +2169,9 @@ void RenderViewImpl::showContextMenu(
#endif
Send(new ViewHostMsg_ContextMenu(routing_id_, params));
+
+ FOR_EACH_OBSERVER(
+ RenderViewObserver, observers_, DidRequestShowContextMenu(frame, data));
}
void RenderViewImpl::setStatusText(const WebString& text) {
@@ -2639,6 +2642,17 @@ void RenderViewImpl::Repaint(const gfx::Size& size) {
OnMsgRepaint(size);
}
+void RenderViewImpl::SetEditCommandForNextKeyEvent(const std::string& name,
+ const std::string& value) {
+ EditCommands edit_commands;
+ edit_commands.push_back(EditCommand(name, value));
+ OnSetEditCommandsForNextKeyEvent(edit_commands);
+}
+
+void RenderViewImpl::ClearEditCommands() {
+ edit_commands_.clear();
+}
+
void RenderViewImpl::loadURLExternally(
WebFrame* frame, const WebURLRequest& request,
WebNavigationPolicy policy,
@@ -5625,7 +5639,7 @@ void RenderViewImpl::Close() {
}
void RenderViewImpl::DidHandleKeyEvent() {
- edit_commands_.clear();
+ ClearEditCommands();
}
bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 4bf249c..8467f3d 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -692,6 +692,9 @@ class RenderViewImpl : public RenderWidget,
const WebKit::WebURLRequest& request,
WebKit::WebNavigationPolicy policy) OVERRIDE;
virtual void Repaint(const gfx::Size& size) OVERRIDE;
+ virtual void SetEditCommandForNextKeyEvent(const std::string& name,
+ const std::string& value) OVERRIDE;
+ virtual void ClearEditCommands() OVERRIDE;
// webkit_glue::WebPluginPageDelegate implementation -------------------------
diff --git a/content/shell/DEPS b/content/shell/DEPS
index 82e5b11..64bcfea 100644
--- a/content/shell/DEPS
+++ b/content/shell/DEPS
@@ -19,4 +19,7 @@ include_rules = [
# The content_shell for aura must work with the views and aura
"+ui/aura",
"+ui/views",
+
+ # For WebTestRunner library
+ "+third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public",
]
diff --git a/content/shell/shell_messages.h b/content/shell/shell_messages.h
index 53840c5..4a21136 100644
--- a/content/shell/shell_messages.h
+++ b/content/shell/shell_messages.h
@@ -23,6 +23,13 @@ IPC_MESSAGE_ROUTED3(ShellViewMsg_CaptureTextDump,
IPC_MESSAGE_ROUTED1(ShellViewMsg_CaptureImageDump,
std::string /* expected pixel hash */)
+// Tells the render view that it should register itself as main window for the
+// layout test.
+IPC_MESSAGE_ROUTED0(ShellViewMsg_SetIsMainWindow)
+
+// Tells the renderer to reset all test runners.
+IPC_MESSAGE_CONTROL0(ShellViewMsg_ResetAll)
+
// Send a text dump of the WebContents to the render host.
IPC_MESSAGE_ROUTED1(ShellViewHostMsg_TextDump,
std::string /* dump */)
@@ -35,6 +42,10 @@ IPC_MESSAGE_ROUTED2(ShellViewHostMsg_ImageDump,
// The main frame of the render view finished loading.
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_DidFinishLoad)
+// Print a message from a layout test runner.
+IPC_MESSAGE_ROUTED1(ShellViewHostMsg_PrintMessage,
+ std::string /* message */)
+
// The following messages correspond to methods of the testRunner.
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_NotifyDone)
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_DumpAsText)
diff --git a/content/shell/shell_render_process_observer.cc b/content/shell/shell_render_process_observer.cc
index 25f4f95..250c911 100644
--- a/content/shell/shell_render_process_observer.cc
+++ b/content/shell/shell_render_process_observer.cc
@@ -5,19 +5,63 @@
#include "content/shell/shell_render_process_observer.h"
#include "base/command_line.h"
+#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_thread.h"
+#include "content/shell/shell_messages.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"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h"
+#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h"
+
+using WebKit::WebFrame;
+using WebKit::WebTestingSupport;
+using WebTestRunner::WebTestDelegate;
+using WebTestRunner::WebTestInterfaces;
namespace content {
-ShellRenderProcessObserver::ShellRenderProcessObserver() {
+namespace {
+ShellRenderProcessObserver* g_instance = NULL;
+}
+
+// static
+ShellRenderProcessObserver* ShellRenderProcessObserver::GetInstance() {
+ return g_instance;
+}
+
+ShellRenderProcessObserver::ShellRenderProcessObserver()
+ : test_delegate_(NULL) {
+ CHECK(!g_instance);
+ g_instance = this;
RenderThread::Get()->AddObserver(this);
}
ShellRenderProcessObserver::~ShellRenderProcessObserver() {
+ CHECK(g_instance == this);
+ g_instance = NULL;
+}
+
+void ShellRenderProcessObserver::SetMainWindow(
+ RenderView* view,
+ WebTestDelegate* delegate) {
+ if (view == NULL) {
+ if (delegate == test_delegate_) {
+ test_interfaces_->setDelegate(NULL);
+ test_interfaces_->setWebView(NULL);
+ test_delegate_ = NULL;
+ }
+ } else {
+ test_interfaces_->setDelegate(delegate);
+ test_interfaces_->setWebView(view->GetWebView());
+ test_delegate_ = delegate;
+ }
+}
+
+void ShellRenderProcessObserver::BindTestRunnersToWindow(WebFrame* frame) {
+ WebTestingSupport::injectInternalsObject(frame);
+ test_interfaces_->bindTo(frame);
}
void ShellRenderProcessObserver::WebKitInitialized() {
@@ -31,6 +75,24 @@ void ShellRenderProcessObserver::WebKitInitialized() {
// We always expose GC to layout tests.
webkit_glue::SetJavaScriptFlags(" --expose-gc");
RenderThread::Get()->RegisterExtension(extensions_v8::GCExtension::Get());
+
+ test_interfaces_.reset(new WebTestInterfaces);
+}
+
+bool ShellRenderProcessObserver::OnControlMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(ShellRenderProcessObserver, message)
+ IPC_MESSAGE_HANDLER(ShellViewMsg_ResetAll, OnResetAll)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
+}
+
+void ShellRenderProcessObserver::OnResetAll() {
+ test_interfaces_->resetAll();
+ // We don't reset the WebTestingSupport objects, as we don't reuse WebViews.
}
} // namespace content
diff --git a/content/shell/shell_render_process_observer.h b/content/shell/shell_render_process_observer.h
index 1b50ed7..b802100 100644
--- a/content/shell/shell_render_process_observer.h
+++ b/content/shell/shell_render_process_observer.h
@@ -7,19 +7,44 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "content/public/renderer/render_process_observer.h"
+namespace WebKit {
+class WebFrame;
+}
+
+namespace WebTestRunner {
+class WebTestDelegate;
+class WebTestInterfaces;
+}
+
namespace content {
+class RenderView;
+
class ShellRenderProcessObserver : public RenderProcessObserver {
public:
+ static ShellRenderProcessObserver* GetInstance();
+
ShellRenderProcessObserver();
virtual ~ShellRenderProcessObserver();
+ void SetMainWindow(RenderView* view,
+ WebTestRunner::WebTestDelegate* delegate);
+ void BindTestRunnersToWindow(WebKit::WebFrame* frame);
+
// RenderProcessObserver implementation.
virtual void WebKitInitialized() OVERRIDE;
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
private:
+ // Message handlers.
+ void OnResetAll();
+
+ scoped_ptr<WebTestRunner::WebTestInterfaces> test_interfaces_;
+ WebTestRunner::WebTestDelegate* test_delegate_;
+
DISALLOW_COPY_AND_ASSIGN(ShellRenderProcessObserver);
};
diff --git a/content/shell/webkit_test_runner.cc b/content/shell/webkit_test_runner.cc
index 9970b39..9a617f2 100644
--- a/content/shell/webkit_test_runner.cc
+++ b/content/shell/webkit_test_runner.cc
@@ -6,32 +6,48 @@
#include "base/md5.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop.h"
#include "base/stringprintf.h"
+#include "base/time.h"
#include "content/public/renderer/render_view.h"
#include "content/shell/shell_messages.h"
+#include "content/shell/shell_render_process_observer.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h"
#include "webkit/glue/webkit_glue.h"
-using WebKit::WebFrame;
+using WebKit::WebContextMenuData;
using WebKit::WebElement;
+using WebKit::WebFrame;
+using WebKit::WebGamepads;
using WebKit::WebRect;
using WebKit::WebSize;
-using WebKit::WebTestingSupport;
+using WebKit::WebString;
+using WebKit::WebVector;
using WebKit::WebView;
+using WebTestRunner::WebTask;
namespace content {
namespace {
+void InvokeTaskHelper(void* context) {
+ WebTask* task = reinterpret_cast<WebTask*>(context);
+ task->run();
+ delete task;
+}
+
std::string DumpDocumentText(WebFrame* frame) {
// We use the document element's text instead of the body text here because
// not all documents have a body, such as XML documents.
@@ -138,14 +154,88 @@ void CaptureSnapshot(WebView* view, SkBitmap* snapshot) {
} // namespace
WebKitTestRunner::WebKitTestRunner(RenderView* render_view)
- : RenderViewObserver(render_view) {
+ : RenderViewObserver(render_view),
+ is_main_window_(false) {
}
WebKitTestRunner::~WebKitTestRunner() {
+ if (is_main_window_)
+ ShellRenderProcessObserver::GetInstance()->SetMainWindow(NULL, this);
+}
+
+// WebTestDelegate -----------------------------------------------------------
+
+void WebKitTestRunner::clearContextMenuData() {
+ last_context_menu_data_.reset();
+}
+
+WebContextMenuData* WebKitTestRunner::lastContextMenuData() const {
+ return last_context_menu_data_.get();
+}
+
+void WebKitTestRunner::clearEditCommand() {
+ render_view()->ClearEditCommands();
+}
+
+void WebKitTestRunner::setEditCommand(const std::string& name,
+ const std::string& value) {
+ render_view()->SetEditCommandForNextKeyEvent(name, value);
+}
+
+void WebKitTestRunner::fillSpellingSuggestionList(
+ const WebString& word, WebVector<WebString>* suggestions) {
+ if (word == WebString::fromUTF8("wellcome")) {
+ WebVector<WebString> result(suggestions->size() + 1);
+ for (size_t i = 0; i < suggestions->size(); ++i)
+ result[i] = (*suggestions)[i];
+ result[suggestions->size()] = WebString::fromUTF8("welcome");
+ suggestions->swap(result);
+ }
+}
+
+void WebKitTestRunner::setGamepadData(const WebGamepads& gamepads) {
+ Send(new ShellViewHostMsg_NotImplemented(
+ routing_id(), "WebTestDelegate", "setGamepadData"));
}
+void WebKitTestRunner::printMessage(const std::string& message) {
+ Send(new ShellViewHostMsg_PrintMessage(routing_id(), message));
+}
+
+void WebKitTestRunner::postTask(WebTask* task) {
+ WebKit::webKitPlatformSupport()->callOnMainThread(InvokeTaskHelper, task);
+}
+
+void WebKitTestRunner::postDelayedTask(WebTask* task, long long ms) {
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&WebTask::run, base::Owned(task)),
+ base::TimeDelta::FromMilliseconds(ms));
+}
+
+WebString WebKitTestRunner::registerIsolatedFileSystem(
+ const WebKit::WebVector<WebKit::WebString>& absolute_filenames) {
+ Send(new ShellViewHostMsg_NotImplemented(
+ routing_id(), "WebTestDelegate", "registerIsolatedFileSystem"));
+ return WebString();
+}
+
+long long WebKitTestRunner::getCurrentTimeInMillisecond() {
+ return base::TimeTicks::Now().ToInternalValue() /
+ base::Time::kMicrosecondsPerMillisecond;
+}
+
+WebString WebKitTestRunner::getAbsoluteWebStringFromUTF8Path(
+ const std::string& utf8_path) {
+ Send(new ShellViewHostMsg_NotImplemented(
+ routing_id(), "WebTestDelegate", "getAbsoluteWebStringFromUTF8Path"));
+ return WebString();
+}
+
+// RenderViewObserver --------------------------------------------------------
+
void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
- WebTestingSupport::injectInternalsObject(frame);
+ ShellRenderProcessObserver::GetInstance()->BindTestRunnersToWindow(frame);
}
void WebKitTestRunner::DidFinishLoad(WebFrame* frame) {
@@ -153,17 +243,26 @@ void WebKitTestRunner::DidFinishLoad(WebFrame* frame) {
Send(new ShellViewHostMsg_DidFinishLoad(routing_id()));
}
+void WebKitTestRunner::DidRequestShowContextMenu(
+ WebFrame* frame,
+ const WebContextMenuData& data) {
+ last_context_menu_data_.reset(new WebContextMenuData(data));
+}
+
bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message)
IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureTextDump, OnCaptureTextDump)
IPC_MESSAGE_HANDLER(ShellViewMsg_CaptureImageDump, OnCaptureImageDump)
+ IPC_MESSAGE_HANDLER(ShellViewMsg_SetIsMainWindow, OnSetIsMainWindow)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+// Private methods -----------------------------------------------------------
+
void WebKitTestRunner::OnCaptureTextDump(bool as_text,
bool printing,
bool recursive) {
@@ -217,4 +316,9 @@ void WebKitTestRunner::OnCaptureImageDump(
routing_id(), actual_pixel_hash, snapshot));
}
+void WebKitTestRunner::OnSetIsMainWindow() {
+ is_main_window_ = true;
+ ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view(), this);
+}
+
} // namespace content
diff --git a/content/shell/webkit_test_runner.h b/content/shell/webkit_test_runner.h
index 539ed09..c6482d0 100644
--- a/content/shell/webkit_test_runner.h
+++ b/content/shell/webkit_test_runner.h
@@ -5,12 +5,15 @@
#ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_
#define CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_
+#include "base/memory/scoped_ptr.h"
#include "content/public/renderer/render_view_observer.h"
+#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h"
namespace content {
// This is the renderer side of the webkit test runner.
-class WebKitTestRunner : public RenderViewObserver {
+class WebKitTestRunner : public RenderViewObserver,
+ public WebTestRunner::WebTestDelegate {
public:
explicit WebKitTestRunner(RenderView* render_view);
virtual ~WebKitTestRunner();
@@ -19,11 +22,38 @@ class WebKitTestRunner : public RenderViewObserver {
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE;
+ virtual void DidRequestShowContextMenu(
+ WebKit::WebFrame* frame,
+ const WebKit::WebContextMenuData& data) OVERRIDE;
+
+ // WebTestDelegate implementation.
+ virtual void clearContextMenuData() OVERRIDE;
+ virtual void clearEditCommand() OVERRIDE;
+ virtual void fillSpellingSuggestionList(
+ const WebKit::WebString& word,
+ WebKit::WebVector<WebKit::WebString>* suggestions) OVERRIDE;
+ virtual void setEditCommand(const std::string& name,
+ const std::string& value) OVERRIDE;
+ virtual WebKit::WebContextMenuData* lastContextMenuData() const OVERRIDE;
+ virtual void setGamepadData(const WebKit::WebGamepads& gamepads) OVERRIDE;
+ virtual void printMessage(const std::string& message) OVERRIDE;
+ virtual void postTask(WebTestRunner::WebTask* task) OVERRIDE;
+ virtual void postDelayedTask(WebTestRunner::WebTask* task,
+ long long ms) OVERRIDE;
+ virtual WebKit::WebString registerIsolatedFileSystem(
+ const WebKit::WebVector<WebKit::WebString>& absolute_filenames) OVERRIDE;
+ virtual long long getCurrentTimeInMillisecond() OVERRIDE;
+ virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(
+ const std::string& utf8_path) OVERRIDE;
private:
// Message handlers.
void OnCaptureTextDump(bool as_text, bool printing, bool recursive);
void OnCaptureImageDump(const std::string& expected_pixel_hash);
+ void OnSetIsMainWindow();
+
+ scoped_ptr<WebKit::WebContextMenuData> last_context_menu_data_;
+ bool is_main_window_;
DISALLOW_COPY_AND_ASSIGN(WebKitTestRunner);
};
diff --git a/content/shell/webkit_test_runner.js b/content/shell/webkit_test_runner.js
index 8865ec9..241f6a1 100644
--- a/content/shell/webkit_test_runner.js
+++ b/content/shell/webkit_test_runner.js
@@ -3,10 +3,6 @@
// found in the LICENSE file.
var testRunner = testRunner || {};
-var accessibilityController = accessibilityController || {};
-var gamepadController = gamepadController || {};
-var eventSender = eventSender || {};
-var textInputController = textInputController || {};
(function() {
native function GetWorkerThreadCount();
@@ -55,20 +51,4 @@ var textInputController = textInputController || {};
}
TestRunner.prototype = DefaultHandler("testRunner");
testRunner = new TestRunner();
-
- var AccessibilityController = function() {}
- AccessibilityController.prototype = DefaultHandler("accessibilityController");
- accessibilityController = new AccessibilityController();
-
- var GamepadController = function() {}
- GamepadController.prototype = DefaultHandler("gamepadController");
- gamepadController = new GamepadController();
-
- var EventSender = function() {}
- EventSender.prototype = DefaultHandler("eventSender");
- eventSender = new EventSender();
-
- var TextInputController = function() {}
- TextInputController.prototype = DefaultHandler("textInputController");
- textInputController = new TextInputController();
})();
diff --git a/content/shell/webkit_test_runner_host.cc b/content/shell/webkit_test_runner_host.cc
index 03ca79e..74fe85e 100644
--- a/content/shell/webkit_test_runner_host.cc
+++ b/content/shell/webkit_test_runner_host.cc
@@ -93,9 +93,13 @@ void WebKitTestResultPrinter::PrintImageFooter() {
}
void WebKitTestResultPrinter::AddMessage(const std::string& message) {
+ AddMessageRaw(message + "\n");
+}
+
+void WebKitTestResultPrinter::AddMessageRaw(const std::string& message) {
if (state_ != IN_TEXT_BLOCK)
return;
- *output_ << message << "\n";
+ *output_ << message;
}
void WebKitTestResultPrinter::AddErrorMessage(const std::string& message) {
@@ -152,6 +156,7 @@ bool WebKitTestController::PrepareForLayoutTest(
NULL,
MSG_ROUTING_NONE,
NULL);
+ did_set_as_main_window_ = false;
Observe(main_window_->web_contents());
return true;
}
@@ -168,12 +173,14 @@ bool WebKitTestController::ResetAfterLayoutTest() {
is_printing_ = false;
should_stay_on_page_after_handling_before_unload_ = false;
wait_until_done_ = false;
+ did_set_as_main_window_ = false;
watchdog_.Cancel();
if (main_window_) {
Observe(NULL);
main_window_ = NULL;
}
Shell::CloseAllWindows();
+ Send(new ShellViewMsg_ResetAll);
return true;
}
@@ -214,6 +221,7 @@ bool WebKitTestController::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebKitTestController, message)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_DidFinishLoad, OnDidFinishLoad)
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -226,6 +234,16 @@ void WebKitTestController::PluginCrashed(const FilePath& plugin_path) {
printer_->AddErrorMessage("#CRASHED - plugin");
}
+void WebKitTestController::RenderViewReady() {
+ if (did_set_as_main_window_)
+ return;
+ RenderViewHost* render_view_host =
+ main_window_->web_contents()->GetRenderViewHost();
+ render_view_host->Send(new ShellViewMsg_SetIsMainWindow(
+ render_view_host->GetRoutingID()));
+ did_set_as_main_window_ = true;
+}
+
void WebKitTestController::RenderViewGone(base::TerminationStatus status) {
printer_->AddErrorMessage("#CRASHED - renderer");
}
@@ -321,6 +339,10 @@ void WebKitTestController::OnTextDump(const std::string& dump) {
}
}
+void WebKitTestController::OnPrintMessage(const std::string& message) {
+ printer_->AddMessageRaw(message);
+}
+
// WebKitTestRunnerHost -------------------------------------------------------
WebKitTestRunnerHost::WebKitTestRunnerHost(
diff --git a/content/shell/webkit_test_runner_host.h b/content/shell/webkit_test_runner_host.h
index d5022e2..8616be6 100644
--- a/content/shell/webkit_test_runner_host.h
+++ b/content/shell/webkit_test_runner_host.h
@@ -42,6 +42,7 @@ class WebKitTestResultPrinter {
void PrintImageFooter();
void AddMessage(const std::string& message);
+ void AddMessageRaw(const std::string& message);
void AddErrorMessage(const std::string& message);
private:
@@ -108,6 +109,7 @@ class WebKitTestController : public base::NonThreadSafe,
// WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE;
+ virtual void RenderViewReady() OVERRIDE;
virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
@@ -121,6 +123,7 @@ class WebKitTestController : public base::NonThreadSafe,
void OnDidFinishLoad();
void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image);
void OnTextDump(const std::string& dump);
+ void OnPrintMessage(const std::string& message);
scoped_ptr<WebKitTestResultPrinter> printer_;
@@ -137,6 +140,8 @@ class WebKitTestController : public base::NonThreadSafe,
bool should_stay_on_page_after_handling_before_unload_;
bool wait_until_done_;
+ bool did_set_as_main_window_;
+
base::CancelableClosure watchdog_;
DISALLOW_COPY_AND_ASSIGN(WebKitTestController);