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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2622733002: Mac Support for drag-and-drop tests that start dragging via mouse simulation.
Patch Set: . Created 3 years, 11 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/browser/renderer_host/render_widget_host_impl.h ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 09357b1b067ef661ec73a093d98db6402a101705..4925481da2dab94f2703706e00aae1213831e90b 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -240,6 +240,9 @@ std::vector<DropData::Metadata> DropDataToMetaData(const DropData& drop_data) {
return metadata;
}
+base::LazyInstance<RenderWidgetHostImpl::DragStartCallback>::Leaky
+ g_drag_start_callback_for_testing = LAZY_INSTANCE_INITIALIZER;
+
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -1502,8 +1505,14 @@ void RenderWidgetHostImpl::OnStartDragging(
const SkBitmap& bitmap,
const gfx::Vector2d& bitmap_offset_in_dip,
const DragEventSourceInfo& event_info) {
+ bool drag_start_handled_by_test = false;
+ if (!g_drag_start_callback_for_testing.Get().is_null()) {
+ drag_start_handled_by_test = g_drag_start_callback_for_testing.Get().Run(
+ drop_data, drag_operations_mask);
+ }
+
RenderViewHostDelegateView* view = delegate_->GetDelegateView();
- if (!view) {
+ if (!view || drag_start_handled_by_test) {
// Need to clear drag and drop state in blink.
DragSourceSystemDragEnded();
return;
@@ -2530,4 +2539,14 @@ void RenderWidgetHostImpl::GrantFileAccessFromDropData(DropData* drop_data) {
}
}
+// static
+void RenderWidgetHostImpl::RegisterDragStartCallbackForTesting(
+ DragStartCallback callback) {
+ // Prevent attempts to register more than one callback.
+ DCHECK(callback.is_null() ||
+ g_drag_start_callback_for_testing.Get().is_null());
+
+ g_drag_start_callback_for_testing.Get() = std::move(callback);
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698