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 if (uniquifier > 0) | 299 file_util::GetUniquePathNumber(new_path, FILE_PATH_LITERAL("")); |
300 content::DownloadFile::AppendNumberToPath(&unique_path, uniquifier); | 300 if (uniquifier > 0) { |
| 301 unique_path = unique_path.InsertBeforeExtensionASCII( |
| 302 StringPrintf(" (%d)", uniquifier)); |
| 303 } |
301 } | 304 } |
302 | 305 |
303 EXPECT_CALL(*file, Rename(unique_path)) | 306 EXPECT_CALL(*file, Rename(unique_path)) |
304 .Times(1) | 307 .Times(1) |
305 .WillOnce(Return(error_to_insert)); | 308 .WillOnce(Return(error_to_insert)); |
306 | 309 |
307 if (error_to_insert != net::OK) { | 310 if (error_to_insert != net::OK) { |
308 EXPECT_CALL(*file, GetDownloadManager()); | 311 EXPECT_CALL(*file, GetDownloadManager()); |
309 | 312 |
310 EXPECT_CALL(*file, BytesSoFar()) | 313 EXPECT_CALL(*file, BytesSoFar()) |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 // DownloadFile::GetDownloadFile | 661 // DownloadFile::GetDownloadFile |
659 // Process one message in the message loop | 662 // Process one message in the message loop |
660 // DownloadManager::UpdateDownload | 663 // DownloadManager::UpdateDownload |
661 | 664 |
662 // TODO(ahendrickson) -- A test for download manager shutdown. | 665 // TODO(ahendrickson) -- A test for download manager shutdown. |
663 // Expected call sequence: | 666 // Expected call sequence: |
664 // OnDownloadManagerShutdown | 667 // OnDownloadManagerShutdown |
665 // DownloadFile::GetDownloadManager | 668 // DownloadFile::GetDownloadManager |
666 // DownloadFile::CancelDownloadRequest | 669 // DownloadFile::CancelDownloadRequest |
667 // DownloadFile::~DownloadFile | 670 // DownloadFile::~DownloadFile |
OLD | NEW |