| 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 "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/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 virtual void TearDown() OVERRIDE { | 145 virtual void TearDown() OVERRIDE { |
| 146 DownloadFeedback::RegisterFactory(NULL); | 146 DownloadFeedback::RegisterFactory(NULL); |
| 147 } | 147 } |
| 148 | 148 |
| 149 base::FilePath CreateTestFile(int n) const { | 149 base::FilePath CreateTestFile(int n) const { |
| 150 base::FilePath upload_file_path( | 150 base::FilePath upload_file_path( |
| 151 temp_dir_.path().AppendASCII("test file " + base::IntToString(n))); | 151 temp_dir_.path().AppendASCII("test file " + base::IntToString(n))); |
| 152 const std::string upload_file_data = "data"; | 152 const std::string upload_file_data = "data"; |
| 153 int wrote = file_util::WriteFile( | 153 int wrote = base::WriteFile( |
| 154 upload_file_path, upload_file_data.data(), upload_file_data.size()); | 154 upload_file_path, upload_file_data.data(), upload_file_data.size()); |
| 155 EXPECT_EQ(static_cast<int>(upload_file_data.size()), wrote); | 155 EXPECT_EQ(static_cast<int>(upload_file_data.size()), wrote); |
| 156 return upload_file_path; | 156 return upload_file_path; |
| 157 } | 157 } |
| 158 | 158 |
| 159 FakeDownloadFeedback* feedback(size_t n) const { | 159 FakeDownloadFeedback* feedback(size_t n) const { |
| 160 return download_feedback_factory_.feedback(n); | 160 return download_feedback_factory_.feedback(n); |
| 161 } | 161 } |
| 162 | 162 |
| 163 size_t num_feedbacks() const { | 163 size_t num_feedbacks() const { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // was deleted. | 364 // was deleted. |
| 365 EXPECT_FALSE(base::PathExists(file_path[2])); | 365 EXPECT_FALSE(base::PathExists(file_path[2])); |
| 366 | 366 |
| 367 // These files should still exist since the FakeDownloadFeedback does not | 367 // These files should still exist since the FakeDownloadFeedback does not |
| 368 // delete them. | 368 // delete them. |
| 369 EXPECT_TRUE(base::PathExists(file_path[0])); | 369 EXPECT_TRUE(base::PathExists(file_path[0])); |
| 370 EXPECT_TRUE(base::PathExists(file_path[1])); | 370 EXPECT_TRUE(base::PathExists(file_path[1])); |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace safe_browsing | 373 } // namespace safe_browsing |
| OLD | NEW |