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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 662 |
663 // Wait until the item is created, or we have determined that it | 663 // Wait until the item is created, or we have determined that it |
664 // won't be. | 664 // won't be. |
665 creation_observer->WaitForDownloadItemCreation(); | 665 creation_observer->WaitForDownloadItemCreation(); |
666 | 666 |
667 int32 invalid_id = content::DownloadId::Invalid().local(); | 667 int32 invalid_id = content::DownloadId::Invalid().local(); |
668 EXPECT_EQ(download_info.show_download_item, | 668 EXPECT_EQ(download_info.show_download_item, |
669 creation_observer->succeeded()); | 669 creation_observer->succeeded()); |
670 if (download_info.show_download_item) { | 670 if (download_info.show_download_item) { |
671 EXPECT_EQ(net::OK, creation_observer->error()); | 671 EXPECT_EQ(net::OK, creation_observer->error()); |
672 EXPECT_NE(invalid_id, creation_observer->download_id().local()); | 672 EXPECT_NE(invalid_id, creation_observer->download_id()); |
673 } else { | 673 } else { |
674 EXPECT_NE(net::OK, creation_observer->error()); | 674 EXPECT_NE(net::OK, creation_observer->error()); |
675 EXPECT_EQ(invalid_id, creation_observer->download_id().local()); | 675 EXPECT_EQ(invalid_id, creation_observer->download_id()); |
676 } | 676 } |
677 } else { | 677 } else { |
678 // Navigate to URL normally, wait until done. | 678 // Navigate to URL normally, wait until done. |
679 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), | 679 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), |
680 url, | 680 url, |
681 1); | 681 1); |
682 } | 682 } |
683 | 683 |
684 if (download_info.show_download_item) { | 684 if (download_info.show_download_item) { |
685 downloads_expected++; | 685 downloads_expected++; |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2237 GetDownloads(browser(), &download_items); | 2237 GetDownloads(browser(), &download_items); |
2238 ASSERT_EQ(1u, download_items.size()); | 2238 ASSERT_EQ(1u, download_items.size()); |
2239 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2239 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
2240 download_items[0]->GetOriginalUrl()); | 2240 download_items[0]->GetOriginalUrl()); |
2241 | 2241 |
2242 // Check that the file contains the expected referrer. | 2242 // Check that the file contains the expected referrer. |
2243 FilePath file(download_items[0]->GetFullPath()); | 2243 FilePath file(download_items[0]->GetFullPath()); |
2244 std::string expected_contents = test_server()->GetURL("").spec(); | 2244 std::string expected_contents = test_server()->GetURL("").spec(); |
2245 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2245 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
2246 } | 2246 } |
OLD | NEW |