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/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/string16.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_browser_process_test.h" | |
24 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
25 #include "content/browser/browser_thread.h" | 24 #include "content/browser/browser_thread.h" |
26 #include "content/browser/download/download_create_info.h" | 25 #include "content/browser/download/download_create_info.h" |
27 #include "content/browser/download/download_file.h" | 26 #include "content/browser/download/download_file.h" |
28 #include "content/browser/download/download_file_manager.h" | 27 #include "content/browser/download/download_file_manager.h" |
29 #include "content/browser/download/download_item.h" | 28 #include "content/browser/download/download_item.h" |
30 #include "content/browser/download/download_manager.h" | 29 #include "content/browser/download/download_manager.h" |
31 #include "content/browser/download/download_status_updater.h" | 30 #include "content/browser/download/download_status_updater.h" |
32 #include "content/browser/download/mock_download_manager.h" | 31 #include "content/browser/download/mock_download_manager.h" |
33 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
34 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
35 #include "testing/gmock_mutant.h" | 34 #include "testing/gmock_mutant.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
37 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
38 #include "ui/base/text/bytes_formatting.h" | 37 #include "ui/base/text/bytes_formatting.h" |
39 | 38 |
40 class DownloadManagerTest : public TestingBrowserProcessTest { | 39 class DownloadManagerTest : public testing::Test { |
41 public: | 40 public: |
42 static const char* kTestData; | 41 static const char* kTestData; |
43 static const size_t kTestDataLen; | 42 static const size_t kTestDataLen; |
44 | 43 |
45 DownloadManagerTest() | 44 DownloadManagerTest() |
46 : profile_(new TestingProfile()), | 45 : profile_(new TestingProfile()), |
47 download_manager_delegate_(new ChromeDownloadManagerDelegate( | 46 download_manager_delegate_(new ChromeDownloadManagerDelegate( |
48 profile_.get())), | 47 profile_.get())), |
49 download_manager_(new MockDownloadManager( | 48 download_manager_(new MockDownloadManager( |
50 download_manager_delegate_, &download_status_updater_)), | 49 download_manager_delegate_, &download_status_updater_)), |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 717 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
719 EXPECT_TRUE(observer->was_updated()); | 718 EXPECT_TRUE(observer->was_updated()); |
720 EXPECT_FALSE(observer->was_opened()); | 719 EXPECT_FALSE(observer->was_opened()); |
721 EXPECT_TRUE(download->file_externally_removed()); | 720 EXPECT_TRUE(download->file_externally_removed()); |
722 EXPECT_EQ(DownloadItem::COMPLETE, download->state()); | 721 EXPECT_EQ(DownloadItem::COMPLETE, download->state()); |
723 EXPECT_EQ(download_item_model->GetStatusText(), | 722 EXPECT_EQ(download_item_model->GetStatusText(), |
724 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); | 723 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); |
725 | 724 |
726 EXPECT_FALSE(file_util::PathExists(new_path)); | 725 EXPECT_FALSE(file_util::PathExists(new_path)); |
727 } | 726 } |
OLD | NEW |