OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/string16.h" |
13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
14 #include "base/string16.h" | |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "chrome/browser/download/download_create_info.h" | 17 #include "chrome/browser/download/download_create_info.h" |
18 #include "chrome/browser/download/download_file.h" | 18 #include "chrome/browser/download/download_file.h" |
19 #include "chrome/browser/download/download_file_manager.h" | 19 #include "chrome/browser/download/download_file_manager.h" |
20 #include "chrome/browser/download/download_item.h" | 20 #include "chrome/browser/download/download_item.h" |
21 #include "chrome/browser/download/download_item_model.h" | 21 #include "chrome/browser/download/download_item_model.h" |
22 #include "chrome/browser/download/download_manager.h" | 22 #include "chrome/browser/download/download_manager.h" |
23 #include "chrome/browser/download/download_prefs.h" | 23 #include "chrome/browser/download/download_prefs.h" |
24 #include "chrome/browser/download/download_status_updater.h" | 24 #include "chrome/browser/download/download_status_updater.h" |
(...skipping 26 matching lines...) Expand all Loading... |
51 ~DownloadManagerTest() { | 51 ~DownloadManagerTest() { |
52 download_manager_->Shutdown(); | 52 download_manager_->Shutdown(); |
53 // profile_ must outlive download_manager_, so we explicitly delete | 53 // profile_ must outlive download_manager_, so we explicitly delete |
54 // download_manager_ first. | 54 // download_manager_ first. |
55 download_manager_ = NULL; | 55 download_manager_ = NULL; |
56 profile_.reset(NULL); | 56 profile_.reset(NULL); |
57 message_loop_.RunAllPending(); | 57 message_loop_.RunAllPending(); |
58 } | 58 } |
59 | 59 |
60 void AddDownloadToFileManager(int id, DownloadFile* download_file) { | 60 void AddDownloadToFileManager(int id, DownloadFile* download_file) { |
61 file_manager()->downloads_[id] = download_file; | 61 file_manager()->downloads_[DownloadId(download_manager_.get(), id)] = |
| 62 download_file; |
62 } | 63 } |
63 | 64 |
64 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash) { | 65 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash) { |
65 download_manager_->OnAllDataSaved(download_id, size, hash); | 66 download_manager_->OnAllDataSaved(download_id, size, hash); |
66 } | 67 } |
67 | 68 |
68 void FileSelected(const FilePath& path, int index, void* params) { | 69 void FileSelected(const FilePath& path, int index, void* params) { |
69 download_manager_->FileSelected(path, index, params); | 70 download_manager_->FileSelected(path, index, params); |
70 } | 71 } |
71 | 72 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 709 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
709 EXPECT_TRUE(observer->was_updated()); | 710 EXPECT_TRUE(observer->was_updated()); |
710 EXPECT_FALSE(observer->was_opened()); | 711 EXPECT_FALSE(observer->was_opened()); |
711 EXPECT_TRUE(download->file_externally_removed()); | 712 EXPECT_TRUE(download->file_externally_removed()); |
712 EXPECT_EQ(DownloadItem::COMPLETE, download->state()); | 713 EXPECT_EQ(DownloadItem::COMPLETE, download->state()); |
713 EXPECT_EQ(download_item_model->GetStatusText(), | 714 EXPECT_EQ(download_item_model->GetStatusText(), |
714 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); | 715 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); |
715 | 716 |
716 EXPECT_FALSE(file_util::PathExists(new_path)); | 717 EXPECT_FALSE(file_util::PathExists(new_path)); |
717 } | 718 } |
OLD | NEW |