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.h" | 5 #include "chrome/browser/safe_browsing/download_feedback.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 "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 base_url, metadata, file_path, progress_callback, | 93 base_url, metadata, file_path, progress_callback, |
94 finish_callback); | 94 finish_callback); |
95 return uploader_; | 95 return uploader_; |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 class DownloadFeedbackTest : public testing::Test { | 100 class DownloadFeedbackTest : public testing::Test { |
101 public: | 101 public: |
102 DownloadFeedbackTest() | 102 DownloadFeedbackTest() |
103 : file_task_runner_(content::BrowserThread::GetMessageLoopProxyForThread( | 103 : file_task_runner_(content::BrowserThread::GetTaskRunnerForThread( |
104 content::BrowserThread::FILE)), | 104 content::BrowserThread::FILE)), |
105 io_task_runner_(content::BrowserThread::GetMessageLoopProxyForThread( | 105 io_task_runner_(content::BrowserThread::GetTaskRunnerForThread( |
106 content::BrowserThread::IO)), | 106 content::BrowserThread::IO)), |
107 url_request_context_getter_( | 107 url_request_context_getter_( |
108 new net::TestURLRequestContextGetter(io_task_runner_)), | 108 new net::TestURLRequestContextGetter(io_task_runner_)), |
109 feedback_finish_called_(false) { | 109 feedback_finish_called_(false) { |
110 EXPECT_NE(io_task_runner_, file_task_runner_); | 110 EXPECT_NE(io_task_runner_, file_task_runner_); |
111 } | 111 } |
112 | 112 |
113 void SetUp() override { | 113 void SetUp() override { |
114 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 114 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
115 upload_file_path_ = temp_dir_.path().AppendASCII("test file"); | 115 upload_file_path_ = temp_dir_.path().AppendASCII("test file"); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_TRUE(base::PathExists(upload_file_path_)); | 223 EXPECT_TRUE(base::PathExists(upload_file_path_)); |
224 | 224 |
225 delete feedback; | 225 delete feedback; |
226 EXPECT_FALSE(feedback_finish_called_); | 226 EXPECT_FALSE(feedback_finish_called_); |
227 | 227 |
228 base::RunLoop().RunUntilIdle(); | 228 base::RunLoop().RunUntilIdle(); |
229 EXPECT_FALSE(base::PathExists(upload_file_path_)); | 229 EXPECT_FALSE(base::PathExists(upload_file_path_)); |
230 } | 230 } |
231 | 231 |
232 } // namespace safe_browsing | 232 } // namespace safe_browsing |
OLD | NEW |