Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: content/shell/shell_content_renderer_client.cc

Issue 12258047: [content shell] Use the TestRunner library again and remove the mock testRunner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/shell_content_renderer_client.h ('k') | content/shell/shell_render_process_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/shell/shell_content_renderer_client.h ('k') | content/shell/shell_render_process_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698