OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 // Go to a page with a link | 208 // Go to a page with a link |
209 ui_test_utils::NavigateToURL( | 209 ui_test_utils::NavigateToURL( |
210 browser(), GURL("data:text/html,<a href='about:blank'>link</a>")); | 210 browser(), GURL("data:text/html,<a href='about:blank'>link</a>")); |
211 | 211 |
212 // Open a context menu. | 212 // Open a context menu. |
213 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 213 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
214 blink::WebInputEvent::NoModifiers, | 214 blink::WebInputEvent::NoModifiers, |
215 blink::WebInputEvent::TimeStampForTesting); | 215 blink::WebInputEvent::TimeStampForTesting); |
216 mouse_event.button = blink::WebMouseEvent::Button::Right; | 216 mouse_event.button = blink::WebMouseEvent::Button::Right; |
217 mouse_event.x = 15; | 217 mouse_event.position.x = 15; |
218 mouse_event.y = 15; | 218 mouse_event.position.y = 15; |
219 content::WebContents* tab = | 219 content::WebContents* tab = |
220 browser()->tab_strip_model()->GetActiveWebContents(); | 220 browser()->tab_strip_model()->GetActiveWebContents(); |
221 gfx::Rect offset = tab->GetContainerBounds(); | 221 gfx::Rect offset = tab->GetContainerBounds(); |
222 mouse_event.globalX = 15 + offset.x(); | 222 mouse_event.screenPosition.x = 15 + offset.x(); |
223 mouse_event.globalY = 15 + offset.y(); | 223 mouse_event.screenPosition.y = 15 + offset.y(); |
224 mouse_event.clickCount = 1; | 224 mouse_event.clickCount = 1; |
225 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 225 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
226 mouse_event.setType(blink::WebInputEvent::MouseUp); | 226 mouse_event.setType(blink::WebInputEvent::MouseUp); |
227 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 227 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
228 | 228 |
229 // The menu_observer will select "Open in new tab", wait for the new tab to | 229 // The menu_observer will select "Open in new tab", wait for the new tab to |
230 // be added. | 230 // be added. |
231 tab_observer.Wait(); | 231 tab_observer.Wait(); |
232 tab = tab_observer.GetTab(); | 232 tab = tab_observer.GetTab(); |
233 content::WaitForLoadStop(tab); | 233 content::WaitForLoadStop(tab); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 ui_test_utils::NavigateToURL( | 349 ui_test_utils::NavigateToURL( |
350 browser(), | 350 browser(), |
351 GURL("data:text/html,<a href='about:blank' download='" + | 351 GURL("data:text/html,<a href='about:blank' download='" + |
352 kSuggestedFilename + "'>link</a>")); | 352 kSuggestedFilename + "'>link</a>")); |
353 | 353 |
354 // Open a context menu. | 354 // Open a context menu. |
355 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 355 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
356 blink::WebInputEvent::NoModifiers, | 356 blink::WebInputEvent::NoModifiers, |
357 blink::WebInputEvent::TimeStampForTesting); | 357 blink::WebInputEvent::TimeStampForTesting); |
358 mouse_event.button = blink::WebMouseEvent::Button::Right; | 358 mouse_event.button = blink::WebMouseEvent::Button::Right; |
359 mouse_event.x = 15; | 359 mouse_event.position.x = 15; |
360 mouse_event.y = 15; | 360 mouse_event.position.y = 15; |
361 content::WebContents* tab = | 361 content::WebContents* tab = |
362 browser()->tab_strip_model()->GetActiveWebContents(); | 362 browser()->tab_strip_model()->GetActiveWebContents(); |
363 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 363 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
364 mouse_event.setType(blink::WebInputEvent::MouseUp); | 364 mouse_event.setType(blink::WebInputEvent::MouseUp); |
365 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 365 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
366 | 366 |
367 // Wait for context menu to be visible. | 367 // Wait for context menu to be visible. |
368 menu_observer.WaitForMenuOpenAndClose(); | 368 menu_observer.WaitForMenuOpenAndClose(); |
369 | 369 |
370 // Compare filename. | 370 // Compare filename. |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { | 789 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { |
790 static const char kValidImage[] = "/load_image/image.png"; | 790 static const char kValidImage[] = "/load_image/image.png"; |
791 SetupAndLoadImagePage(kValidImage); | 791 SetupAndLoadImagePage(kValidImage); |
792 AddLoadImageInterceptor(kValidImage); | 792 AddLoadImageInterceptor(kValidImage); |
793 AttemptLoadImage(); | 793 AttemptLoadImage(); |
794 interceptor_->WaitForRequests(1); | 794 interceptor_->WaitForRequests(1); |
795 EXPECT_EQ(1, interceptor_->num_requests()); | 795 EXPECT_EQ(1, interceptor_->num_requests()); |
796 } | 796 } |
797 | 797 |
798 } // namespace | 798 } // namespace |
OLD | NEW |