Skip to content

Commit

Permalink
[content shell] don't invoke the OLE DoDragDrop method during layout …
Browse files Browse the repository at this point in the history
…tests

This method will block until at least the mouse enters the window, and so most
layout tests that rely on drag & drop just time out.

BUG=111316
R=sky@chromium.org
TEST=e.g. fast/events/clear-drag-state.html passes

Review URL: https://chromiumcodereview.appspot.com/13843007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195940 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jochen@chromium.org committed Apr 23, 2013
1 parent 50e8af0 commit d7e321c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
11 changes: 9 additions & 2 deletions content/browser/web_contents/web_contents_drag_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ using WebKit::WebDragOperationMove;
namespace content {
namespace {

bool run_do_drag_drop = true;

HHOOK msg_hook = NULL;
DWORD drag_out_thread_id = 0;
bool mouse_up_received = false;
Expand Down Expand Up @@ -353,8 +355,8 @@ bool WebContentsDragWin::DoDragging(const WebDropData& drop_data,

// We need to enable recursive tasks on the message loop so we can get
// updates while in the system DoDragDrop loop.
DWORD effect;
{
DWORD effect = DROPEFFECT_NONE;
if (run_do_drag_drop) {
// Keep a reference count such that |drag_source_| will not get deleted
// if the contents view window is gone in the nested message loop invoked
// from DoDragDrop.
Expand Down Expand Up @@ -430,4 +432,9 @@ void WebContentsDragWin::OnDataObjectDisposed() {
base::Bind(&WebContentsDragWin::CloseThread, this));
}

// static
void WebContentsDragWin::DisableDragDropForTesting() {
run_do_drag_drop = false;
}

} // namespace content
3 changes: 3 additions & 0 deletions content/browser/web_contents/web_contents_drag_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class CONTENT_EXPORT WebContentsDragWin
virtual void OnWaitForData();
virtual void OnDataObjectDisposed();

// Don't invoke OLE DoDragDrop during tests.
static void DisableDragDropForTesting();

private:
// Called on either UI thread or drag-and-drop thread.
void PrepareDragForDownload(const WebDropData& drop_data,
Expand Down
3 changes: 3 additions & 0 deletions content/public/test/layouttest_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ 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();

} // namespace content

#endif // CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_
1 change: 1 addition & 0 deletions content/shell/shell_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
command_line.AppendSwitchASCII(
switches::kUseGL, gfx::kGLImplementationOSMesaName);
SetAllowOSMesaImageTransportForTesting();
DisableSystemDragDrop();
command_line.AppendSwitch(switches::kSkipGpuDataLoading);
command_line.AppendSwitch(switches::kEnableExperimentalWebKitFeatures);
command_line.AppendSwitch(switches::kEnableCssShaders);
Expand Down
10 changes: 10 additions & 0 deletions content/test/layouttest_support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h"

#if defined(OS_WIN) && !defined(USE_AURA)
#include "content/browser/web_contents/web_contents_drag_win.h"
#endif

using WebKit::WebGamepads;
using WebTestRunner::WebTestProxy;
using WebTestRunner::WebTestProxyBase;
Expand Down Expand Up @@ -100,4 +104,10 @@ void SetDeviceScaleFactor(RenderView* render_view, float factor) {
->SetDeviceScaleFactorForTesting(factor);
}

void DisableSystemDragDrop() {
#if defined(OS_WIN) && !defined(USE_AURA)
WebContentsDragWin::DisableDragDropForTesting();
#endif
}

} // namespace content

0 comments on commit d7e321c

Please sign in to comment.