| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool DownloadStoredProperly( | 141 bool DownloadStoredProperly( |
| 142 const GURL& expected_url, | 142 const GURL& expected_url, |
| 143 const FilePath& expected_path, | 143 const FilePath& expected_path, |
| 144 int64 num_files, | 144 int64 num_files, |
| 145 DownloadItem::DownloadState expected_state, | 145 DownloadItem::DownloadState expected_state, |
| 146 DownloadItem* item, | 146 DownloadItem* item, |
| 147 const history::DownloadRow& info) { | 147 const history::DownloadRow& info) { |
| 148 // This function may be called multiple times for a given test. Returning | 148 // This function may be called multiple times for a given test. Returning |
| 149 // false doesn't necessarily mean that the test has failed or will fail, it | 149 // false doesn't necessarily mean that the test has failed or will fail, it |
| 150 // might just mean that the test hasn't passed yet. | 150 // might just mean that the test hasn't passed yet. |
| 151 if (info.path != expected_path) { | 151 if (info.target_path != expected_path) { |
| 152 VLOG(20) << __FUNCTION__ << " " << info.path.value() | 152 VLOG(20) << __FUNCTION__ << " " << info.target_path.value() |
| 153 << " != " << expected_path.value(); | 153 << " != " << expected_path.value(); |
| 154 return false; | 154 return false; |
| 155 } | 155 } |
| 156 if (info.url != expected_url) { | 156 if (info.url_chain.size() != 1u) { |
| 157 VLOG(20) << __FUNCTION__ << " " << info.url.spec() | 157 VLOG(20) << __FUNCTION__ << " " << info.url_chain.size() |
| 158 << " != 1"; |
| 159 return false; |
| 160 } |
| 161 if (info.url_chain[0] != expected_url) { |
| 162 VLOG(20) << __FUNCTION__ << " " << info.url_chain[0].spec() |
| 158 << " != " << expected_url.spec(); | 163 << " != " << expected_url.spec(); |
| 159 return false; | 164 return false; |
| 160 } | 165 } |
| 161 if ((num_files >= 0) && (info.received_bytes != num_files)) { | 166 if ((num_files >= 0) && (info.received_bytes != num_files)) { |
| 162 VLOG(20) << __FUNCTION__ << " " << num_files | 167 VLOG(20) << __FUNCTION__ << " " << num_files |
| 163 << " != " << info.received_bytes; | 168 << " != " << info.received_bytes; |
| 164 return false; | 169 return false; |
| 165 } | 170 } |
| 166 if (info.state != expected_state) { | 171 if (info.state != expected_state) { |
| 167 VLOG(20) << __FUNCTION__ << " " << info.state | 172 VLOG(20) << __FUNCTION__ << " " << info.state |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 DownloadItem::COMPLETE)); | 695 DownloadItem::COMPLETE)); |
| 691 chrome::SavePage(browser()); | 696 chrome::SavePage(browser()); |
| 692 ASSERT_TRUE(WaitForSavePackageToFinish(browser(), url)); | 697 ASSERT_TRUE(WaitForSavePackageToFinish(browser(), url)); |
| 693 persisted.WaitForPersisted(); | 698 persisted.WaitForPersisted(); |
| 694 | 699 |
| 695 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 700 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
| 696 int64 actual_file_size = -1; | 701 int64 actual_file_size = -1; |
| 697 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); | 702 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); |
| 698 EXPECT_LE(kFileSizeMin, actual_file_size); | 703 EXPECT_LE(kFileSizeMin, actual_file_size); |
| 699 } | 704 } |
| OLD | NEW |