Index: content/shell/shell_content_renderer_client.cc |
diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc |
index 01905b7699b240df8484b46dc472efda53a15f36..c22b9e670ddde923a426fab208f0876242a02ba4 100644 |
--- a/content/shell/shell_content_renderer_client.cc |
+++ b/content/shell/shell_content_renderer_client.cc |
@@ -9,44 +9,29 @@ |
#include "base/debug/debugger.h" |
#include "content/public/common/content_constants.h" |
#include "content/public/common/content_switches.h" |
-#include "content/public/common/url_constants.h" |
#include "content/public/renderer/render_view.h" |
#include "content/public/test/layouttest_support.h" |
#include "content/shell/shell_render_process_observer.h" |
#include "content/shell/shell_switches.h" |
#include "content/shell/webkit_test_runner.h" |
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h" |
#include "v8/include/v8.h" |
using WebKit::WebFrame; |
+using WebKit::WebPlugin; |
+using WebKit::WebPluginParams; |
using WebTestRunner::WebTestProxyBase; |
namespace content { |
-namespace { |
- |
-bool IsLocalhost(const std::string& host) { |
- return host == "127.0.0.1" || host == "localhost"; |
-} |
- |
-bool HostIsUsedBySomeTestsToGenerateError(const std::string& host) { |
- return host == "255.255.255.255"; |
-} |
- |
-bool IsExternalPage(const GURL& url) { |
- return !url.host().empty() && |
- (url.SchemeIs(chrome::kHttpScheme) || |
- url.SchemeIs(chrome::kHttpsScheme)) && |
- !IsLocalhost(url.host()) && |
- !HostIsUsedBySomeTestsToGenerateError(url.host()); |
-} |
- |
-} // namespace |
- |
ShellContentRendererClient::ShellContentRendererClient() { |
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
+ EnableWebTestProxyCreation( |
+ base::Bind(&ShellContentRendererClient::WebTestProxyCreated, |
+ base::Unretained(this))); |
+ } |
} |
ShellContentRendererClient::~ShellContentRendererClient() { |
@@ -61,22 +46,11 @@ void ShellContentRendererClient::RenderThreadStarted() { |
#endif |
} |
-void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { |
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
- return; |
- WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); |
- if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) { |
- ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view, |
- test_runner, |
- test_runner); |
- } |
-} |
- |
bool ShellContentRendererClient::OverrideCreatePlugin( |
RenderView* render_view, |
- WebKit::WebFrame* frame, |
- const WebKit::WebPluginParams& params, |
- WebKit::WebPlugin** plugin) { |
+ WebFrame* frame, |
+ const WebPluginParams& params, |
+ WebPlugin** plugin) { |
std::string mime_type = params.mimeType.utf8(); |
if (mime_type == content::kBrowserPluginMimeType) { |
// Allow browser plugin in content_shell only if it is forced by flag. |
@@ -87,4 +61,20 @@ bool ShellContentRendererClient::OverrideCreatePlugin( |
return false; |
} |
+void ShellContentRendererClient::WebTestProxyCreated(RenderView* render_view, |
+ WebTestProxyBase* proxy) { |
+ WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); |
+ test_runner->set_proxy(proxy); |
+ render_view->GetWebView()->setSpellCheckClient(proxy->spellCheckClient()); |
+ if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) { |
+ ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view, |
+ test_runner, |
+ test_runner); |
+ } |
+ proxy->setDelegate( |
+ ShellRenderProcessObserver::GetInstance()->test_delegate()); |
+ proxy->setInterfaces( |
+ ShellRenderProcessObserver::GetInstance()->test_interfaces()); |
+} |
+ |
} // namespace content |