Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: chrome/browser/download/download_target_determiner_unittest.cc

Issue 657643003: Cleanup: Remove unneeded extensions #includes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/test/base/testing_pref_service_syncable.h" 24 #include "chrome/test/base/testing_pref_service_syncable.h"
25 #include "chrome/test/base/testing_profile.h" 25 #include "chrome/test/base/testing_profile.h"
26 #include "components/history/core/browser/history_types.h" 26 #include "components/history/core/browser/history_types.h"
27 #include "content/public/browser/download_interrupt_reasons.h" 27 #include "content/public/browser/download_interrupt_reasons.h"
28 #include "content/public/browser/render_process_host.h" 28 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_delegate.h" 30 #include "content/public/browser/web_contents_delegate.h"
31 #include "content/public/test/mock_download_item.h" 31 #include "content/public/test/mock_download_item.h"
32 #include "content/public/test/test_renderer_host.h" 32 #include "content/public/test/test_renderer_host.h"
33 #include "content/public/test/web_contents_tester.h" 33 #include "content/public/test/web_contents_tester.h"
34 #include "extensions/common/extension.h"
35 #include "net/base/mime_util.h" 34 #include "net/base/mime_util.h"
36 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gmock/include/gmock/gmock.h"
37 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
38 37
39 #if defined(ENABLE_PLUGINS) 38 #if defined(ENABLE_PLUGINS)
40 #include "content/public/browser/plugin_service.h" 39 #include "content/public/browser/plugin_service.h"
41 #include "content/public/browser/plugin_service_filter.h" 40 #include "content/public/browser/plugin_service_filter.h"
42 #include "content/public/common/webplugininfo.h" 41 #include "content/public/common/webplugininfo.h"
43 #endif 42 #endif
44 43
44 #if defined(ENABLE_EXTENSIONS)
45 #include "extensions/common/extension.h"
46 #endif
47
45 using ::testing::AnyNumber; 48 using ::testing::AnyNumber;
46 using ::testing::Invoke; 49 using ::testing::Invoke;
47 using ::testing::Ref; 50 using ::testing::Ref;
48 using ::testing::Return; 51 using ::testing::Return;
49 using ::testing::ReturnRef; 52 using ::testing::ReturnRef;
50 using ::testing::ReturnRefOfCopy; 53 using ::testing::ReturnRefOfCopy;
51 using ::testing::Truly; 54 using ::testing::Truly;
52 using ::testing::WithArg; 55 using ::testing::WithArg;
53 using ::testing::_; 56 using ::testing::_;
54 using content::DownloadItem; 57 using content::DownloadItem;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 }, 1143 },
1141 }; 1144 };
1142 1145
1143 SetPromptForDownload(true); 1146 SetPromptForDownload(true);
1144 EnableAutoOpenBasedOnExtension( 1147 EnableAutoOpenBasedOnExtension(
1145 base::FilePath(FILE_PATH_LITERAL("dummy.dummy"))); 1148 base::FilePath(FILE_PATH_LITERAL("dummy.dummy")));
1146 RunTestCasesWithActiveItem(kPromptingTestCases, 1149 RunTestCasesWithActiveItem(kPromptingTestCases,
1147 arraysize(kPromptingTestCases)); 1150 arraysize(kPromptingTestCases));
1148 } 1151 }
1149 1152
1150 #if !defined(OS_ANDROID) 1153 #if defined(ENABLE_EXTENSIONS)
1151 // These test cases are run with "Prompt for download" user preference set to 1154 // These test cases are run with "Prompt for download" user preference set to
1152 // true. Automatic extension downloads shouldn't cause prompting. 1155 // true. Automatic extension downloads shouldn't cause prompting.
1153 // Android doesn't support extensions. 1156 // Android doesn't support extensions.
1154 TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_PromptAlways_Extension) { 1157 TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_PromptAlways_Extension) {
1155 const DownloadTestCase kPromptingTestCases[] = { 1158 const DownloadTestCase kPromptingTestCases[] = {
1156 { 1159 {
1157 // 0: Automatic Browser Extension download. - Shouldn't prompt for browser 1160 // 0: Automatic Browser Extension download. - Shouldn't prompt for browser
1158 // extension downloads even if "Prompt for download" preference is set. 1161 // extension downloads even if "Prompt for download" preference is set.
1159 AUTOMATIC, 1162 AUTOMATIC,
1160 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, 1163 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 1200
1198 EXPECT_CRDOWNLOAD 1201 EXPECT_CRDOWNLOAD
1199 }, 1202 },
1200 #endif 1203 #endif
1201 }; 1204 };
1202 1205
1203 SetPromptForDownload(true); 1206 SetPromptForDownload(true);
1204 RunTestCasesWithActiveItem(kPromptingTestCases, 1207 RunTestCasesWithActiveItem(kPromptingTestCases,
1205 arraysize(kPromptingTestCases)); 1208 arraysize(kPromptingTestCases));
1206 } 1209 }
1207 #endif 1210 #endif // defined(ENABLE_EXTENSIONS)
1208 1211
1209 // If the download path is managed, then we don't show any prompts. 1212 // If the download path is managed, then we don't show any prompts.
1210 // Note that if the download path is managed, then PromptForDownload() is false. 1213 // Note that if the download path is managed, then PromptForDownload() is false.
1211 TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_ManagedPath) { 1214 TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_ManagedPath) {
1212 const DownloadTestCase kManagedPathTestCases[] = { 1215 const DownloadTestCase kManagedPathTestCases[] = {
1213 { 1216 {
1214 // 0: Automatic Safe 1217 // 0: Automatic Safe
1215 AUTOMATIC, 1218 AUTOMATIC,
1216 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 1219 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
1217 "http://example.com/foo.txt", "text/plain", 1220 "http://example.com/foo.txt", "text/plain",
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(npapi_plugin.path())) 2182 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(npapi_plugin.path()))
2180 .WillRepeatedly(Return(true)); 2183 .WillRepeatedly(Return(true));
2181 2184
2182 target_info = RunDownloadTargetDeterminer( 2185 target_info = RunDownloadTargetDeterminer(
2183 GetPathInDownloadDir(kInitialPath), item.get()); 2186 GetPathInDownloadDir(kInitialPath), item.get());
2184 EXPECT_FALSE(target_info->is_filetype_handled_safely); 2187 EXPECT_FALSE(target_info->is_filetype_handled_safely);
2185 } 2188 }
2186 #endif // defined(ENABLE_PLUGINS) 2189 #endif // defined(ENABLE_PLUGINS)
2187 2190
2188 } // namespace 2191 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/browser/extensions/external_component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698