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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 EXPECT_FALSE(DownloadFeedbackService::IsEnabledForDownload(item)); | 125 EXPECT_FALSE(DownloadFeedbackService::IsEnabledForDownload(item)); |
126 DownloadFeedbackService::MaybeStorePingsForDownload(result, &item, "a", "b"); | 126 DownloadFeedbackService::MaybeStorePingsForDownload(result, &item, "a", "b"); |
127 return DownloadFeedbackService::IsEnabledForDownload(item); | 127 return DownloadFeedbackService::IsEnabledForDownload(item); |
128 } | 128 } |
129 | 129 |
130 } // namespace | 130 } // namespace |
131 | 131 |
132 class DownloadFeedbackServiceTest : public testing::Test { | 132 class DownloadFeedbackServiceTest : public testing::Test { |
133 public: | 133 public: |
134 DownloadFeedbackServiceTest() | 134 DownloadFeedbackServiceTest() |
135 : file_task_runner_(content::BrowserThread::GetMessageLoopProxyForThread( | 135 : file_task_runner_(content::BrowserThread::GetTaskRunnerForThread( |
136 content::BrowserThread::FILE)), | 136 content::BrowserThread::FILE)), |
137 io_task_runner_(content::BrowserThread::GetMessageLoopProxyForThread( | 137 io_task_runner_(content::BrowserThread::GetTaskRunnerForThread( |
138 content::BrowserThread::IO)), | 138 content::BrowserThread::IO)), |
139 request_context_getter_( | 139 request_context_getter_( |
140 new net::TestURLRequestContextGetter(io_task_runner_)) { | 140 new net::TestURLRequestContextGetter(io_task_runner_)) {} |
141 } | |
142 | 141 |
143 void SetUp() override { | 142 void SetUp() override { |
144 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 143 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
145 DownloadFeedback::RegisterFactory(&download_feedback_factory_); | 144 DownloadFeedback::RegisterFactory(&download_feedback_factory_); |
146 } | 145 } |
147 | 146 |
148 void TearDown() override { DownloadFeedback::RegisterFactory(NULL); } | 147 void TearDown() override { DownloadFeedback::RegisterFactory(NULL); } |
149 | 148 |
150 base::FilePath CreateTestFile(int n) const { | 149 base::FilePath CreateTestFile(int n) const { |
151 base::FilePath upload_file_path( | 150 base::FilePath upload_file_path( |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // was deleted. | 368 // was deleted. |
370 EXPECT_FALSE(base::PathExists(file_path[2])); | 369 EXPECT_FALSE(base::PathExists(file_path[2])); |
371 | 370 |
372 // These files should still exist since the FakeDownloadFeedback does not | 371 // These files should still exist since the FakeDownloadFeedback does not |
373 // delete them. | 372 // delete them. |
374 EXPECT_TRUE(base::PathExists(file_path[0])); | 373 EXPECT_TRUE(base::PathExists(file_path[0])); |
375 EXPECT_TRUE(base::PathExists(file_path[1])); | 374 EXPECT_TRUE(base::PathExists(file_path[1])); |
376 } | 375 } |
377 | 376 |
378 } // namespace safe_browsing | 377 } // namespace safe_browsing |
OLD | NEW |