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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 new net::TestURLRequestContextGetter(io_task_runner_)), | 112 new net::TestURLRequestContextGetter(io_task_runner_)), |
113 feedback_finish_called_(false) { | 113 feedback_finish_called_(false) { |
114 EXPECT_NE(io_task_runner_, file_task_runner_); | 114 EXPECT_NE(io_task_runner_, file_task_runner_); |
115 } | 115 } |
116 | 116 |
117 virtual void SetUp() OVERRIDE { | 117 virtual void SetUp() OVERRIDE { |
118 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 118 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
119 upload_file_path_ = temp_dir_.path().AppendASCII("test file"); | 119 upload_file_path_ = temp_dir_.path().AppendASCII("test file"); |
120 upload_file_data_ = "data"; | 120 upload_file_data_ = "data"; |
121 ASSERT_EQ(static_cast<int>(upload_file_data_.size()), | 121 ASSERT_EQ(static_cast<int>(upload_file_data_.size()), |
122 file_util::WriteFile(upload_file_path_, upload_file_data_.data(), | 122 base::WriteFile(upload_file_path_, upload_file_data_.data(), |
123 upload_file_data_.size())); | 123 upload_file_data_.size())); |
124 TwoPhaseUploader::RegisterFactory(&two_phase_uploader_factory_); | 124 TwoPhaseUploader::RegisterFactory(&two_phase_uploader_factory_); |
125 } | 125 } |
126 | 126 |
127 virtual void TearDown() OVERRIDE { | 127 virtual void TearDown() OVERRIDE { |
128 TwoPhaseUploader::RegisterFactory(NULL); | 128 TwoPhaseUploader::RegisterFactory(NULL); |
129 } | 129 } |
130 | 130 |
131 FakeUploader* uploader() const { | 131 FakeUploader* uploader() const { |
132 return two_phase_uploader_factory_.uploader_; | 132 return two_phase_uploader_factory_.uploader_; |
133 } | 133 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 EXPECT_TRUE(base::PathExists(upload_file_path_)); | 233 EXPECT_TRUE(base::PathExists(upload_file_path_)); |
234 | 234 |
235 delete feedback; | 235 delete feedback; |
236 EXPECT_FALSE(feedback_finish_called_); | 236 EXPECT_FALSE(feedback_finish_called_); |
237 | 237 |
238 base::RunLoop().RunUntilIdle(); | 238 base::RunLoop().RunUntilIdle(); |
239 EXPECT_FALSE(base::PathExists(upload_file_path_)); | 239 EXPECT_FALSE(base::PathExists(upload_file_path_)); |
240 } | 240 } |
241 | 241 |
242 } // namespace safe_browsing | 242 } // namespace safe_browsing |
OLD | NEW |