| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/safe_browsing/download_feedback_service.h" | 5 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 void SetUp() override { | 141 void SetUp() override { |
| 142 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 142 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 143 DownloadFeedback::RegisterFactory(&download_feedback_factory_); | 143 DownloadFeedback::RegisterFactory(&download_feedback_factory_); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void TearDown() override { DownloadFeedback::RegisterFactory(nullptr); } | 146 void TearDown() override { DownloadFeedback::RegisterFactory(nullptr); } |
| 147 | 147 |
| 148 base::FilePath CreateTestFile(int n) const { | 148 base::FilePath CreateTestFile(int n) const { |
| 149 base::FilePath upload_file_path( | 149 base::FilePath upload_file_path( |
| 150 temp_dir_.path().AppendASCII("test file " + base::IntToString(n))); | 150 temp_dir_.GetPath().AppendASCII("test file " + base::IntToString(n))); |
| 151 const std::string upload_file_data = "data"; | 151 const std::string upload_file_data = "data"; |
| 152 int wrote = base::WriteFile( | 152 int wrote = base::WriteFile( |
| 153 upload_file_path, upload_file_data.data(), upload_file_data.size()); | 153 upload_file_path, upload_file_data.data(), upload_file_data.size()); |
| 154 EXPECT_EQ(static_cast<int>(upload_file_data.size()), wrote); | 154 EXPECT_EQ(static_cast<int>(upload_file_data.size()), wrote); |
| 155 return upload_file_path; | 155 return upload_file_path; |
| 156 } | 156 } |
| 157 | 157 |
| 158 FakeDownloadFeedback* feedback(size_t n) const { | 158 FakeDownloadFeedback* feedback(size_t n) const { |
| 159 return download_feedback_factory_.feedback(n); | 159 return download_feedback_factory_.feedback(n); |
| 160 } | 160 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // was deleted. | 367 // was deleted. |
| 368 EXPECT_FALSE(base::PathExists(file_path[2])); | 368 EXPECT_FALSE(base::PathExists(file_path[2])); |
| 369 | 369 |
| 370 // These files should still exist since the FakeDownloadFeedback does not | 370 // These files should still exist since the FakeDownloadFeedback does not |
| 371 // delete them. | 371 // delete them. |
| 372 EXPECT_TRUE(base::PathExists(file_path[0])); | 372 EXPECT_TRUE(base::PathExists(file_path[0])); |
| 373 EXPECT_TRUE(base::PathExists(file_path[1])); | 373 EXPECT_TRUE(base::PathExists(file_path[1])); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace safe_browsing | 376 } // namespace safe_browsing |
| OLD | NEW |