Index: chrome/browser/download/download_browsertest.cc |
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc |
index 1343d31c46c45a359ef442a0c6c9ca3304243b4f..3acc17dc46e82d441a515c5b0e9c5afc0c94af90 100644 |
--- a/chrome/browser/download/download_browsertest.cc |
+++ b/chrome/browser/download/download_browsertest.cc |
@@ -23,8 +23,6 @@ |
#include "chrome/browser/download/download_history.h" |
#include "chrome/browser/download/download_prefs.h" |
#include "chrome/browser/download/download_request_limiter.h" |
-#include "chrome/browser/download/download_service.h" |
-#include "chrome/browser/download/download_service_factory.h" |
#include "chrome/browser/download/download_shelf.h" |
#include "chrome/browser/download/download_test_observer.h" |
#include "chrome/browser/download/download_util.h" |
@@ -87,21 +85,6 @@ const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); |
const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; |
const FilePath kLargeThemePath(FILE_PATH_LITERAL("extensions/theme2.crx")); |
-class PickSuggestedFileDelegate : public ChromeDownloadManagerDelegate { |
- public: |
- explicit PickSuggestedFileDelegate(Profile* profile) |
- : ChromeDownloadManagerDelegate(profile) { |
- } |
- |
- virtual void ChooseDownloadPath(DownloadItem* item) OVERRIDE { |
- if (download_manager_) |
- download_manager_->FileSelected(item->GetTargetFilePath(), item->GetId()); |
- } |
- |
- protected: |
- virtual ~PickSuggestedFileDelegate() {} |
-}; |
- |
// Get History Information. |
class DownloadsHistoryDataCollector { |
public: |
@@ -248,12 +231,6 @@ class MockDownloadOpeningObserver : public DownloadManager::Observer { |
class DownloadTest : public InProcessBrowserTest { |
public: |
- enum SelectExpectation { |
- EXPECT_NO_SELECT_DIALOG = -1, |
- EXPECT_NOTHING, |
- EXPECT_SELECT_DIALOG |
- }; |
- |
// Choice of navigation or direct fetch. Used by |DownloadFileCheckErrors()|. |
enum DownloadMethod { |
DOWNLOAD_NAVIGATE, |
@@ -277,13 +254,20 @@ class DownloadTest : public InProcessBrowserTest { |
DownloadTest() {} |
- void SetUpOnMainThread() OVERRIDE { |
+ virtual void SetUpOnMainThread() OVERRIDE { |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
ASSERT_TRUE(InitialSetup()); |
} |
+ virtual void CleanUpOnMainThread() OVERRIDE { |
+ // Needs to be torn down on the main thread. file_chooser_observer_ holds a |
+ // reference to the ChromeDownloadManagerDelegate which should be destroyed |
+ // on the UI thread. |
+ file_chooser_observer_.reset(); |
+ } |
+ |
// Returning false indicates a failure of the setup, and should be asserted |
// in the caller. |
virtual bool InitialSetup() { |
@@ -310,6 +294,9 @@ class DownloadTest : public InProcessBrowserTest { |
DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); |
manager->RemoveAllDownloads(); |
+ file_chooser_observer_.reset( |
+ new DownloadTestFileChooserObserver(browser()->profile())); |
+ |
return true; |
} |
@@ -363,7 +350,6 @@ class DownloadTest : public InProcessBrowserTest { |
DownloadManager* download_manager = DownloadManagerForBrowser(browser); |
return new DownloadTestObserverTerminal( |
download_manager, num_downloads, |
- true, // Bail on select file |
DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
} |
@@ -373,7 +359,7 @@ class DownloadTest : public InProcessBrowserTest { |
int num_downloads) { |
DownloadManager* download_manager = DownloadManagerForBrowser(browser); |
return new DownloadTestObserverInProgress( |
- download_manager, num_downloads, true); // Bail on select file. |
+ download_manager, num_downloads); |
} |
// Create a DownloadTestObserverTerminal that will wait for the |
@@ -386,7 +372,6 @@ class DownloadTest : public InProcessBrowserTest { |
DownloadManager* download_manager = DownloadManagerForBrowser(browser); |
return new DownloadTestObserverTerminal( |
download_manager, num_downloads, |
- true, // Bail on select file |
dangerous_download_action); |
} |
@@ -410,16 +395,11 @@ class DownloadTest : public InProcessBrowserTest { |
// Download |url|, then wait for the download to finish. |
// |disposition| indicates where the navigation occurs (current tab, new |
// foreground tab, etc). |
- // |expectation| indicates whether or not a Select File dialog should be |
- // open when the download is finished, or if we don't care. |
- // If the dialog appears, the routine exits. The only effect |expectation| |
- // has is whether or not the test succeeds. |
// |browser_test_flags| indicate what to wait for, and is an OR of 0 or more |
// values in the ui_test_utils::BrowserTestWaitFlags enum. |
void DownloadAndWaitWithDisposition(Browser* browser, |
const GURL& url, |
WindowOpenDisposition disposition, |
- SelectExpectation expectation, |
int browser_test_flags) { |
// Setup notification, navigate, and block. |
scoped_ptr<DownloadTestObserver> observer(CreateWaiter(browser, 1)); |
@@ -432,23 +412,17 @@ class DownloadTest : public InProcessBrowserTest { |
// Waits for the download to complete. |
observer->WaitForFinished(); |
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
- |
- // If specified, check the state of the select file dialog. |
- if (expectation != EXPECT_NOTHING) { |
- EXPECT_EQ(expectation == EXPECT_SELECT_DIALOG, |
- observer->select_file_dialog_seen()); |
- } |
+ // We don't expect a file chooser to be shown. |
+ EXPECT_FALSE(DidShowFileChooser()); |
} |
// Download a file in the current tab, then wait for the download to finish. |
void DownloadAndWait(Browser* browser, |
- const GURL& url, |
- SelectExpectation expectation) { |
+ const GURL& url) { |
DownloadAndWaitWithDisposition( |
browser, |
url, |
CURRENT_TAB, |
- expectation, |
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
} |
@@ -581,15 +555,12 @@ class DownloadTest : public InProcessBrowserTest { |
EXPECT_EQ(expected, BrowserList::size()); |
} |
- // Arrange for select file calls on the given browser from the |
- // download manager to always choose the suggested file. |
- void NullSelectFile(Browser* browser) { |
- PickSuggestedFileDelegate* new_delegate = |
- new PickSuggestedFileDelegate(browser->profile()); |
+ void EnableFileChooser(bool enable) { |
+ file_chooser_observer_->EnableFileChooser(enable); |
+ } |
- // Gives ownership to DownloadService. |
- DownloadServiceFactory::GetForProfile( |
- browser->profile())->SetDownloadManagerDelegateForTesting(new_delegate); |
+ bool DidShowFileChooser() { |
+ return file_chooser_observer_->TestAndResetDidShowFileChooser(); |
} |
// Checks that |path| is has |file_size| bytes, and matches the |value| |
@@ -629,7 +600,7 @@ class DownloadTest : public InProcessBrowserTest { |
GetDownloads(browser(), &download_items); |
ASSERT_TRUE(download_items.empty()); |
- NullSelectFile(browser()); |
+ EnableFileChooser(true); |
} |
void DownloadFilesCheckErrorsLoopBody(const DownloadInfo& download_info, |
@@ -662,7 +633,6 @@ class DownloadTest : public InProcessBrowserTest { |
new DownloadTestObserverTerminal( |
download_manager, |
1, |
- false, // Don't bail on select file. |
DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
if (download_info.download_method == DOWNLOAD_DIRECT) { |
@@ -866,6 +836,8 @@ class DownloadTest : public InProcessBrowserTest { |
// Location of the downloads directory for these tests |
ScopedTempDir downloads_directory_; |
+ |
+ scoped_ptr<DownloadTestFileChooserObserver> file_chooser_observer_; |
}; |
// NOTES: |
@@ -880,7 +852,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) { |
GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
// Download the file and wait. We do not expect the Select File dialog. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
// Check state. |
EXPECT_EQ(1, browser()->tab_count()); |
@@ -896,7 +868,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) { |
GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
// Download the file and wait. We do not expect the Select File dialog. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
// Check state. Special file state must be checked before CheckDownload, |
// as CheckDownload will delete the output file. |
@@ -918,7 +890,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeTypeSelect) { |
FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
- NullSelectFile(browser()); |
+ EnableFileChooser(true); |
// Download the file and wait. We expect the Select File dialog to appear |
// due to the MIME type, but we still wait until the download completes. |
@@ -926,7 +898,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeTypeSelect) { |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), |
1, |
- false, // Continue on select file. |
DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
ui_test_utils::NavigateToURLWithDisposition( |
browser(), url, CURRENT_TAB, |
@@ -934,7 +905,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeTypeSelect) { |
observer->WaitForFinished(); |
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
CheckDownloadStates(1, DownloadItem::COMPLETE); |
- EXPECT_TRUE(observer->select_file_dialog_seen()); |
+ EXPECT_TRUE(DidShowFileChooser()); |
// Check state. |
EXPECT_EQ(1, browser()->tab_count()); |
@@ -1061,7 +1032,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, ContentDisposition) { |
FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); |
// Download a file and wait. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
CheckDownload(browser(), download_file, file); |
@@ -1079,7 +1050,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) { |
FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); |
// Download a file and wait. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
CheckDownload(browser(), download_file, file); |
@@ -1113,7 +1084,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseShelfOnDownloadsTab) { |
GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
// Download the file and wait. We do not expect the Select File dialog. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
// Check state. |
EXPECT_EQ(1, browser()->tab_count()); |
@@ -1161,7 +1132,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, IncognitoDownload) { |
// Since |incognito| is a separate browser, we have to set it up explicitly. |
incognito->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, |
false); |
- DownloadAndWait(incognito, url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(incognito, url); |
// We should still have 2 windows. |
ExpectWindowCountAfterDownload(2); |
@@ -1225,7 +1196,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) { |
browser(), |
url, |
NEW_BACKGROUND_TAB, |
- EXPECT_NO_SELECT_DIALOG, |
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
// When the download finishes, we should still have one tab. |
@@ -1256,7 +1226,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab2) { |
DownloadAndWaitWithDisposition(browser(), |
GURL("javascript:openNew()"), |
CURRENT_TAB, |
- EXPECT_NO_SELECT_DIALOG, |
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
// When the download finishes, we should have two tabs. |
@@ -1297,7 +1266,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) { |
DownloadAndWaitWithDisposition(browser(), |
url, |
CURRENT_TAB, |
- EXPECT_NO_SELECT_DIALOG, |
ui_test_utils::BROWSER_TEST_NONE); |
// When the download finishes, we should have two tabs. |
@@ -1329,7 +1297,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab2) { |
DownloadAndWaitWithDisposition(browser(), |
GURL("javascript:openNew()"), |
CURRENT_TAB, |
- EXPECT_NO_SELECT_DIALOG, |
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
// When the download finishes, we should still have one tab. |
@@ -1363,7 +1330,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab3) { |
browser(), |
GURL("javascript:document.getElementById('form').submit()"), |
CURRENT_TAB, |
- EXPECT_NO_SELECT_DIALOG, |
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
// When the download finishes, we should still have one tab. |
@@ -1392,7 +1358,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { |
DownloadAndWaitWithDisposition(browser(), |
url, |
NEW_WINDOW, |
- EXPECT_NO_SELECT_DIALOG, |
ui_test_utils::BROWSER_TEST_NONE); |
// When the download finishes, the download shelf SHOULD NOT be visible in |
@@ -1462,7 +1427,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MultiDownload) { |
FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
// Download the file and wait. We do not expect the Select File dialog. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
// Should now have 2 items on the download shelf. |
downloads.clear(); |
@@ -1567,7 +1532,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { |
file_util::GetFileSize(origin_file, &origin_size); |
// Download the file and wait. We do not expect the Select File dialog. |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
// Get details of what downloads have just happened. |
std::vector<DownloadItem*> downloads; |
@@ -1603,7 +1568,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { |
GURL extensions_url(chrome::kChromeUIExtensionsFrameURL); |
ui_test_utils::NavigateToURL(browser(), flags_url); |
- DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), download_url); |
ui_test_utils::NavigateToURL(browser(), extensions_url); |
WebContents* contents = chrome::GetActiveWebContents(browser()); |
ASSERT_TRUE(contents); |
@@ -1636,7 +1601,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) { |
&result)); |
EXPECT_TRUE(result); |
- DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), download_url); |
content::WindowedNotificationObserver signal( |
chrome::NOTIFICATION_BROWSER_CLOSED, |
@@ -1678,7 +1643,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) { |
MockDownloadOpeningObserver observer( |
DownloadManagerForBrowser(browser())); |
- DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
+ DownloadAndWait(browser(), url); |
// Find the download and confirm it was opened. |
std::vector<DownloadItem*> downloads; |
@@ -1980,7 +1945,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrl) { |
GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
// DownloadUrl always prompts; return acceptance of whatever it prompts. |
- NullSelectFile(browser()); |
+ EnableFileChooser(true); |
WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
ASSERT_TRUE(web_contents); |
@@ -1988,7 +1953,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrl) { |
DownloadTestObserver* observer( |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), 1, |
- false, // Ignore select file. |
DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
content::DownloadSaveInfo save_info; |
save_info.prompt_for_save_location = true; |
@@ -1998,7 +1962,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrl) { |
observer->WaitForFinished(); |
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
CheckDownloadStates(1, DownloadItem::COMPLETE); |
- EXPECT_TRUE(observer->select_file_dialog_seen()); |
+ EXPECT_TRUE(DidShowFileChooser()); |
// Check state. |
EXPECT_EQ(1, browser()->tab_count()); |
@@ -2040,7 +2004,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) { |
IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { |
// Do initial setup. |
ASSERT_TRUE(test_server()->Start()); |
- NullSelectFile(browser()); |
+ EnableFileChooser(true); |
std::vector<DownloadItem*> download_items; |
GetDownloads(browser(), &download_items); |
ASSERT_TRUE(download_items.empty()); |
@@ -2059,7 +2023,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { |
scoped_ptr<DownloadTestObserver> waiter( |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), 1, |
- false, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
+ DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
chrome::SavePage(browser()); |
waiter->WaitForFinished(); |
EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
@@ -2067,7 +2031,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { |
// Validate that the correct file was downloaded. |
GetDownloads(browser(), &download_items); |
- EXPECT_TRUE(waiter->select_file_dialog_seen()); |
+ EXPECT_TRUE(DidShowFileChooser()); |
ASSERT_EQ(1u, download_items.size()); |
ASSERT_EQ(url, download_items[0]->GetOriginalUrl()); |
@@ -2075,7 +2039,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { |
scoped_ptr<DownloadTestObserver> waiter_context_menu( |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), 1, |
- false, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
+ DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
content::ContextMenuParams context_menu_params; |
context_menu_params.media_type = WebKit::WebContextMenuData::MediaTypeImage; |
context_menu_params.src_url = url; |
@@ -2092,7 +2056,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { |
// Validate that the correct file was downloaded via the context menu. |
download_items.clear(); |
GetDownloads(browser(), &download_items); |
- EXPECT_TRUE(waiter_context_menu->select_file_dialog_seen()); |
+ EXPECT_TRUE(DidShowFileChooser()); |
ASSERT_EQ(2u, download_items.size()); |
ASSERT_EQ(url, download_items[0]->GetOriginalUrl()); |
ASSERT_EQ(url, download_items[1]->GetOriginalUrl()); |
@@ -2101,7 +2065,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { |
IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { |
// Do initial setup. |
ASSERT_TRUE(test_server()->Start()); |
- NullSelectFile(browser()); |
+ EnableFileChooser(true); |
std::vector<DownloadItem*> download_items; |
GetDownloads(browser(), &download_items); |
ASSERT_TRUE(download_items.empty()); |
@@ -2138,7 +2102,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { |
scoped_ptr<DownloadTestObserver> waiter( |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), 1, |
- false, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
+ DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
chrome::SavePage(browser()); |
waiter->WaitForFinished(); |
EXPECT_EQ(1u, waiter->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
@@ -2146,7 +2110,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { |
// Validate that the correct file was downloaded. |
GetDownloads(browser(), &download_items); |
- EXPECT_TRUE(waiter->select_file_dialog_seen()); |
+ EXPECT_TRUE(DidShowFileChooser()); |
ASSERT_EQ(1u, download_items.size()); |
ASSERT_EQ(jpeg_url, download_items[0]->GetOriginalUrl()); |
@@ -2154,7 +2118,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { |
scoped_ptr<DownloadTestObserver> waiter_context_menu( |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), 1, |
- false, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
+ DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
content::ContextMenuParams context_menu_params; |
context_menu_params.media_type = WebKit::WebContextMenuData::MediaTypeImage; |
context_menu_params.src_url = jpeg_url; |
@@ -2170,7 +2134,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { |
// Validate that the correct file was downloaded via the context menu. |
download_items.clear(); |
GetDownloads(browser(), &download_items); |
- EXPECT_TRUE(waiter_context_menu->select_file_dialog_seen()); |
+ EXPECT_TRUE(DidShowFileChooser()); |
ASSERT_EQ(2u, download_items.size()); |
ASSERT_EQ(jpeg_url, download_items[0]->GetOriginalUrl()); |
ASSERT_EQ(jpeg_url, download_items[1]->GetOriginalUrl()); |
@@ -2459,7 +2423,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadDangerousBlobData) { |
IN_PROC_BROWSER_TEST_F(DownloadTest, LoadURLExternallyReferrerPolicy) { |
// Do initial setup. |
ASSERT_TRUE(test_server()->Start()); |
- NullSelectFile(browser()); |
+ EnableFileChooser(true); |
std::vector<DownloadItem*> download_items; |
GetDownloads(browser(), &download_items); |
ASSERT_TRUE(download_items.empty()); |
@@ -2473,7 +2437,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, LoadURLExternallyReferrerPolicy) { |
scoped_ptr<DownloadTestObserver> waiter( |
new DownloadTestObserverTerminal( |
DownloadManagerForBrowser(browser()), 1, |
- false, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
+ DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); |
// Click on the link with the alt key pressed. This will download the link |
// target. |