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 <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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 return true; | 347 return true; |
348 } | 348 } |
349 | 349 |
350 DownloadPrefs* GetDownloadPrefs(Browser* browser) { | 350 DownloadPrefs* GetDownloadPrefs(Browser* browser) { |
351 return DownloadPrefs::FromDownloadManager( | 351 return DownloadPrefs::FromDownloadManager( |
352 DownloadManagerForBrowser(browser)); | 352 DownloadManagerForBrowser(browser)); |
353 } | 353 } |
354 | 354 |
355 FilePath GetDownloadDirectory(Browser* browser) { | 355 FilePath GetDownloadDirectory(Browser* browser) { |
356 return GetDownloadPrefs(browser)->download_path(); | 356 return GetDownloadPrefs(browser)->DownloadPath(); |
357 } | 357 } |
358 | 358 |
359 // Create a DownloadTestObserverTerminal that will wait for the | 359 // Create a DownloadTestObserverTerminal that will wait for the |
360 // specified number of downloads to finish. | 360 // specified number of downloads to finish. |
361 DownloadTestObserver* CreateWaiter(Browser* browser, int num_downloads) { | 361 DownloadTestObserver* CreateWaiter(Browser* browser, int num_downloads) { |
362 DownloadManager* download_manager = DownloadManagerForBrowser(browser); | 362 DownloadManager* download_manager = DownloadManagerForBrowser(browser); |
363 return new DownloadTestObserverTerminal( | 363 return new DownloadTestObserverTerminal( |
364 download_manager, num_downloads, | 364 download_manager, num_downloads, |
365 true, // Bail on select file | 365 true, // Bail on select file |
366 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); | 366 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 GetDownloads(browser(), &download_items); | 2496 GetDownloads(browser(), &download_items); |
2497 ASSERT_EQ(1u, download_items.size()); | 2497 ASSERT_EQ(1u, download_items.size()); |
2498 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2498 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
2499 download_items[0]->GetOriginalUrl()); | 2499 download_items[0]->GetOriginalUrl()); |
2500 | 2500 |
2501 // Check that the file contains the expected referrer. | 2501 // Check that the file contains the expected referrer. |
2502 FilePath file(download_items[0]->GetFullPath()); | 2502 FilePath file(download_items[0]->GetFullPath()); |
2503 std::string expected_contents = test_server()->GetURL("").spec(); | 2503 std::string expected_contents = test_server()->GetURL("").spec(); |
2504 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2504 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
2505 } | 2505 } |
OLD | NEW |