| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 class DownloadManagerTest : public testing::Test { | 206 class DownloadManagerTest : public testing::Test { |
| 207 public: | 207 public: |
| 208 static const char* kTestData; | 208 static const char* kTestData; |
| 209 static const size_t kTestDataLen; | 209 static const size_t kTestDataLen; |
| 210 | 210 |
| 211 DownloadManagerTest() | 211 DownloadManagerTest() |
| 212 : browser_context(new TestBrowserContext()), | 212 : browser_context(new TestBrowserContext()), |
| 213 download_manager_delegate_(new TestDownloadManagerDelegate()), | 213 download_manager_delegate_(new TestDownloadManagerDelegate()), |
| 214 download_manager_(DownloadManager::Create( | 214 download_manager_(DownloadManager::Create( |
| 215 download_manager_delegate_.get(), &download_status_updater_)), | 215 download_manager_delegate_.get(), |
| 216 &download_status_updater_, |
| 217 NULL)), |
| 216 ui_thread_(BrowserThread::UI, &message_loop_), | 218 ui_thread_(BrowserThread::UI, &message_loop_), |
| 217 file_thread_(BrowserThread::FILE, &message_loop_), | 219 file_thread_(BrowserThread::FILE, &message_loop_), |
| 218 download_buffer_(new content::DownloadBuffer) { | 220 download_buffer_(new content::DownloadBuffer) { |
| 219 download_manager_->Init(browser_context.get()); | 221 download_manager_->Init(browser_context.get()); |
| 220 download_manager_delegate_->set_download_manager(download_manager_); | 222 download_manager_delegate_->set_download_manager(download_manager_); |
| 221 } | 223 } |
| 222 | 224 |
| 223 ~DownloadManagerTest() { | 225 ~DownloadManagerTest() { |
| 224 download_manager_->Shutdown(); | 226 download_manager_->Shutdown(); |
| 225 // browser_context must outlive download_manager_, so we explicitly delete | 227 // browser_context must outlive download_manager_, so we explicitly delete |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); | 1306 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); |
| 1305 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); | 1307 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); |
| 1306 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 1308 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
| 1307 EXPECT_TRUE(observer->was_updated()); | 1309 EXPECT_TRUE(observer->was_updated()); |
| 1308 EXPECT_FALSE(observer->was_opened()); | 1310 EXPECT_FALSE(observer->was_opened()); |
| 1309 EXPECT_TRUE(download->GetFileExternallyRemoved()); | 1311 EXPECT_TRUE(download->GetFileExternallyRemoved()); |
| 1310 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 1312 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 1311 | 1313 |
| 1312 EXPECT_FALSE(file_util::PathExists(new_path)); | 1314 EXPECT_FALSE(file_util::PathExists(new_path)); |
| 1313 } | 1315 } |
| OLD | NEW |