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.setPositionInWidget(15, 15); |
218 mouse_event.y = 15; | |
219 content::WebContents* tab = | 218 content::WebContents* tab = |
220 browser()->tab_strip_model()->GetActiveWebContents(); | 219 browser()->tab_strip_model()->GetActiveWebContents(); |
221 gfx::Rect offset = tab->GetContainerBounds(); | 220 gfx::Rect offset = tab->GetContainerBounds(); |
222 mouse_event.globalX = 15 + offset.x(); | 221 mouse_event.setPositionInScreen(15 + offset.x(), 15 + offset.y()); |
223 mouse_event.globalY = 15 + offset.y(); | |
224 mouse_event.clickCount = 1; | 222 mouse_event.clickCount = 1; |
225 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 223 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
226 mouse_event.setType(blink::WebInputEvent::MouseUp); | 224 mouse_event.setType(blink::WebInputEvent::MouseUp); |
227 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 225 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
228 | 226 |
229 // The menu_observer will select "Open in new tab", wait for the new tab to | 227 // The menu_observer will select "Open in new tab", wait for the new tab to |
230 // be added. | 228 // be added. |
231 tab_observer.Wait(); | 229 tab_observer.Wait(); |
232 tab = tab_observer.GetTab(); | 230 tab = tab_observer.GetTab(); |
233 content::WaitForLoadStop(tab); | 231 content::WaitForLoadStop(tab); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 ui_test_utils::NavigateToURL( | 347 ui_test_utils::NavigateToURL( |
350 browser(), | 348 browser(), |
351 GURL("data:text/html,<a href='about:blank' download='" + | 349 GURL("data:text/html,<a href='about:blank' download='" + |
352 kSuggestedFilename + "'>link</a>")); | 350 kSuggestedFilename + "'>link</a>")); |
353 | 351 |
354 // Open a context menu. | 352 // Open a context menu. |
355 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 353 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
356 blink::WebInputEvent::NoModifiers, | 354 blink::WebInputEvent::NoModifiers, |
357 blink::WebInputEvent::TimeStampForTesting); | 355 blink::WebInputEvent::TimeStampForTesting); |
358 mouse_event.button = blink::WebMouseEvent::Button::Right; | 356 mouse_event.button = blink::WebMouseEvent::Button::Right; |
359 mouse_event.x = 15; | 357 mouse_event.setPositionInWidget(15, 15); |
360 mouse_event.y = 15; | |
361 content::WebContents* tab = | 358 content::WebContents* tab = |
362 browser()->tab_strip_model()->GetActiveWebContents(); | 359 browser()->tab_strip_model()->GetActiveWebContents(); |
363 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 360 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
364 mouse_event.setType(blink::WebInputEvent::MouseUp); | 361 mouse_event.setType(blink::WebInputEvent::MouseUp); |
365 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 362 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
366 | 363 |
367 // Wait for context menu to be visible. | 364 // Wait for context menu to be visible. |
368 menu_observer.WaitForMenuOpenAndClose(); | 365 menu_observer.WaitForMenuOpenAndClose(); |
369 | 366 |
370 // Compare filename. | 367 // Compare filename. |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { | 786 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { |
790 static const char kValidImage[] = "/load_image/image.png"; | 787 static const char kValidImage[] = "/load_image/image.png"; |
791 SetupAndLoadImagePage(kValidImage); | 788 SetupAndLoadImagePage(kValidImage); |
792 AddLoadImageInterceptor(kValidImage); | 789 AddLoadImageInterceptor(kValidImage); |
793 AttemptLoadImage(); | 790 AttemptLoadImage(); |
794 interceptor_->WaitForRequests(1); | 791 interceptor_->WaitForRequests(1); |
795 EXPECT_EQ(1, interceptor_->num_requests()); | 792 EXPECT_EQ(1, interceptor_->num_requests()); |
796 } | 793 } |
797 | 794 |
798 } // namespace | 795 } // namespace |
OLD | NEW |