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/base_file.h" | 5 #include "content/browser/download/base_file.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 ASSERT_TRUE(AppendDataToFile(kTestData2)); | 385 ASSERT_TRUE(AppendDataToFile(kTestData2)); |
386 // Get the hash state and file name. | 386 // Get the hash state and file name. |
387 std::string hash_state; | 387 std::string hash_state; |
388 hash_state = base_file_->GetHashState(); | 388 hash_state = base_file_->GetHashState(); |
389 // Finish the file. | 389 // Finish the file. |
390 base_file_->Finish(); | 390 base_file_->Finish(); |
391 | 391 |
392 base::FilePath new_file_path(temp_dir_.path().Append( | 392 base::FilePath new_file_path(temp_dir_.path().Append( |
393 base::FilePath(FILE_PATH_LITERAL("second_file")))); | 393 base::FilePath(FILE_PATH_LITERAL("second_file")))); |
394 | 394 |
395 ASSERT_TRUE(file_util::CopyFile(base_file_->full_path(), new_file_path)); | 395 ASSERT_TRUE(base::CopyFile(base_file_->full_path(), new_file_path)); |
396 | 396 |
397 // Create another file | 397 // Create another file |
398 BaseFile second_file(new_file_path, | 398 BaseFile second_file(new_file_path, |
399 GURL(), | 399 GURL(), |
400 GURL(), | 400 GURL(), |
401 base_file_->bytes_so_far(), | 401 base_file_->bytes_so_far(), |
402 true, | 402 true, |
403 hash_state, | 403 hash_state, |
404 scoped_ptr<net::FileStream>(), | 404 scoped_ptr<net::FileStream>(), |
405 net::BoundNetLog()); | 405 net::BoundNetLog()); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 base::FilePath temp_file; | 625 base::FilePath temp_file; |
626 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), | 626 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), |
627 &temp_file)); | 627 &temp_file)); |
628 ASSERT_FALSE(temp_file.empty()); | 628 ASSERT_FALSE(temp_file.empty()); |
629 EXPECT_STREQ(temp_file.DirName().value().c_str(), | 629 EXPECT_STREQ(temp_file.DirName().value().c_str(), |
630 base_file_->full_path().DirName().value().c_str()); | 630 base_file_->full_path().DirName().value().c_str()); |
631 base_file_->Finish(); | 631 base_file_->Finish(); |
632 } | 632 } |
633 | 633 |
634 } // namespace content | 634 } // namespace content |
OLD | NEW |