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/chrome_download_manager_delegate.h" | 17 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
18 #include "chrome/browser/download/download_item_model.h" | 18 #include "chrome/browser/download/download_item_model.h" |
19 #include "chrome/browser/download/download_prefs.h" | 19 #include "chrome/browser/download/download_prefs.h" |
20 #include "chrome/browser/download/download_util.h" | 20 #include "chrome/browser/download/download_util.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
24 #include "content/browser/browser_thread.h" | 24 #include "content/browser/browser_thread.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 download_manager_->Shutdown(); | 57 download_manager_->Shutdown(); |
58 // profile_ must outlive download_manager_, so we explicitly delete | 58 // profile_ must outlive download_manager_, so we explicitly delete |
59 // download_manager_ first. | 59 // download_manager_ first. |
60 download_manager_ = NULL; | 60 download_manager_ = NULL; |
61 download_manager_delegate_ = NULL; | 61 download_manager_delegate_ = NULL; |
62 profile_.reset(NULL); | 62 profile_.reset(NULL); |
63 message_loop_.RunAllPending(); | 63 message_loop_.RunAllPending(); |
64 } | 64 } |
65 | 65 |
66 void AddDownloadToFileManager(int id, DownloadFile* download_file) { | 66 void AddDownloadToFileManager(int id, DownloadFile* download_file) { |
67 file_manager()->downloads_[id] = download_file; | 67 file_manager()->downloads_[DownloadId(download_manager_.get(), id)] = |
| 68 download_file; |
68 } | 69 } |
69 | 70 |
70 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash) { | 71 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash) { |
71 download_manager_->OnAllDataSaved(download_id, size, hash); | 72 download_manager_->OnAllDataSaved(download_id, size, hash); |
72 } | 73 } |
73 | 74 |
74 void FileSelected(const FilePath& path, void* params) { | 75 void FileSelected(const FilePath& path, void* params) { |
75 download_manager_->FileSelected(path, params); | 76 download_manager_->FileSelected(path, params); |
76 } | 77 } |
77 | 78 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 718 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
718 EXPECT_TRUE(observer->was_updated()); | 719 EXPECT_TRUE(observer->was_updated()); |
719 EXPECT_FALSE(observer->was_opened()); | 720 EXPECT_FALSE(observer->was_opened()); |
720 EXPECT_TRUE(download->file_externally_removed()); | 721 EXPECT_TRUE(download->file_externally_removed()); |
721 EXPECT_EQ(DownloadItem::COMPLETE, download->state()); | 722 EXPECT_EQ(DownloadItem::COMPLETE, download->state()); |
722 EXPECT_EQ(download_item_model->GetStatusText(), | 723 EXPECT_EQ(download_item_model->GetStatusText(), |
723 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); | 724 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); |
724 | 725 |
725 EXPECT_FALSE(file_util::PathExists(new_path)); | 726 EXPECT_FALSE(file_util::PathExists(new_path)); |
726 } | 727 } |
OLD | NEW |