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 "content/browser/download/download_file_manager.h" | 5 #include "content/browser/download/download_file_manager.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // On Success, if final rename: | 288 // On Success, if final rename: |
289 // Process one message in the message loop | 289 // Process one message in the message loop |
290 // DownloadManager::OnDownloadRenamedToFinalName | 290 // DownloadManager::OnDownloadRenamedToFinalName |
291 MockDownloadFile* file = download_file_factory_->GetExistingFile(id); | 291 MockDownloadFile* file = download_file_factory_->GetExistingFile(id); |
292 ASSERT_TRUE(file != NULL); | 292 ASSERT_TRUE(file != NULL); |
293 | 293 |
294 FilePath unique_path = new_path; | 294 FilePath unique_path = new_path; |
295 int uniquifier = 0; | 295 int uniquifier = 0; |
296 | 296 |
297 if (is_complete && !replace) { | 297 if (is_complete && !replace) { |
298 uniquifier = content::DownloadFile::GetUniquePathNumber(new_path); | 298 uniquifier = |
| 299 file_util::GetUniquePathNumber(new_path, FILE_PATH_LITERAL("")); |
299 if (uniquifier > 0) | 300 if (uniquifier > 0) |
300 content::DownloadFile::AppendNumberToPath(&unique_path, uniquifier); | 301 file_util::AppendNumberToPath(&unique_path, uniquifier); |
301 } | 302 } |
302 | 303 |
303 EXPECT_CALL(*file, Rename(unique_path)) | 304 EXPECT_CALL(*file, Rename(unique_path)) |
304 .Times(1) | 305 .Times(1) |
305 .WillOnce(Return(error_to_insert)); | 306 .WillOnce(Return(error_to_insert)); |
306 | 307 |
307 if (error_to_insert != net::OK) { | 308 if (error_to_insert != net::OK) { |
308 EXPECT_CALL(*file, GetDownloadManager()); | 309 EXPECT_CALL(*file, GetDownloadManager()); |
309 | 310 |
310 EXPECT_CALL(*file, BytesSoFar()) | 311 EXPECT_CALL(*file, BytesSoFar()) |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 // DownloadFile::GetDownloadFile | 659 // DownloadFile::GetDownloadFile |
659 // Process one message in the message loop | 660 // Process one message in the message loop |
660 // DownloadManager::UpdateDownload | 661 // DownloadManager::UpdateDownload |
661 | 662 |
662 // TODO(ahendrickson) -- A test for download manager shutdown. | 663 // TODO(ahendrickson) -- A test for download manager shutdown. |
663 // Expected call sequence: | 664 // Expected call sequence: |
664 // OnDownloadManagerShutdown | 665 // OnDownloadManagerShutdown |
665 // DownloadFile::GetDownloadManager | 666 // DownloadFile::GetDownloadManager |
666 // DownloadFile::CancelDownloadRequest | 667 // DownloadFile::CancelDownloadRequest |
667 // DownloadFile::~DownloadFile | 668 // DownloadFile::~DownloadFile |
OLD | NEW |