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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 content::DownloadInterruptReason reason; | 267 content::DownloadInterruptReason reason; |
268 bool show_download_item; // True if the download item appears on the shelf. | 268 bool show_download_item; // True if the download item appears on the shelf. |
269 bool should_redirect_to_documents; // True if we save it in "My Documents". | 269 bool should_redirect_to_documents; // True if we save it in "My Documents". |
270 }; | 270 }; |
271 | 271 |
272 struct FileErrorInjectInfo { | 272 struct FileErrorInjectInfo { |
273 DownloadInfo download_info; | 273 DownloadInfo download_info; |
274 content::TestFileErrorInjector::FileErrorInfo error_info; | 274 content::TestFileErrorInjector::FileErrorInfo error_info; |
275 }; | 275 }; |
276 | 276 |
277 DownloadTest() { | 277 DownloadTest() {} |
278 EnableDOMAutomation(); | |
279 } | |
280 | 278 |
281 void SetUpOnMainThread() OVERRIDE { | 279 void SetUpOnMainThread() OVERRIDE { |
282 BrowserThread::PostTask( | 280 BrowserThread::PostTask( |
283 BrowserThread::IO, FROM_HERE, | 281 BrowserThread::IO, FROM_HERE, |
284 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 282 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
285 ASSERT_TRUE(InitialSetup()); | 283 ASSERT_TRUE(InitialSetup()); |
286 } | 284 } |
287 | 285 |
288 // Returning false indicates a failure of the setup, and should be asserted | 286 // Returning false indicates a failure of the setup, and should be asserted |
289 // in the caller. | 287 // in the caller. |
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 GetDownloads(browser(), &download_items); | 2496 GetDownloads(browser(), &download_items); |
2499 ASSERT_EQ(1u, download_items.size()); | 2497 ASSERT_EQ(1u, download_items.size()); |
2500 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2498 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
2501 download_items[0]->GetOriginalUrl()); | 2499 download_items[0]->GetOriginalUrl()); |
2502 | 2500 |
2503 // Check that the file contains the expected referrer. | 2501 // Check that the file contains the expected referrer. |
2504 FilePath file(download_items[0]->GetFullPath()); | 2502 FilePath file(download_items[0]->GetFullPath()); |
2505 std::string expected_contents = test_server()->GetURL("").spec(); | 2503 std::string expected_contents = test_server()->GetURL("").spec(); |
2506 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2504 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
2507 } | 2505 } |
OLD | NEW |