| 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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 if (info.download_info.show_download_item) | 796 if (info.download_info.show_download_item) |
| 797 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str(); | 797 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str(); |
| 798 } | 798 } |
| 799 | 799 |
| 800 void DownloadInsertFilesErrorCheckErrors(size_t count, | 800 void DownloadInsertFilesErrorCheckErrors(size_t count, |
| 801 FileErrorInjectInfo* info) { | 801 FileErrorInjectInfo* info) { |
| 802 DownloadFilesCheckErrorsSetup(); | 802 DownloadFilesCheckErrorsSetup(); |
| 803 | 803 |
| 804 // Set up file failures. | 804 // Set up file failures. |
| 805 scoped_refptr<content::TestFileErrorInjector> injector( | 805 scoped_refptr<content::TestFileErrorInjector> injector( |
| 806 content::TestFileErrorInjector::Create()); | 806 content::TestFileErrorInjector::Create( |
| 807 DownloadManagerForBrowser(browser()))); |
| 807 | 808 |
| 808 for (size_t i = 0; i < count; ++i) { | 809 for (size_t i = 0; i < count; ++i) { |
| 809 // Set up the full URL, for download file tracking. | 810 // Set up the full URL, for download file tracking. |
| 810 std::string server_path = "files/downloads/"; | 811 std::string server_path = "files/downloads/"; |
| 811 server_path += info[i].download_info.url_name; | 812 server_path += info[i].download_info.url_name; |
| 812 GURL url = test_server()->GetURL(server_path); | 813 GURL url = test_server()->GetURL(server_path); |
| 813 info[i].error_info.url = url.spec(); | 814 info[i].error_info.url = url.spec(); |
| 814 | 815 |
| 815 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i); | 816 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i); |
| 816 } | 817 } |
| (...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 GetDownloads(browser(), &download_items); | 2498 GetDownloads(browser(), &download_items); |
| 2498 ASSERT_EQ(1u, download_items.size()); | 2499 ASSERT_EQ(1u, download_items.size()); |
| 2499 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2500 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
| 2500 download_items[0]->GetOriginalUrl()); | 2501 download_items[0]->GetOriginalUrl()); |
| 2501 | 2502 |
| 2502 // Check that the file contains the expected referrer. | 2503 // Check that the file contains the expected referrer. |
| 2503 FilePath file(download_items[0]->GetFullPath()); | 2504 FilePath file(download_items[0]->GetFullPath()); |
| 2504 std::string expected_contents = test_server()->GetURL("").spec(); | 2505 std::string expected_contents = test_server()->GetURL("").spec(); |
| 2505 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2506 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
| 2506 } | 2507 } |
| OLD | NEW |