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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Fixed compile failures. 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.position.x = 15;
2634 mouse_event.y = 15; 2634 mouse_event.position.y = 15;
2635 mouse_event.clickCount = 1; 2635 mouse_event.clickCount = 1;
2636 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2636 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2637 mouse_event.setType(blink::WebInputEvent::MouseUp); 2637 mouse_event.setType(blink::WebInputEvent::MouseUp);
2638 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2638 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2639 2639
2640 waiter->WaitForFinished(); 2640 waiter->WaitForFinished();
2641 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2641 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2642 CheckDownloadStates(1, DownloadItem::COMPLETE); 2642 CheckDownloadStates(1, DownloadItem::COMPLETE);
2643 2643
2644 // Validate that the correct file was downloaded. 2644 // 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 2680 // Right-click on the link and choose Save Link As. This will download the
2681 // link target. 2681 // link target.
2682 ContextMenuNotificationObserver context_menu_observer( 2682 ContextMenuNotificationObserver context_menu_observer(
2683 IDC_CONTENT_CONTEXT_SAVELINKAS); 2683 IDC_CONTENT_CONTEXT_SAVELINKAS);
2684 2684
2685 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2685 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2686 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 2686 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
2687 blink::WebInputEvent::NoModifiers, 2687 blink::WebInputEvent::NoModifiers,
2688 blink::WebInputEvent::TimeStampForTesting); 2688 blink::WebInputEvent::TimeStampForTesting);
2689 mouse_event.button = blink::WebMouseEvent::Button::Right; 2689 mouse_event.button = blink::WebMouseEvent::Button::Right;
2690 mouse_event.x = 15; 2690 mouse_event.position.x = 15;
2691 mouse_event.y = 15; 2691 mouse_event.position.y = 15;
2692 mouse_event.clickCount = 1; 2692 mouse_event.clickCount = 1;
2693 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2693 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2694 mouse_event.setType(blink::WebInputEvent::MouseUp); 2694 mouse_event.setType(blink::WebInputEvent::MouseUp);
2695 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2695 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2696 2696
2697 waiter->WaitForFinished(); 2697 waiter->WaitForFinished();
2698 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2698 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2699 CheckDownloadStates(1, DownloadItem::COMPLETE); 2699 CheckDownloadStates(1, DownloadItem::COMPLETE);
2700 2700
2701 // Validate that the correct file was downloaded. 2701 // Validate that the correct file was downloaded.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 DownloadManagerForBrowser(browser()), 1, 2785 DownloadManagerForBrowser(browser()), 1,
2786 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2786 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2787 2787
2788 // Click on the link with the alt key pressed. This will download the link 2788 // Click on the link with the alt key pressed. This will download the link
2789 // target. 2789 // target.
2790 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2790 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2791 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 2791 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
2792 blink::WebInputEvent::AltKey, 2792 blink::WebInputEvent::AltKey,
2793 blink::WebInputEvent::TimeStampForTesting); 2793 blink::WebInputEvent::TimeStampForTesting);
2794 mouse_event.button = blink::WebMouseEvent::Button::Left; 2794 mouse_event.button = blink::WebMouseEvent::Button::Left;
2795 mouse_event.x = 15; 2795 mouse_event.position.x = 15;
2796 mouse_event.y = 15; 2796 mouse_event.position.y = 15;
2797 mouse_event.clickCount = 1; 2797 mouse_event.clickCount = 1;
2798 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2798 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2799 mouse_event.setType(blink::WebInputEvent::MouseUp); 2799 mouse_event.setType(blink::WebInputEvent::MouseUp);
2800 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 2800 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
2801 2801
2802 waiter->WaitForFinished(); 2802 waiter->WaitForFinished();
2803 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2803 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2804 CheckDownloadStates(1, DownloadItem::COMPLETE); 2804 CheckDownloadStates(1, DownloadItem::COMPLETE);
2805 2805
2806 // Validate that the correct file was downloaded. 2806 // Validate that the correct file was downloaded.
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
3804 browser(), 1, 3804 browser(), 1,
3805 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3805 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3806 ui_test_utils::NavigateToURL(browser(), extension_url); 3806 ui_test_utils::NavigateToURL(browser(), extension_url);
3807 3807
3808 observer->WaitForFinished(); 3808 observer->WaitForFinished();
3809 3809
3810 // Download shelf should close. 3810 // Download shelf should close.
3811 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3811 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3812 } 3812 }
3813 #endif // defined(OS_CHROMEOS) 3813 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698