OLD | NEW |
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 Loading... |
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.url = GURL(url::kAboutBlankURL); |
| 309 dropdata.url_title = base::string16(base::ASCIIToUTF16("Drop me")); |
306 | 310 |
307 // Drag url into input in webview. | 311 // Drag url into input in webview. |
308 | 312 |
309 { | 313 { |
310 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, | 314 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, |
311 "console.log('step1: Drag Enter')")); | 315 "console.log('step1: Drag Enter')")); |
312 | 316 |
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(), | 317 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), |
319 "Step1: destNode gets dragenter"); | 318 "Step1: destNode gets dragenter"); |
| 319 render_view_host->FilterDropData(&dropdata); |
320 render_view_host->DragTargetDragEnter(dropdata, client_pt, screen_pt, | 320 render_view_host->DragTargetDragEnter(dropdata, client_pt, screen_pt, |
321 drag_operation_mask, | 321 drag_operation_mask, |
322 blink::WebInputEvent::LeftButtonDown); | 322 blink::WebInputEvent::LeftButtonDown); |
323 ASSERT_TRUE(listener.Wait()); | 323 ASSERT_TRUE(listener.Wait()); |
324 } | 324 } |
325 | 325 |
326 { | 326 { |
327 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, | 327 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, |
328 "console.log('step2: Drag Over')")); | 328 "console.log('step2: Drag Over')")); |
329 | 329 |
330 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), | 330 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), |
331 "Step2: destNode gets dragover"); | 331 "Step2: destNode gets dragover"); |
332 render_view_host->DragTargetDragOver(client_pt, screen_pt, | 332 render_view_host->DragTargetDragOver(client_pt, screen_pt, |
333 drag_operation_mask, | 333 drag_operation_mask, |
334 blink::WebInputEvent::LeftButtonDown); | 334 blink::WebInputEvent::LeftButtonDown); |
335 ASSERT_TRUE(listener.Wait()); | 335 ASSERT_TRUE(listener.Wait()); |
336 } | 336 } |
337 | 337 |
338 { | 338 { |
339 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, | 339 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, |
340 "console.log('step3: Drop')")); | 340 "console.log('step3: Drop')")); |
341 | 341 |
342 DNDToInputNavigationObserver observer(embedder_web_contents); | 342 DNDToInputNavigationObserver observer(embedder_web_contents); |
343 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), | 343 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), |
344 "Step3: destNode gets drop"); | 344 "Step3: destNode gets drop"); |
345 render_view_host->DragTargetDrop(client_pt, screen_pt, 0); | 345 render_view_host->DragTargetDrop(dropdata, client_pt, screen_pt, 0); |
346 ASSERT_TRUE(listener.Wait()); | 346 ASSERT_TRUE(listener.Wait()); |
347 // Confirm no navigation | 347 // Confirm no navigation |
348 EXPECT_FALSE(observer.Navigated()); | 348 EXPECT_FALSE(observer.Navigated()); |
349 EXPECT_EQ(GetWebViewEnabledWebUIURL(), embedder_web_contents->GetURL()); | 349 EXPECT_EQ(GetWebViewEnabledWebUIURL(), embedder_web_contents->GetURL()); |
350 } | 350 } |
351 } | 351 } |
352 #endif | 352 #endif |
OLD | NEW |