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

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

Issue 2485693003: Drag-and-drop: DragEnter, DragOver, DragLeave, DragDrop (Closed)
Patch Set: Rebased. More fixes. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | components/test_runner/event_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "chrome/browser/signin/signin_promo.h" 11 #include "chrome/browser/signin/signin_promo.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
17 #include "chrome/test/base/web_ui_browser_test.h" 17 #include "chrome/test/base/web_ui_browser_test.h"
18 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/render_widget_host.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/context_menu_params.h" 21 #include "content/public/common/context_menu_params.h"
21 #include "content/public/common/drop_data.h" 22 #include "content/public/common/drop_data.h"
22 #include "content/public/test/browser_test_utils.h" 23 #include "content/public/test/browser_test_utils.h"
23 #include "extensions/test/extension_test_message_listener.h" 24 #include "extensions/test/extension_test_message_listener.h"
24 #include "net/test/embedded_test_server/embedded_test_server.h" 25 #include "net/test/embedded_test_server/embedded_test_server.h"
25 26
26 // Turn these tests off on Mac while we collect data on windows server crashes 27 // Turn these tests off on Mac while we collect data on windows server crashes
27 // on mac chromium builders. 28 // on mac chromium builders.
28 // http://crbug.com/653353 29 // http://crbug.com/653353
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy | 317 static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy |
317 blink::WebDragOperationLink | 318 blink::WebDragOperationLink |
318 blink::WebDragOperationMove); 319 blink::WebDragOperationMove);
319 content::DropData dropdata; 320 content::DropData dropdata;
320 dropdata.did_originate_from_renderer = true; 321 dropdata.did_originate_from_renderer = true;
321 dropdata.url = GURL(url::kAboutBlankURL); 322 dropdata.url = GURL(url::kAboutBlankURL);
322 dropdata.url_title = base::string16(base::ASCIIToUTF16("Drop me")); 323 dropdata.url_title = base::string16(base::ASCIIToUTF16("Drop me"));
323 324
324 // Drag url into input in webview. 325 // Drag url into input in webview.
325 326
327 // TODO(paulmeyer): The following drag-and-drop calls on
328 // render_view_host->GetWidget() will need to be targeted to specific
329 // RenderWidgetHosts in order to work with OOPIFs. See crbug.com/647249.
330
326 { 331 {
327 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, 332 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
328 "console.log('step1: Drag Enter')")); 333 "console.log('step1: Drag Enter')"));
329 334
330 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), 335 WebUIMessageListener listener(embedder_web_contents->GetWebUI(),
331 "Step1: destNode gets dragenter"); 336 "Step1: destNode gets dragenter");
332 render_view_host->FilterDropData(&dropdata); 337 render_view_host->GetWidget()->FilterDropData(&dropdata);
333 render_view_host->DragTargetDragEnter(dropdata, client_pt, screen_pt, 338 render_view_host->GetWidget()->DragTargetDragEnter(
334 drag_operation_mask, 339 dropdata,client_pt, screen_pt, drag_operation_mask,
335 blink::WebInputEvent::LeftButtonDown); 340 blink::WebInputEvent::LeftButtonDown);
336 ASSERT_TRUE(listener.Wait()); 341 ASSERT_TRUE(listener.Wait());
337 } 342 }
338 343
339 { 344 {
340 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, 345 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
341 "console.log('step2: Drag Over')")); 346 "console.log('step2: Drag Over')"));
342 347
343 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), 348 WebUIMessageListener listener(embedder_web_contents->GetWebUI(),
344 "Step2: destNode gets dragover"); 349 "Step2: destNode gets dragover");
345 render_view_host->DragTargetDragOver(client_pt, screen_pt, 350 render_view_host->GetWidget()->DragTargetDragOver(
346 drag_operation_mask, 351 client_pt, screen_pt, drag_operation_mask,
347 blink::WebInputEvent::LeftButtonDown); 352 blink::WebInputEvent::LeftButtonDown);
348 ASSERT_TRUE(listener.Wait()); 353 ASSERT_TRUE(listener.Wait());
349 } 354 }
350 355
351 { 356 {
352 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, 357 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents,
353 "console.log('step3: Drop')")); 358 "console.log('step3: Drop')"));
354 359
355 DNDToInputNavigationObserver observer(embedder_web_contents); 360 DNDToInputNavigationObserver observer(embedder_web_contents);
356 WebUIMessageListener listener(embedder_web_contents->GetWebUI(), 361 WebUIMessageListener listener(embedder_web_contents->GetWebUI(),
357 "Step3: destNode gets drop"); 362 "Step3: destNode gets drop");
358 render_view_host->DragTargetDrop(dropdata, client_pt, screen_pt, 0); 363 render_view_host->GetWidget()->DragTargetDrop(
364 dropdata, client_pt, screen_pt, 0);
359 ASSERT_TRUE(listener.Wait()); 365 ASSERT_TRUE(listener.Wait());
360 // Confirm no navigation 366 // Confirm no navigation
361 EXPECT_FALSE(observer.Navigated()); 367 EXPECT_FALSE(observer.Navigated());
362 EXPECT_EQ(GetWebViewEnabledWebUIURL(), embedder_web_contents->GetURL()); 368 EXPECT_EQ(GetWebViewEnabledWebUIURL(), embedder_web_contents->GetURL());
363 } 369 }
364 } 370 }
365 #endif 371 #endif
366 372
367 #endif // !defined(OS_MACOSX) 373 #endif // !defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « no previous file | components/test_runner/event_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698