| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "components/sync_preferences/testing_pref_service_syncable.h" | 32 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 33 #include "content/public/browser/download_interrupt_reasons.h" | 33 #include "content/public/browser/download_interrupt_reasons.h" |
| 34 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/browser/web_contents_delegate.h" | 36 #include "content/public/browser/web_contents_delegate.h" |
| 37 #include "content/public/test/mock_download_item.h" | 37 #include "content/public/test/mock_download_item.h" |
| 38 #include "content/public/test/test_renderer_host.h" | 38 #include "content/public/test/test_renderer_host.h" |
| 39 #include "content/public/test/web_contents_tester.h" | 39 #include "content/public/test/web_contents_tester.h" |
| 40 #include "extensions/features/features.h" | 40 #include "extensions/features/features.h" |
| 41 #include "net/base/mime_util.h" | 41 #include "net/base/mime_util.h" |
| 42 #include "ppapi/features/features.h" |
| 42 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
| 43 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 44 #include "url/origin.h" | 45 #include "url/origin.h" |
| 45 | 46 |
| 46 #if defined(ENABLE_PLUGINS) | 47 #if BUILDFLAG(ENABLE_PLUGINS) |
| 47 #include "content/public/browser/plugin_service.h" | 48 #include "content/public/browser/plugin_service.h" |
| 48 #include "content/public/browser/plugin_service_filter.h" | 49 #include "content/public/browser/plugin_service_filter.h" |
| 49 #include "content/public/common/webplugininfo.h" | 50 #include "content/public/common/webplugininfo.h" |
| 50 #endif | 51 #endif |
| 51 | 52 |
| 52 #if BUILDFLAG(ENABLE_EXTENSIONS) | 53 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 53 #include "extensions/common/extension.h" | 54 #include "extensions/common/extension.h" |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 56 using ::testing::AnyNumber; | 57 using ::testing::AnyNumber; |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 const MIMETypeTestCase& test_case = kMIMETypeTestCases[i]; | 1909 const MIMETypeTestCase& test_case = kMIMETypeTestCases[i]; |
| 1909 std::unique_ptr<content::MockDownloadItem> item( | 1910 std::unique_ptr<content::MockDownloadItem> item( |
| 1910 CreateActiveDownloadItem(i, test_case.general)); | 1911 CreateActiveDownloadItem(i, test_case.general)); |
| 1911 std::unique_ptr<DownloadTargetInfo> target_info = | 1912 std::unique_ptr<DownloadTargetInfo> target_info = |
| 1912 RunDownloadTargetDeterminer(GetPathInDownloadDir(kInitialPath), | 1913 RunDownloadTargetDeterminer(GetPathInDownloadDir(kInitialPath), |
| 1913 item.get()); | 1914 item.get()); |
| 1914 EXPECT_EQ(test_case.expected_mime_type, target_info->mime_type); | 1915 EXPECT_EQ(test_case.expected_mime_type, target_info->mime_type); |
| 1915 } | 1916 } |
| 1916 } | 1917 } |
| 1917 | 1918 |
| 1918 #if defined(ENABLE_PLUGINS) | 1919 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1919 | 1920 |
| 1920 void DummyGetPluginsCallback( | 1921 void DummyGetPluginsCallback( |
| 1921 const base::Closure& closure, | 1922 const base::Closure& closure, |
| 1922 const std::vector<content::WebPluginInfo>& plugins) { | 1923 const std::vector<content::WebPluginInfo>& plugins) { |
| 1923 closure.Run(); | 1924 closure.Run(); |
| 1924 } | 1925 } |
| 1925 | 1926 |
| 1926 void ForceRefreshOfPlugins() { | 1927 void ForceRefreshOfPlugins() { |
| 1927 #if !defined(OS_WIN) | 1928 #if !defined(OS_WIN) |
| 1928 // Prevent creation of a utility process for loading plugins. Doing so breaks | 1929 // Prevent creation of a utility process for loading plugins. Doing so breaks |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 EXPECT_TRUE(target_info->is_filetype_handled_safely); | 2157 EXPECT_TRUE(target_info->is_filetype_handled_safely); |
| 2157 | 2158 |
| 2158 // Try disabling the plugin. Handling should no longer be considered secure. | 2159 // Try disabling the plugin. Handling should no longer be considered secure. |
| 2159 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) | 2160 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) |
| 2160 .WillRepeatedly(Return(false)); | 2161 .WillRepeatedly(Return(false)); |
| 2161 target_info = RunDownloadTargetDeterminer( | 2162 target_info = RunDownloadTargetDeterminer( |
| 2162 GetPathInDownloadDir(kInitialPath), item.get()); | 2163 GetPathInDownloadDir(kInitialPath), item.get()); |
| 2163 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2164 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
| 2164 } | 2165 } |
| 2165 | 2166 |
| 2166 #endif // defined(ENABLE_PLUGINS) | 2167 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 2167 | 2168 |
| 2168 } // namespace | 2169 } // namespace |
| OLD | NEW |