| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 391 |
| 392 // Create another file | 392 // Create another file |
| 393 BaseFile second_file(FilePath(), | 393 BaseFile second_file(FilePath(), |
| 394 GURL(), | 394 GURL(), |
| 395 GURL(), | 395 GURL(), |
| 396 base_file_->bytes_so_far(), | 396 base_file_->bytes_so_far(), |
| 397 true, | 397 true, |
| 398 hash_state, | 398 hash_state, |
| 399 scoped_ptr<net::FileStream>(), | 399 scoped_ptr<net::FileStream>(), |
| 400 net::BoundNetLog()); | 400 net::BoundNetLog()); |
| 401 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 401 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
| 402 second_file.Initialize(temp_dir_.path())); | 402 second_file.Initialize(temp_dir_.path())); |
| 403 std::string data(kTestData3); | 403 std::string data(kTestData3); |
| 404 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 404 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 405 second_file.AppendDataToFile(data.data(), data.size())); | 405 second_file.AppendDataToFile(data.data(), data.size())); |
| 406 second_file.Finish(); | 406 second_file.Finish(); |
| 407 | 407 |
| 408 std::string hash; | 408 std::string hash; |
| 409 EXPECT_TRUE(second_file.GetHash(&hash)); | 409 EXPECT_TRUE(second_file.GetHash(&hash)); |
| 410 // This will fail until getting the hash state is supported in SecureHash. | 410 // This will fail until getting the hash state is supported in SecureHash. |
| 411 EXPECT_STREQ(expected_hash_hex.c_str(), | 411 EXPECT_STREQ(expected_hash_hex.c_str(), |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 FilePath temp_file; | 660 FilePath temp_file; |
| 661 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), | 661 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), |
| 662 &temp_file)); | 662 &temp_file)); |
| 663 ASSERT_FALSE(temp_file.empty()); | 663 ASSERT_FALSE(temp_file.empty()); |
| 664 EXPECT_STREQ(temp_file.DirName().value().c_str(), | 664 EXPECT_STREQ(temp_file.DirName().value().c_str(), |
| 665 base_file_->full_path().DirName().value().c_str()); | 665 base_file_->full_path().DirName().value().c_str()); |
| 666 base_file_->Finish(); | 666 base_file_->Finish(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace content | 669 } // namespace content |
| OLD | NEW |