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

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

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 EXPECT_TRUE(DidShowFileChooser()); 2324 EXPECT_TRUE(DidShowFileChooser());
2325 ASSERT_EQ(1u, download_items.size()); 2325 ASSERT_EQ(1u, download_items.size());
2326 ASSERT_EQ(url, download_items[0]->GetOriginalUrl()); 2326 ASSERT_EQ(url, download_items[0]->GetOriginalUrl());
2327 2327
2328 // Try to download it via a context menu. 2328 // Try to download it via a context menu.
2329 scoped_ptr<content::DownloadTestObserver> waiter_context_menu( 2329 scoped_ptr<content::DownloadTestObserver> waiter_context_menu(
2330 new content::DownloadTestObserverTerminal( 2330 new content::DownloadTestObserverTerminal(
2331 DownloadManagerForBrowser(browser()), 1, 2331 DownloadManagerForBrowser(browser()), 1,
2332 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2332 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2333 content::ContextMenuParams context_menu_params; 2333 content::ContextMenuParams context_menu_params;
2334 context_menu_params.media_type = WebKit::WebContextMenuData::MediaTypeImage; 2334 context_menu_params.media_type = blink::WebContextMenuData::MediaTypeImage;
2335 context_menu_params.src_url = url; 2335 context_menu_params.src_url = url;
2336 context_menu_params.page_url = url; 2336 context_menu_params.page_url = url;
2337 TestRenderViewContextMenu menu( 2337 TestRenderViewContextMenu menu(
2338 browser()->tab_strip_model()->GetActiveWebContents(), 2338 browser()->tab_strip_model()->GetActiveWebContents(),
2339 context_menu_params); 2339 context_menu_params);
2340 menu.Init(); 2340 menu.Init();
2341 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0); 2341 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0);
2342 waiter_context_menu->WaitForFinished(); 2342 waiter_context_menu->WaitForFinished();
2343 EXPECT_EQ( 2343 EXPECT_EQ(
2344 1u, waiter_context_menu->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2344 1u, waiter_context_menu->NumDownloadsSeenInState(DownloadItem::COMPLETE));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 EXPECT_TRUE(DidShowFileChooser()); 2405 EXPECT_TRUE(DidShowFileChooser());
2406 ASSERT_EQ(1u, download_items.size()); 2406 ASSERT_EQ(1u, download_items.size());
2407 ASSERT_EQ(jpeg_url, download_items[0]->GetOriginalUrl()); 2407 ASSERT_EQ(jpeg_url, download_items[0]->GetOriginalUrl());
2408 2408
2409 // Try to download it via a context menu. 2409 // Try to download it via a context menu.
2410 scoped_ptr<content::DownloadTestObserver> waiter_context_menu( 2410 scoped_ptr<content::DownloadTestObserver> waiter_context_menu(
2411 new content::DownloadTestObserverTerminal( 2411 new content::DownloadTestObserverTerminal(
2412 DownloadManagerForBrowser(browser()), 1, 2412 DownloadManagerForBrowser(browser()), 1,
2413 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2413 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2414 content::ContextMenuParams context_menu_params; 2414 content::ContextMenuParams context_menu_params;
2415 context_menu_params.media_type = WebKit::WebContextMenuData::MediaTypeImage; 2415 context_menu_params.media_type = blink::WebContextMenuData::MediaTypeImage;
2416 context_menu_params.src_url = jpeg_url; 2416 context_menu_params.src_url = jpeg_url;
2417 context_menu_params.page_url = jpeg_url; 2417 context_menu_params.page_url = jpeg_url;
2418 TestRenderViewContextMenu menu(web_contents, context_menu_params); 2418 TestRenderViewContextMenu menu(web_contents, context_menu_params);
2419 menu.Init(); 2419 menu.Init();
2420 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0); 2420 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0);
2421 waiter_context_menu->WaitForFinished(); 2421 waiter_context_menu->WaitForFinished();
2422 EXPECT_EQ( 2422 EXPECT_EQ(
2423 1u, waiter_context_menu->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2423 1u, waiter_context_menu->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2424 CheckDownloadStates(2, DownloadItem::COMPLETE); 2424 CheckDownloadStates(2, DownloadItem::COMPLETE);
2425 2425
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 ui_test_utils::NavigateToURL(browser(), url); 2728 ui_test_utils::NavigateToURL(browser(), url);
2729 2729
2730 scoped_ptr<content::DownloadTestObserver> waiter( 2730 scoped_ptr<content::DownloadTestObserver> waiter(
2731 new content::DownloadTestObserverTerminal( 2731 new content::DownloadTestObserverTerminal(
2732 DownloadManagerForBrowser(browser()), 1, 2732 DownloadManagerForBrowser(browser()), 1,
2733 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2733 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2734 2734
2735 // Click on the link with the alt key pressed. This will download the link 2735 // Click on the link with the alt key pressed. This will download the link
2736 // target. 2736 // target.
2737 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2737 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2738 WebKit::WebMouseEvent mouse_event; 2738 blink::WebMouseEvent mouse_event;
2739 mouse_event.type = WebKit::WebInputEvent::MouseDown; 2739 mouse_event.type = blink::WebInputEvent::MouseDown;
2740 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 2740 mouse_event.button = blink::WebMouseEvent::ButtonLeft;
2741 mouse_event.x = 15; 2741 mouse_event.x = 15;
2742 mouse_event.y = 15; 2742 mouse_event.y = 15;
2743 mouse_event.clickCount = 1; 2743 mouse_event.clickCount = 1;
2744 mouse_event.modifiers = WebKit::WebInputEvent::AltKey; 2744 mouse_event.modifiers = blink::WebInputEvent::AltKey;
2745 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 2745 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
2746 mouse_event.type = WebKit::WebInputEvent::MouseUp; 2746 mouse_event.type = blink::WebInputEvent::MouseUp;
2747 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 2747 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
2748 2748
2749 waiter->WaitForFinished(); 2749 waiter->WaitForFinished();
2750 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); 2750 EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE));
2751 CheckDownloadStates(1, DownloadItem::COMPLETE); 2751 CheckDownloadStates(1, DownloadItem::COMPLETE);
2752 2752
2753 // Validate that the correct file was downloaded. 2753 // Validate that the correct file was downloaded.
2754 GetDownloads(browser(), &download_items); 2754 GetDownloads(browser(), &download_items);
2755 ASSERT_EQ(1u, download_items.size()); 2755 ASSERT_EQ(1u, download_items.size());
2756 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), 2756 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"),
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 3243
3244 // No errors this time. The download should complete successfully. 3244 // No errors this time. The download should complete successfully.
3245 EXPECT_FALSE(completion_observer->IsFinished()); 3245 EXPECT_FALSE(completion_observer->IsFinished());
3246 completion_observer->StartObserving(); 3246 completion_observer->StartObserving();
3247 download->Resume(); 3247 download->Resume();
3248 completion_observer->WaitForFinished(); 3248 completion_observer->WaitForFinished();
3249 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3249 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3250 3250
3251 EXPECT_FALSE(DidShowFileChooser()); 3251 EXPECT_FALSE(DidShowFileChooser());
3252 } 3252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698