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/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 static const char* kTestData; | 427 static const char* kTestData; |
428 static const size_t kTestDataLen; | 428 static const size_t kTestDataLen; |
429 | 429 |
430 DownloadManagerTest() | 430 DownloadManagerTest() |
431 : ui_thread_(BrowserThread::UI, &message_loop_), | 431 : ui_thread_(BrowserThread::UI, &message_loop_), |
432 file_thread_(BrowserThread::FILE, &message_loop_), | 432 file_thread_(BrowserThread::FILE, &message_loop_), |
433 next_download_id_(0) { | 433 next_download_id_(0) { |
434 } | 434 } |
435 | 435 |
436 // We tear down everything in TearDown(). | 436 // We tear down everything in TearDown(). |
437 ~DownloadManagerTest() {} | 437 virtual ~DownloadManagerTest() {} |
438 | 438 |
439 // Create a MockDownloadItemFactory and MockDownloadManagerDelegate, | 439 // Create a MockDownloadItemFactory and MockDownloadManagerDelegate, |
440 // then create a DownloadManager that points | 440 // then create a DownloadManager that points |
441 // at all of those. | 441 // at all of those. |
442 virtual void SetUp() { | 442 virtual void SetUp() { |
443 DCHECK(!download_manager_.get()); | 443 DCHECK(!download_manager_.get()); |
444 | 444 |
445 mock_download_item_factory_ = (new MockDownloadItemFactory())->AsWeakPtr(); | 445 mock_download_item_factory_ = (new MockDownloadItemFactory())->AsWeakPtr(); |
446 mock_download_file_factory_ = (new MockDownloadFileFactory())->AsWeakPtr(); | 446 mock_download_file_factory_ = (new MockDownloadFileFactory())->AsWeakPtr(); |
447 mock_download_manager_delegate_.reset( | 447 mock_download_manager_delegate_.reset( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 callback_called_ = false; | 647 callback_called_ = false; |
648 DetermineDownloadTarget(&item); | 648 DetermineDownloadTarget(&item); |
649 EXPECT_TRUE(callback_called_); | 649 EXPECT_TRUE(callback_called_); |
650 EXPECT_EQ(path, target_path_); | 650 EXPECT_EQ(path, target_path_); |
651 EXPECT_EQ(DownloadItem::TARGET_DISPOSITION_OVERWRITE, target_disposition_); | 651 EXPECT_EQ(DownloadItem::TARGET_DISPOSITION_OVERWRITE, target_disposition_); |
652 EXPECT_EQ(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, danger_type_); | 652 EXPECT_EQ(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, danger_type_); |
653 EXPECT_EQ(path, intermediate_path_); | 653 EXPECT_EQ(path, intermediate_path_); |
654 } | 654 } |
655 | 655 |
656 } // namespace content | 656 } // namespace content |
OLD | NEW |