summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/public/test/layouttest_support.h33
-rw-r--r--content/renderer/devtools/devtools_client.cc13
-rw-r--r--content/renderer/devtools/devtools_client.h1
-rw-r--r--content/renderer/render_thread_impl.cc4
-rw-r--r--content/renderer/render_thread_impl.h35
-rw-r--r--content/renderer/render_view_impl.cc6
-rw-r--r--content/renderer/render_widget.cc6
-rw-r--r--content/renderer/renderer_webapplicationcachehost_impl.cc9
-rw-r--r--content/renderer/renderer_webapplicationcachehost_impl.h3
-rw-r--r--content/shell/app/shell_main_delegate.cc5
-rw-r--r--content/shell/renderer/shell_render_process_observer.cc6
-rw-r--r--content/test/layouttest_support.cc45
12 files changed, 39 insertions, 127 deletions
diff --git a/content/public/test/layouttest_support.h b/content/public/test/layouttest_support.h
index 4d0e444..ed490ec 100644
--- a/content/public/test/layouttest_support.h
+++ b/content/public/test/layouttest_support.h
@@ -20,6 +20,15 @@ namespace content {
class RenderView;
+// Turn the browser process into layout test mode.
+void EnableBrowserLayoutTestMode();
+
+///////////////////////////////////////////////////////////////////////////////
+// The following methods are meant to be used from a renderer.
+
+// Turn a renderer into layout test mode.
+void EnableRendererLayoutTestMode();
+
// Enable injecting of a WebTestProxy between WebViews and RenderViews.
// |callback| is invoked with a pointer to WebTestProxyBase for each created
// WebTestProxy.
@@ -30,20 +39,9 @@ void EnableWebTestProxyCreation(const base::Callback<
// WebKitPlatformSupport::sampleGamepads().
void SetMockGamepads(const WebKit::WebGamepads& pads);
-// Disable logging to the console from the appcache system.
-void DisableAppCacheLogging();
-
-// Enable testing support in the devtools client.
-void EnableDevToolsFrontendTesting();
-
// Returns the length of the local session history of a render view.
int GetLocalSessionHistoryLength(RenderView* render_view);
-void SetAllowOSMesaImageTransportForTesting();
-
-// Suppress sending focus events from the renderer to the browser.
-void DoNotSendFocusEvents();
-
// Sync the current session history to the browser process.
void SyncNavigationState(RenderView* render_view);
@@ -52,26 +50,13 @@ void SyncNavigationState(RenderView* render_view);
// process.
void SetFocusAndActivate(RenderView* render_view, bool enable);
-// When WebKit requests a size change, immediately report the new sizes back to
-// WebKit instead of waiting for the browser to acknowledge the new size.
-void EnableShortCircuitSizeUpdates();
-
// Changes the window rect of the given render view.
void ForceResizeRenderView(RenderView* render_view,
const WebKit::WebSize& new_size);
-// Never display error pages when a navigation fails.
-void DisableNavigationErrorPages();
-
// Set the device scale factor and force the compositor to resize.
void SetDeviceScaleFactor(RenderView* render_view, float factor);
-// Disable system calls related to drag & drop.
-void DisableSystemDragDrop();
-
-// Don't show modal popup menus.
-void DisableModalPopupMenus();
-
// Control auto resize mode.
void EnableAutoResizeMode(RenderView* render_view,
const WebKit::WebSize& min_size,
diff --git a/content/renderer/devtools/devtools_client.cc b/content/renderer/devtools/devtools_client.cc
index 5f760e6..e02c65f 100644
--- a/content/renderer/devtools/devtools_client.cc
+++ b/content/renderer/devtools/devtools_client.cc
@@ -23,12 +23,6 @@ using WebKit::WebString;
namespace content {
-namespace {
-
-bool g_devtools_frontend_testing_enabled = false;
-
-} // namespace
-
DevToolsClient::DevToolsClient(RenderViewImpl* render_view)
: RenderViewObserver(render_view) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -116,7 +110,7 @@ void DevToolsClient::removeFileSystem(const WebString& fileSystemPath) {
}
bool DevToolsClient::isUnderTest() {
- return g_devtools_frontend_testing_enabled;
+ return RenderThreadImpl::current()->layout_test_mode();
}
void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) {
@@ -124,9 +118,4 @@ void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) {
WebString::fromUTF8(message));
}
-// static
-void DevToolsClient::EnableDevToolsFrontendTesting() {
- g_devtools_frontend_testing_enabled = true;
-}
-
} // namespace content
diff --git a/content/renderer/devtools/devtools_client.h b/content/renderer/devtools/devtools_client.h
index d2fe7ec..3a24804 100644
--- a/content/renderer/devtools/devtools_client.h
+++ b/content/renderer/devtools/devtools_client.h
@@ -34,7 +34,6 @@ class CONTENT_EXPORT DevToolsClient
explicit DevToolsClient(RenderViewImpl* render_view);
virtual ~DevToolsClient();
- static void EnableDevToolsFrontendTesting();
private:
// RenderView::Observer implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 9b7524a..c832845 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -353,9 +353,7 @@ void RenderThreadImpl::Init() {
hidden_widget_count_ = 0;
idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs;
idle_notifications_to_skip_ = 0;
- should_send_focus_ipcs_ = true;
- short_circuit_size_updates_ = false;
- skip_error_pages_ = false;
+ layout_test_mode_ = false;
appcache_dispatcher_.reset(new AppCacheDispatcher(Get()));
dom_storage_dispatcher_.reset(new DomStorageDispatcher());
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index ae01148..a7d615b 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -188,29 +188,14 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
void DoNotSuspendWebKitSharedTimer();
void DoNotNotifyWebKitOfModalLoop();
- // True if focus changes should be send via IPC to the browser.
- bool should_send_focus_ipcs() const {
- return should_send_focus_ipcs_;
+ // True if we are running layout tests. This currently disables forwarding
+ // various status messages to the console, skips network error pages, and
+ // short circuits size update and focus events.
+ bool layout_test_mode() const {
+ return layout_test_mode_;
}
- void set_should_send_focus_ipcs(bool send) {
- should_send_focus_ipcs_ = send;
- }
-
- // True if RenderWidgets should report the newly requested size back to
- // WebKit without waiting for the browser to acknowledge the size.
- bool short_circuit_size_updates() const {
- return short_circuit_size_updates_;
- }
- void set_short_circuit_size_updates(bool short_circuit) {
- short_circuit_size_updates_ = short_circuit;
- }
-
- // True if we should never display error pages in response to a failed load.
- bool skip_error_pages() const {
- return skip_error_pages_;
- }
- void set_skip_error_pages(bool skip) {
- skip_error_pages_ = skip;
+ void set_layout_test_mode(bool layout_test_mode) {
+ layout_test_mode_ = layout_test_mode;
}
IPC::ForwardingMessageFilter* compositor_output_surface_filter() const {
@@ -433,10 +418,8 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
bool suspend_webkit_shared_timer_;
bool notify_webkit_of_modal_loop_;
- // The following flags are used to control layout test specific behavior.
- bool should_send_focus_ipcs_;
- bool short_circuit_size_updates_;
- bool skip_error_pages_;
+ // The following flag is used to control layout test specific behavior.
+ bool layout_test_mode_;
// Timer that periodically calls IdleHandler.
base::RepeatingTimer<RenderThreadImpl> idle_timer_;
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 03d57a6..3efa0f5 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2519,7 +2519,7 @@ void RenderViewImpl::didFocus() {
// we won't have to test for user gesture anymore and we can
// move that code back to render_widget.cc
if (WebUserGestureIndicator::isProcessingUserGesture() &&
- RenderThreadImpl::current()->should_send_focus_ipcs()) {
+ !RenderThreadImpl::current()->layout_test_mode()) {
Send(new ViewHostMsg_Focus(routing_id_));
}
}
@@ -2527,7 +2527,7 @@ void RenderViewImpl::didFocus() {
void RenderViewImpl::didBlur() {
// TODO(jcivelli): see TODO above in didFocus().
if (WebUserGestureIndicator::isProcessingUserGesture() &&
- RenderThreadImpl::current()->should_send_focus_ipcs()) {
+ !RenderThreadImpl::current()->layout_test_mode()) {
Send(new ViewHostMsg_Blur(routing_id_));
}
}
@@ -3490,7 +3490,7 @@ void RenderViewImpl::didFailProvisionalLoad(WebFrame* frame,
if (error.reason == net::ERR_ABORTED)
return;
- if (RenderThreadImpl::current()->skip_error_pages())
+ if (RenderThreadImpl::current()->layout_test_mode())
return;
// Make sure we never show errors in view source mode.
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index d85a131..19a035d 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1412,7 +1412,7 @@ void RenderWidget::didAutoResize(const WebSize& new_size) {
// with invalid damage rects.
paint_aggregator_.ClearPendingUpdate();
- if (RenderThreadImpl::current()->short_circuit_size_updates()) {
+ if (RenderThreadImpl::current()->layout_test_mode()) {
WebRect new_pos(rootWindowRect().x,
rootWindowRect().y,
new_size.width,
@@ -1423,7 +1423,7 @@ void RenderWidget::didAutoResize(const WebSize& new_size) {
AutoResizeCompositor();
- if (!RenderThreadImpl::current()->short_circuit_size_updates())
+ if (!RenderThreadImpl::current()->layout_test_mode())
need_update_rect_for_auto_resize_ = true;
}
}
@@ -1680,7 +1680,7 @@ void RenderWidget::setToolTipText(const WebKit::WebString& text,
void RenderWidget::setWindowRect(const WebRect& pos) {
if (did_show_) {
- if (!RenderThreadImpl::current()->short_circuit_size_updates()) {
+ if (!RenderThreadImpl::current()->layout_test_mode()) {
Send(new ViewHostMsg_RequestMove(routing_id_, pos));
SetPendingWindowRect(pos);
} else {
diff --git a/content/renderer/renderer_webapplicationcachehost_impl.cc b/content/renderer/renderer_webapplicationcachehost_impl.cc
index 6404053..16717dc 100644
--- a/content/renderer/renderer_webapplicationcachehost_impl.cc
+++ b/content/renderer/renderer_webapplicationcachehost_impl.cc
@@ -16,8 +16,6 @@ using WebKit::WebConsoleMessage;
namespace content {
-static bool g_disable_logging = false;
-
RendererWebApplicationCacheHostImpl::RendererWebApplicationCacheHostImpl(
RenderViewImpl* render_view,
WebApplicationCacheHostClient* client,
@@ -28,7 +26,7 @@ RendererWebApplicationCacheHostImpl::RendererWebApplicationCacheHostImpl(
void RendererWebApplicationCacheHostImpl::OnLogMessage(
appcache::LogLevel log_level, const std::string& message) {
- if (g_disable_logging)
+ if (RenderThreadImpl::current()->layout_test_mode())
return;
RenderViewImpl* render_view = GetRenderView();
@@ -61,9 +59,4 @@ RenderViewImpl* RendererWebApplicationCacheHostImpl::GetRenderView() {
return RenderViewImpl::FromRoutingID(routing_id_);
}
-// static
-void RendererWebApplicationCacheHostImpl::DisableLoggingForTesting() {
- g_disable_logging = true;
-}
-
} // namespace content
diff --git a/content/renderer/renderer_webapplicationcachehost_impl.h b/content/renderer/renderer_webapplicationcachehost_impl.h
index 872d5c6..07d5e22 100644
--- a/content/renderer/renderer_webapplicationcachehost_impl.h
+++ b/content/renderer/renderer_webapplicationcachehost_impl.h
@@ -5,7 +5,6 @@
#ifndef CONTENT_RENDERER_RENDERER_WEBAPPLICATIONCACHEHOST_IMPL_H_
#define CONTENT_RENDERER_RENDERER_WEBAPPLICATIONCACHEHOST_IMPL_H_
-#include "content/common/content_export.h"
#include "webkit/appcache/web_application_cache_host_impl.h"
namespace content {
@@ -25,8 +24,6 @@ class RendererWebApplicationCacheHostImpl
virtual void OnContentBlocked(const GURL& manifest_url) OVERRIDE;
virtual void OnCacheSelected(const appcache::AppCacheInfo& info) OVERRIDE;
- CONTENT_EXPORT static void DisableLoggingForTesting();
-
private:
RenderViewImpl* GetRenderView();
diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc
index 38698624..0f5c104 100644
--- a/content/shell/app/shell_main_delegate.cc
+++ b/content/shell/app/shell_main_delegate.cc
@@ -112,13 +112,12 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
}
}
if (command_line.HasSwitch(switches::kDumpRenderTree)) {
+ EnableBrowserLayoutTestMode();
+
command_line.AppendSwitch(switches::kProcessPerTab);
command_line.AppendSwitch(switches::kAllowFileAccessFromFiles);
command_line.AppendSwitchASCII(
switches::kUseGL, gfx::kGLImplementationOSMesaName);
- SetAllowOSMesaImageTransportForTesting();
- DisableSystemDragDrop();
- DisableModalPopupMenus();
command_line.AppendSwitch(switches::kSkipGpuDataLoading);
command_line.AppendSwitch(switches::kEnableExperimentalWebKitFeatures);
command_line.AppendSwitch(switches::kEnableCssShaders);
diff --git a/content/shell/renderer/shell_render_process_observer.cc b/content/shell/renderer/shell_render_process_observer.cc
index 25d1aeb..82cb633 100644
--- a/content/shell/renderer/shell_render_process_observer.cc
+++ b/content/shell/renderer/shell_render_process_observer.cc
@@ -41,11 +41,7 @@ ShellRenderProcessObserver::ShellRenderProcessObserver()
RenderThread::Get()->AddObserver(this);
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
return;
- DisableAppCacheLogging();
- EnableDevToolsFrontendTesting();
- EnableShortCircuitSizeUpdates();
- DoNotSendFocusEvents();
- DisableNavigationErrorPages();
+ EnableRendererLayoutTestMode();
}
ShellRenderProcessObserver::~ShellRenderProcessObserver() {
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc
index b60a161..51141d3 100644
--- a/content/test/layouttest_support.cc
+++ b/content/test/layouttest_support.cc
@@ -7,10 +7,8 @@
#include "base/callback.h"
#include "base/lazy_instance.h"
#include "content/common/gpu/image_transport_surface.h"
-#include "content/renderer/devtools/devtools_client.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h"
-#include "content/renderer/renderer_webapplicationcachehost_impl.h"
#include "content/renderer/renderer_webkitplatformsupport_impl.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h"
@@ -60,27 +58,22 @@ void SetMockGamepads(const WebGamepads& pads) {
RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads);
}
-void DisableAppCacheLogging() {
- RendererWebApplicationCacheHostImpl::DisableLoggingForTesting();
+void EnableRendererLayoutTestMode() {
+ RenderThreadImpl::current()->set_layout_test_mode(true);
}
-void EnableDevToolsFrontendTesting() {
- DevToolsClient::EnableDevToolsFrontendTesting();
-}
-
-int GetLocalSessionHistoryLength(RenderView* render_view) {
- return static_cast<RenderViewImpl*>(render_view)
- ->GetLocalSessionHistoryLengthForTesting();
-}
-
-void SetAllowOSMesaImageTransportForTesting() {
+void EnableBrowserLayoutTestMode() {
#if defined(OS_MACOSX)
ImageTransportSurface::SetAllowOSMesaForTesting(true);
+ PopupMenuHelper::DontShowPopupMenuForTesting();
+#elif defined(OS_WIN) && !defined(USE_AURA)
+ WebContentsDragWin::DisableDragDropForTesting();
#endif
}
-void DoNotSendFocusEvents() {
- RenderThreadImpl::current()->set_should_send_focus_ipcs(false);
+int GetLocalSessionHistoryLength(RenderView* render_view) {
+ return static_cast<RenderViewImpl*>(render_view)
+ ->GetLocalSessionHistoryLengthForTesting();
}
void SyncNavigationState(RenderView* render_view) {
@@ -92,10 +85,6 @@ void SetFocusAndActivate(RenderView* render_view, bool enable) {
->SetFocusAndActivateForTesting(enable);
}
-void EnableShortCircuitSizeUpdates() {
- RenderThreadImpl::current()->set_short_circuit_size_updates(true);
-}
-
void ForceResizeRenderView(RenderView* render_view,
const WebSize& new_size) {
RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
@@ -105,27 +94,11 @@ void ForceResizeRenderView(RenderView* render_view,
new_size.height));
}
-void DisableNavigationErrorPages() {
- RenderThreadImpl::current()->set_skip_error_pages(true);
-}
-
void SetDeviceScaleFactor(RenderView* render_view, float factor) {
static_cast<RenderViewImpl*>(render_view)
->SetDeviceScaleFactorForTesting(factor);
}
-void DisableSystemDragDrop() {
-#if defined(OS_WIN) && !defined(USE_AURA)
- WebContentsDragWin::DisableDragDropForTesting();
-#endif
-}
-
-void DisableModalPopupMenus() {
-#if defined(OS_MACOSX)
- PopupMenuHelper::DontShowPopupMenuForTesting();
-#endif
-}
-
void EnableAutoResizeMode(RenderView* render_view,
const WebSize& min_size,
const WebSize& max_size) {