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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/download/download_browsertest.h" 5 #include "chrome/browser/download/download_browsertest.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <sstream> 8 #include <sstream>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 DownloadManagerForBrowser(browser()), 1, 2623 DownloadManagerForBrowser(browser()), 1,
2624 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2624 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2625 2625
2626 // Click on the link with the alt key pressed. This will download the link 2626 // Click on the link with the alt key pressed. This will download the link
2627 // target. 2627 // target.
2628 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2628 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2629 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 2629 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
2630 blink::WebInputEvent::AltKey, 2630 blink::WebInputEvent::AltKey,
2631 blink::WebInputEvent::TimeStampForTesting); 2631 blink::WebInputEvent::TimeStampForTesting);
2632 mouse_event.button = blink::WebMouseEvent::Button::Left; 2632 mouse_event.button = blink::WebMouseEvent::Button::Left;
2633 mouse_event.x = 15; 2633 mouse_event.setPositionInWidget(15, 15);
2634 mouse_event.y = 15;
2635 mouse_event.clickCount = 1; 2634 mouse_event.clickCount = 1;
2636 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2635 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2637 mouse_event.setType(blink::WebInputEvent::MouseUp); 2636 mouse_event.setType(blink::WebInputEvent::MouseUp);
2638 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2637 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2639 2638
2640 waiter->WaitForFinished(); 2639 waiter->WaitForFinished();
2641 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2640 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2642 CheckDownloadStates(1, DownloadItem::COMPLETE); 2641 CheckDownloadStates(1, DownloadItem::COMPLETE);
2643 2642
2644 // Validate that the correct file was downloaded. 2643 // Validate that the correct file was downloaded.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 // Right-click on the link and choose Save Link As. This will download the 2679 // Right-click on the link and choose Save Link As. This will download the
2681 // link target. 2680 // link target.
2682 ContextMenuNotificationObserver context_menu_observer( 2681 ContextMenuNotificationObserver context_menu_observer(
2683 IDC_CONTENT_CONTEXT_SAVELINKAS); 2682 IDC_CONTENT_CONTEXT_SAVELINKAS);
2684 2683
2685 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2684 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2686 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 2685 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
2687 blink::WebInputEvent::NoModifiers, 2686 blink::WebInputEvent::NoModifiers,
2688 blink::WebInputEvent::TimeStampForTesting); 2687 blink::WebInputEvent::TimeStampForTesting);
2689 mouse_event.button = blink::WebMouseEvent::Button::Right; 2688 mouse_event.button = blink::WebMouseEvent::Button::Right;
2690 mouse_event.x = 15; 2689 mouse_event.setPositionInWidget(15, 15);
2691 mouse_event.y = 15;
2692 mouse_event.clickCount = 1; 2690 mouse_event.clickCount = 1;
2693 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2691 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2694 mouse_event.setType(blink::WebInputEvent::MouseUp); 2692 mouse_event.setType(blink::WebInputEvent::MouseUp);
2695 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2693 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2696 2694
2697 waiter->WaitForFinished(); 2695 waiter->WaitForFinished();
2698 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2696 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2699 CheckDownloadStates(1, DownloadItem::COMPLETE); 2697 CheckDownloadStates(1, DownloadItem::COMPLETE);
2700 2698
2701 // Validate that the correct file was downloaded. 2699 // Validate that the correct file was downloaded.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 DownloadManagerForBrowser(browser()), 1, 2783 DownloadManagerForBrowser(browser()), 1,
2786 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2784 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2787 2785
2788 // Click on the link with the alt key pressed. This will download the link 2786 // Click on the link with the alt key pressed. This will download the link
2789 // target. 2787 // target.
2790 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2788 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2791 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 2789 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
2792 blink::WebInputEvent::AltKey, 2790 blink::WebInputEvent::AltKey,
2793 blink::WebInputEvent::TimeStampForTesting); 2791 blink::WebInputEvent::TimeStampForTesting);
2794 mouse_event.button = blink::WebMouseEvent::Button::Left; 2792 mouse_event.button = blink::WebMouseEvent::Button::Left;
2795 mouse_event.x = 15; 2793 mouse_event.setPositionInWidget(15, 15);
2796 mouse_event.y = 15;
2797 mouse_event.clickCount = 1; 2794 mouse_event.clickCount = 1;
2798 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2795 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2799 mouse_event.setType(blink::WebInputEvent::MouseUp); 2796 mouse_event.setType(blink::WebInputEvent::MouseUp);
2800 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2797 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2801 2798
2802 waiter->WaitForFinished(); 2799 waiter->WaitForFinished();
2803 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2800 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2804 CheckDownloadStates(1, DownloadItem::COMPLETE); 2801 CheckDownloadStates(1, DownloadItem::COMPLETE);
2805 2802
2806 // Validate that the correct file was downloaded. 2803 // Validate that the correct file was downloaded.
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3803 browser(), 1, 3800 browser(), 1,
3804 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3801 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3805 ui_test_utils::NavigateToURL(browser(), extension_url); 3802 ui_test_utils::NavigateToURL(browser(), extension_url);
3806 3803
3807 observer->WaitForFinished(); 3804 observer->WaitForFinished();
3808 3805
3809 // Download shelf should close. 3806 // Download shelf should close.
3810 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3807 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3811 } 3808 }
3812 #endif // defined(OS_CHROMEOS) 3809 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698