| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "content/public/browser/download_interrupt_reasons.h" | 9 #include "content/public/browser/download_interrupt_reasons.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 target_directory.GetPath().Append(relative_path)); | 65 target_directory.GetPath().Append(relative_path)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 SCOPED_TRACE(::testing::Message() << "Source URL: " << url.spec() | 68 SCOPED_TRACE(::testing::Message() << "Source URL: " << url.spec() |
| 69 << " Referrer: " << test_case.referrer); | 69 << " Referrer: " << test_case.referrer); |
| 70 | 70 |
| 71 BaseFile base_file((net::NetLogWithSource())); | 71 BaseFile base_file((net::NetLogWithSource())); |
| 72 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 72 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 73 base_file.Initialize(base::FilePath(), target_directory.GetPath(), | 73 base_file.Initialize(base::FilePath(), target_directory.GetPath(), |
| 74 base::File(), 0, std::string(), | 74 base::File(), 0, std::string(), |
| 75 std::unique_ptr<crypto::SecureHash>())); | 75 std::unique_ptr<crypto::SecureHash>(), |
| 76 false)); |
| 76 ASSERT_FALSE(base_file.full_path().empty()); | 77 ASSERT_FALSE(base_file.full_path().empty()); |
| 77 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 78 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 78 base_file.Rename( | 79 base_file.Rename( |
| 79 target_directory.GetPath().AppendASCII("test_file.doc"))); | 80 target_directory.GetPath().AppendASCII("test_file.doc"))); |
| 80 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 81 ASSERT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 81 base_file.AnnotateWithSourceInformation( | 82 base_file.AnnotateWithSourceInformation( |
| 82 "7B2CEE7C-DC81-4160-86F1-9C968597118F", url, referrer)); | 83 "7B2CEE7C-DC81-4160-86F1-9C968597118F", url, referrer)); |
| 83 base_file.Detach(); | 84 base_file.Detach(); |
| 84 base_file.Finish(); | 85 base_file.Finish(); |
| 85 | 86 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 106 << " Referrer:" << test_case.referrer | 107 << " Referrer:" << test_case.referrer |
| 107 << " Annotation:" << std::endl | 108 << " Annotation:" << std::endl |
| 108 << zone_identifier; | 109 << zone_identifier; |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 base::DeleteFile(path, false); | 112 base::DeleteFile(path, false); |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace content | 116 } // namespace content |
| OLD | NEW |