| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 class DownloadManagerTest : public testing::Test { | 205 class DownloadManagerTest : public testing::Test { |
| 206 public: | 206 public: |
| 207 static const char* kTestData; | 207 static const char* kTestData; |
| 208 static const size_t kTestDataLen; | 208 static const size_t kTestDataLen; |
| 209 | 209 |
| 210 DownloadManagerTest() | 210 DownloadManagerTest() |
| 211 : browser_context(new TestBrowserContext()), | 211 : browser_context(new TestBrowserContext()), |
| 212 download_manager_delegate_(new TestDownloadManagerDelegate()), | 212 download_manager_delegate_(new TestDownloadManagerDelegate()), |
| 213 download_manager_(DownloadManager::Create( | 213 download_manager_(DownloadManager::Create( |
| 214 download_manager_delegate_.get())), | 214 download_manager_delegate_.get(), NULL)), |
| 215 ui_thread_(BrowserThread::UI, &message_loop_), | 215 ui_thread_(BrowserThread::UI, &message_loop_), |
| 216 file_thread_(BrowserThread::FILE, &message_loop_), | 216 file_thread_(BrowserThread::FILE, &message_loop_), |
| 217 download_buffer_(new content::DownloadBuffer) { | 217 download_buffer_(new content::DownloadBuffer) { |
| 218 download_manager_->Init(browser_context.get()); | 218 download_manager_->Init(browser_context.get()); |
| 219 download_manager_delegate_->set_download_manager(download_manager_); | 219 download_manager_delegate_->set_download_manager(download_manager_); |
| 220 } | 220 } |
| 221 | 221 |
| 222 ~DownloadManagerTest() { | 222 ~DownloadManagerTest() { |
| 223 download_manager_->Shutdown(); | 223 download_manager_->Shutdown(); |
| 224 // browser_context must outlive download_manager_, so we explicitly delete | 224 // browser_context must outlive download_manager_, so we explicitly delete |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); | 1303 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); |
| 1304 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); | 1304 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); |
| 1305 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 1305 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
| 1306 EXPECT_TRUE(observer->was_updated()); | 1306 EXPECT_TRUE(observer->was_updated()); |
| 1307 EXPECT_FALSE(observer->was_opened()); | 1307 EXPECT_FALSE(observer->was_opened()); |
| 1308 EXPECT_TRUE(download->GetFileExternallyRemoved()); | 1308 EXPECT_TRUE(download->GetFileExternallyRemoved()); |
| 1309 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 1309 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 1310 | 1310 |
| 1311 EXPECT_FALSE(file_util::PathExists(new_path)); | 1311 EXPECT_FALSE(file_util::PathExists(new_path)); |
| 1312 } | 1312 } |
| OLD | NEW |