OLD | NEW |
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 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 std::unique_ptr<content::DownloadTestObserver> waiter( | 2594 std::unique_ptr<content::DownloadTestObserver> waiter( |
2595 new content::DownloadTestObserverTerminal( | 2595 new content::DownloadTestObserverTerminal( |
2596 DownloadManagerForBrowser(browser()), 1, | 2596 DownloadManagerForBrowser(browser()), 1, |
2597 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); | 2597 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
2598 | 2598 |
2599 // Click on the link with the alt key pressed. This will download the link | 2599 // Click on the link with the alt key pressed. This will download the link |
2600 // target. | 2600 // target. |
2601 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2601 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2602 blink::WebMouseEvent mouse_event; | 2602 blink::WebMouseEvent mouse_event; |
2603 mouse_event.type = blink::WebInputEvent::MouseDown; | 2603 mouse_event.type = blink::WebInputEvent::MouseDown; |
2604 mouse_event.button = blink::WebMouseEvent::ButtonLeft; | 2604 mouse_event.button = blink::WebMouseEvent::Button::Left; |
2605 mouse_event.x = 15; | 2605 mouse_event.x = 15; |
2606 mouse_event.y = 15; | 2606 mouse_event.y = 15; |
2607 mouse_event.clickCount = 1; | 2607 mouse_event.clickCount = 1; |
2608 mouse_event.modifiers = blink::WebInputEvent::AltKey; | 2608 mouse_event.modifiers = blink::WebInputEvent::AltKey; |
2609 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 2609 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
2610 mouse_event.type = blink::WebInputEvent::MouseUp; | 2610 mouse_event.type = blink::WebInputEvent::MouseUp; |
2611 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 2611 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
2612 | 2612 |
2613 waiter->WaitForFinished(); | 2613 waiter->WaitForFinished(); |
2614 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); | 2614 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); | 2651 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
2652 | 2652 |
2653 // Right-click on the link and choose Save Link As. This will download the | 2653 // Right-click on the link and choose Save Link As. This will download the |
2654 // link target. | 2654 // link target. |
2655 ContextMenuNotificationObserver context_menu_observer( | 2655 ContextMenuNotificationObserver context_menu_observer( |
2656 IDC_CONTENT_CONTEXT_SAVELINKAS); | 2656 IDC_CONTENT_CONTEXT_SAVELINKAS); |
2657 | 2657 |
2658 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2658 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2659 blink::WebMouseEvent mouse_event; | 2659 blink::WebMouseEvent mouse_event; |
2660 mouse_event.type = blink::WebInputEvent::MouseDown; | 2660 mouse_event.type = blink::WebInputEvent::MouseDown; |
2661 mouse_event.button = blink::WebMouseEvent::ButtonRight; | 2661 mouse_event.button = blink::WebMouseEvent::Button::Right; |
2662 mouse_event.x = 15; | 2662 mouse_event.x = 15; |
2663 mouse_event.y = 15; | 2663 mouse_event.y = 15; |
2664 mouse_event.clickCount = 1; | 2664 mouse_event.clickCount = 1; |
2665 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 2665 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
2666 mouse_event.type = blink::WebInputEvent::MouseUp; | 2666 mouse_event.type = blink::WebInputEvent::MouseUp; |
2667 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); | 2667 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); |
2668 | 2668 |
2669 waiter->WaitForFinished(); | 2669 waiter->WaitForFinished(); |
2670 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); | 2670 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
2671 CheckDownloadStates(1, DownloadItem::COMPLETE); | 2671 CheckDownloadStates(1, DownloadItem::COMPLETE); |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3659 browser(), 1, | 3659 browser(), 1, |
3660 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3660 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
3661 ui_test_utils::NavigateToURL(browser(), extension_url); | 3661 ui_test_utils::NavigateToURL(browser(), extension_url); |
3662 | 3662 |
3663 observer->WaitForFinished(); | 3663 observer->WaitForFinished(); |
3664 | 3664 |
3665 // Download shelf should close. | 3665 // Download shelf should close. |
3666 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3666 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
3667 } | 3667 } |
3668 #endif // defined(OS_CHROMEOS) | 3668 #endif // defined(OS_CHROMEOS) |
OLD | NEW |