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