| 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/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/download/download_file.h" | 10 #include "chrome/browser/download/download_file.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 { FILE_PATH_LITERAL("unconfirmed xxx.crdownload"), | 171 { FILE_PATH_LITERAL("unconfirmed xxx.crdownload"), |
| 172 true, | 172 true, |
| 173 false, | 173 false, |
| 174 false, | 174 false, |
| 175 1, }, | 175 1, }, |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 class MockDownloadFile : public DownloadFile { | 178 class MockDownloadFile : public DownloadFile { |
| 179 public: | 179 public: |
| 180 explicit MockDownloadFile(DownloadCreateInfo* info) | 180 explicit MockDownloadFile(DownloadCreateInfo* info) |
| 181 : DownloadFile(info), renamed_count_(0) { } | 181 : DownloadFile(info, NULL), renamed_count_(0) { } |
| 182 virtual ~MockDownloadFile() { Destructed(); } | 182 virtual ~MockDownloadFile() { Destructed(); } |
| 183 MOCK_METHOD2(Rename, bool(const FilePath&, bool)); | 183 MOCK_METHOD2(Rename, bool(const FilePath&, bool)); |
| 184 MOCK_METHOD0(DeleteCrDownload, void()); | 184 MOCK_METHOD0(DeleteCrDownload, void()); |
| 185 MOCK_METHOD0(Destructed, void()); | 185 MOCK_METHOD0(Destructed, void()); |
| 186 | 186 |
| 187 bool TestMultipleRename( | 187 bool TestMultipleRename( |
| 188 int expected_count, bool expected_final, const FilePath& expected, | 188 int expected_count, bool expected_final, const FilePath& expected, |
| 189 const FilePath& path, bool is_final_rename) { | 189 const FilePath& path, bool is_final_rename) { |
| 190 ++renamed_count_; | 190 ++renamed_count_; |
| 191 EXPECT_EQ(expected_count, renamed_count_); | 191 EXPECT_EQ(expected_count, renamed_count_); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 download_manager_->DownloadFinished(i, 1024); | 244 download_manager_->DownloadFinished(i, 1024); |
| 245 download_manager_->FileSelected(new_path, i, info); | 245 download_manager_->FileSelected(new_path, i, info); |
| 246 } else { | 246 } else { |
| 247 download_manager_->FileSelected(new_path, i, info); | 247 download_manager_->FileSelected(new_path, i, info); |
| 248 download_manager_->DownloadFinished(i, 1024); | 248 download_manager_->DownloadFinished(i, 1024); |
| 249 } | 249 } |
| 250 | 250 |
| 251 message_loop_.RunAllPending(); | 251 message_loop_.RunAllPending(); |
| 252 } | 252 } |
| 253 } | 253 } |
| OLD | NEW |