OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/browser/download/download_file.h" | 10 #include "chrome/browser/download/download_file.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 { FILE_PATH_LITERAL("unconfirmed xxx.crdownload"), | 178 { FILE_PATH_LITERAL("unconfirmed xxx.crdownload"), |
179 true, | 179 true, |
180 false, | 180 false, |
181 false, | 181 false, |
182 1, }, | 182 1, }, |
183 }; | 183 }; |
184 | 184 |
185 class MockDownloadFile : public DownloadFile { | 185 class MockDownloadFile : public DownloadFile { |
186 public: | 186 public: |
187 explicit MockDownloadFile(DownloadCreateInfo* info) | 187 explicit MockDownloadFile(DownloadCreateInfo* info) |
188 : DownloadFile(info, NULL), renamed_count_(0) { } | 188 : DownloadFile(info, NULL, true), renamed_count_(0) { } |
189 virtual ~MockDownloadFile() { Destructed(); } | 189 virtual ~MockDownloadFile() { Destructed(); } |
190 MOCK_METHOD2(Rename, bool(const FilePath&, bool)); | 190 MOCK_METHOD2(Rename, bool(const FilePath&, bool)); |
191 MOCK_METHOD0(DeleteCrDownload, void()); | 191 MOCK_METHOD0(DeleteCrDownload, void()); |
192 MOCK_METHOD0(Destructed, void()); | 192 MOCK_METHOD0(Destructed, void()); |
193 | 193 |
194 bool TestMultipleRename( | 194 bool TestMultipleRename( |
195 int expected_count, bool expected_final, const FilePath& expected, | 195 int expected_count, bool expected_final, const FilePath& expected, |
196 const FilePath& path, bool is_final_rename) { | 196 const FilePath& path, bool is_final_rename) { |
197 ++renamed_count_; | 197 ++renamed_count_; |
198 EXPECT_EQ(expected_count, renamed_count_); | 198 EXPECT_EQ(expected_count, renamed_count_); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 download_manager_->OnAllDataSaved(i, 1024); | 253 download_manager_->OnAllDataSaved(i, 1024); |
254 download_manager_->FileSelected(new_path, i, info); | 254 download_manager_->FileSelected(new_path, i, info); |
255 } else { | 255 } else { |
256 download_manager_->FileSelected(new_path, i, info); | 256 download_manager_->FileSelected(new_path, i, info); |
257 download_manager_->OnAllDataSaved(i, 1024); | 257 download_manager_->OnAllDataSaved(i, 1024); |
258 } | 258 } |
259 | 259 |
260 message_loop_.RunAllPending(); | 260 message_loop_.RunAllPending(); |
261 } | 261 } |
262 } | 262 } |
OLD | NEW |