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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 io_task_runner_(content::BrowserThread::GetTaskRunnerForThread( | 106 io_task_runner_(content::BrowserThread::GetTaskRunnerForThread( |
107 content::BrowserThread::IO)), | 107 content::BrowserThread::IO)), |
108 url_request_context_getter_( | 108 url_request_context_getter_( |
109 new net::TestURLRequestContextGetter(io_task_runner_)), | 109 new net::TestURLRequestContextGetter(io_task_runner_)), |
110 feedback_finish_called_(false) { | 110 feedback_finish_called_(false) { |
111 EXPECT_NE(io_task_runner_, file_task_runner_); | 111 EXPECT_NE(io_task_runner_, file_task_runner_); |
112 } | 112 } |
113 | 113 |
114 void SetUp() override { | 114 void SetUp() override { |
115 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 115 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
116 upload_file_path_ = temp_dir_.path().AppendASCII("test file"); | 116 upload_file_path_ = temp_dir_.GetPath().AppendASCII("test file"); |
117 upload_file_data_ = "data"; | 117 upload_file_data_ = "data"; |
118 ASSERT_EQ(static_cast<int>(upload_file_data_.size()), | 118 ASSERT_EQ(static_cast<int>(upload_file_data_.size()), |
119 base::WriteFile(upload_file_path_, upload_file_data_.data(), | 119 base::WriteFile(upload_file_path_, upload_file_data_.data(), |
120 upload_file_data_.size())); | 120 upload_file_data_.size())); |
121 TwoPhaseUploader::RegisterFactory(&two_phase_uploader_factory_); | 121 TwoPhaseUploader::RegisterFactory(&two_phase_uploader_factory_); |
122 } | 122 } |
123 | 123 |
124 void TearDown() override { TwoPhaseUploader::RegisterFactory(nullptr); } | 124 void TearDown() override { TwoPhaseUploader::RegisterFactory(nullptr); } |
125 | 125 |
126 FakeUploader* uploader() const { | 126 FakeUploader* uploader() const { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 EXPECT_TRUE(base::PathExists(upload_file_path_)); | 214 EXPECT_TRUE(base::PathExists(upload_file_path_)); |
215 | 215 |
216 feedback.reset(); | 216 feedback.reset(); |
217 EXPECT_FALSE(feedback_finish_called_); | 217 EXPECT_FALSE(feedback_finish_called_); |
218 | 218 |
219 base::RunLoop().RunUntilIdle(); | 219 base::RunLoop().RunUntilIdle(); |
220 EXPECT_FALSE(base::PathExists(upload_file_path_)); | 220 EXPECT_FALSE(base::PathExists(upload_file_path_)); |
221 } | 221 } |
222 | 222 |
223 } // namespace safe_browsing | 223 } // namespace safe_browsing |
OLD | NEW |