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

Side by Side Diff: chrome/browser/ui/webui/webui_webview_browsertest.cc

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: always reset ignore_dragged_url_ Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/macros.h" 5 #include "base/macros.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h" 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 "destNode.offsetHeight")); 296 "destNode.offsetHeight"));
297 const gfx::Point client_pt( 297 const gfx::Point client_pt(
298 guest_dest_rect.x() + guest_dest_rect.width() / 2 + webview_rect.x(), 298 guest_dest_rect.x() + guest_dest_rect.width() / 2 + webview_rect.x(),
299 guest_dest_rect.y() + guest_dest_rect.height() / 2 + webview_rect.y()); 299 guest_dest_rect.y() + guest_dest_rect.height() / 2 + webview_rect.y());
300 gfx::Rect container_bounds = embedder_web_contents->GetContainerBounds(); 300 gfx::Rect container_bounds = embedder_web_contents->GetContainerBounds();
301 const gfx::Point screen_pt(container_bounds.x(), container_bounds.y()); 301 const gfx::Point screen_pt(container_bounds.x(), container_bounds.y());
302 const blink::WebDragOperationsMask drag_operation_mask = 302 const blink::WebDragOperationsMask drag_operation_mask =
303 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy | 303 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy |
304 blink::WebDragOperationLink | 304 blink::WebDragOperationLink |
305 blink::WebDragOperationMove); 305 blink::WebDragOperationMove);
306 content::DropData dropdata;
307 dropdata.did_originate_from_renderer = true;
308 dropdata.has_url = true;
309 dropdata.url = GURL(url::kAboutBlankURL);
310 dropdata.url_title = base::string16(base::ASCIIToUTF16("Drop me"));
306 311
307 // Drag url into input in webview. 312 // Drag url into input in webview.
308 313
309 { 314 {
310 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, 315 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
311 "console.log('step1: Drag Enter')")); 316 "console.log('step1: Drag Enter')"));
312 317
313 content::DropData dropdata;
314 dropdata.did_originate_from_renderer = true;
315 dropdata.url = GURL(url::kAboutBlankURL);
316 dropdata.url_title = base::string16(base::ASCIIToUTF16("Drop me"));
317
318 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), 318 WebUIMessageListener listener(embedder_web_contents->GetWebUI(),
319 "Step1: destNode gets dragenter"); 319 "Step1: destNode gets dragenter");
320 render_view_host->FilterDropData(&dropdata);
320 render_view_host->DragTargetDragEnter(dropdata, client_pt, screen_pt, 321 render_view_host->DragTargetDragEnter(dropdata, client_pt, screen_pt,
321 drag_operation_mask, 322 drag_operation_mask,
322 blink::WebInputEvent::LeftButtonDown); 323 blink::WebInputEvent::LeftButtonDown);
323 ASSERT_TRUE(listener.Wait()); 324 ASSERT_TRUE(listener.Wait());
324 } 325 }
325 326
326 { 327 {
327 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, 328 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
328 "console.log('step2: Drag Over')")); 329 "console.log('step2: Drag Over')"));
329 330
330 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), 331 WebUIMessageListener listener(embedder_web_contents->GetWebUI(),
331 "Step2: destNode gets dragover"); 332 "Step2: destNode gets dragover");
332 render_view_host->DragTargetDragOver(client_pt, screen_pt, 333 render_view_host->DragTargetDragOver(client_pt, screen_pt,
333 drag_operation_mask, 334 drag_operation_mask,
334 blink::WebInputEvent::LeftButtonDown); 335 blink::WebInputEvent::LeftButtonDown);
335 ASSERT_TRUE(listener.Wait()); 336 ASSERT_TRUE(listener.Wait());
336 } 337 }
337 338
338 { 339 {
339 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, 340 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
340 "console.log('step3: Drop')")); 341 "console.log('step3: Drop')"));
341 342
342 DNDToInputNavigationObserver observer(embedder_web_contents); 343 DNDToInputNavigationObserver observer(embedder_web_contents);
343 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), 344 WebUIMessageListener listener(embedder_web_contents->GetWebUI(),
344 "Step3: destNode gets drop"); 345 "Step3: destNode gets drop");
345 render_view_host->DragTargetDrop(client_pt, screen_pt, 0); 346 render_view_host->DragTargetDrop(dropdata, client_pt, screen_pt, 0);
346 ASSERT_TRUE(listener.Wait()); 347 ASSERT_TRUE(listener.Wait());
347 // Confirm no navigation 348 // Confirm no navigation
348 EXPECT_FALSE(observer.Navigated()); 349 EXPECT_FALSE(observer.Navigated());
349 EXPECT_EQ(GetWebViewEnabledWebUIURL(), embedder_web_contents->GetURL()); 350 EXPECT_EQ(GetWebViewEnabledWebUIURL(), embedder_web_contents->GetURL());
350 } 351 }
351 } 352 }
352 #endif 353 #endif
OLDNEW
« no previous file with comments | « no previous file | components/test_runner/event_sender.cc » ('j') | content/browser/browser_plugin/browser_plugin_guest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698