| 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 // automatically, and that the download shelf is visible in the current tab. | 1194 // automatically, and that the download shelf is visible in the current tab. |
| 1195 IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) { | 1195 IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) { |
| 1196 // Download a file in a new background tab and wait. The tab is automatically | 1196 // Download a file in a new background tab and wait. The tab is automatically |
| 1197 // closed when the download begins. | 1197 // closed when the download begins. |
| 1198 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1198 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
| 1199 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1199 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 1200 DownloadAndWaitWithDisposition( | 1200 DownloadAndWaitWithDisposition( |
| 1201 browser(), | 1201 browser(), |
| 1202 url, | 1202 url, |
| 1203 NEW_BACKGROUND_TAB, | 1203 NEW_BACKGROUND_TAB, |
| 1204 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1204 0); |
| 1205 | 1205 |
| 1206 // When the download finishes, we should still have one tab. | 1206 // When the download finishes, we should still have one tab. |
| 1207 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 1207 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
| 1208 EXPECT_EQ(1, browser()->tab_count()); | 1208 EXPECT_EQ(1, browser()->tab_count()); |
| 1209 | 1209 |
| 1210 CheckDownload(browser(), file, file); | 1210 CheckDownload(browser(), file, file); |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 // Open a web page in the current tab, then download a file in another tab via | 1213 // Open a web page in the current tab, then download a file in another tab via |
| 1214 // a Javascript call. | 1214 // a Javascript call. |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 GetDownloads(browser(), &download_items); | 2469 GetDownloads(browser(), &download_items); |
| 2470 ASSERT_EQ(1u, download_items.size()); | 2470 ASSERT_EQ(1u, download_items.size()); |
| 2471 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2471 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
| 2472 download_items[0]->GetOriginalUrl()); | 2472 download_items[0]->GetOriginalUrl()); |
| 2473 | 2473 |
| 2474 // Check that the file contains the expected referrer. | 2474 // Check that the file contains the expected referrer. |
| 2475 FilePath file(download_items[0]->GetFullPath()); | 2475 FilePath file(download_items[0]->GetFullPath()); |
| 2476 std::string expected_contents = test_server()->GetURL("").spec(); | 2476 std::string expected_contents = test_server()->GetURL("").spec(); |
| 2477 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2477 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
| 2478 } | 2478 } |
| OLD | NEW |