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 23 matching lines...) Expand all Loading... |
34 #include "content/public/browser/download_interrupt_reasons.h" | 34 #include "content/public/browser/download_interrupt_reasons.h" |
35 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "content/public/browser/web_contents_delegate.h" | 37 #include "content/public/browser/web_contents_delegate.h" |
38 #include "content/public/test/mock_download_item.h" | 38 #include "content/public/test/mock_download_item.h" |
39 #include "content/public/test/test_renderer_host.h" | 39 #include "content/public/test/test_renderer_host.h" |
40 #include "content/public/test/web_contents_tester.h" | 40 #include "content/public/test/web_contents_tester.h" |
41 #include "net/base/mime_util.h" | 41 #include "net/base/mime_util.h" |
42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
| 44 #include "url/origin.h" |
44 | 45 |
45 #if defined(ENABLE_PLUGINS) | 46 #if defined(ENABLE_PLUGINS) |
46 #include "content/public/browser/plugin_service.h" | 47 #include "content/public/browser/plugin_service.h" |
47 #include "content/public/browser/plugin_service_filter.h" | 48 #include "content/public/browser/plugin_service_filter.h" |
48 #include "content/public/common/webplugininfo.h" | 49 #include "content/public/common/webplugininfo.h" |
49 #endif | 50 #endif |
50 | 51 |
51 #if defined(ENABLE_EXTENSIONS) | 52 #if defined(ENABLE_EXTENSIONS) |
52 #include "extensions/common/extension.h" | 53 #include "extensions/common/extension.h" |
53 #endif | 54 #endif |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 } | 1918 } |
1918 | 1919 |
1919 class MockPluginServiceFilter : public content::PluginServiceFilter { | 1920 class MockPluginServiceFilter : public content::PluginServiceFilter { |
1920 public: | 1921 public: |
1921 MOCK_METHOD1(MockPluginAvailable, bool(const base::FilePath&)); | 1922 MOCK_METHOD1(MockPluginAvailable, bool(const base::FilePath&)); |
1922 | 1923 |
1923 bool IsPluginAvailable(int render_process_id, | 1924 bool IsPluginAvailable(int render_process_id, |
1924 int render_view_id, | 1925 int render_view_id, |
1925 const void* context, | 1926 const void* context, |
1926 const GURL& url, | 1927 const GURL& url, |
1927 const GURL& policy_url, | 1928 const url::Origin& main_frame_origin, |
1928 content::WebPluginInfo* plugin) override { | 1929 content::WebPluginInfo* plugin) override { |
1929 return MockPluginAvailable(plugin->path); | 1930 return MockPluginAvailable(plugin->path); |
1930 } | 1931 } |
1931 | 1932 |
1932 bool CanLoadPlugin(int render_process_id, | 1933 bool CanLoadPlugin(int render_process_id, |
1933 const base::FilePath& path) override { | 1934 const base::FilePath& path) override { |
1934 return true; | 1935 return true; |
1935 } | 1936 } |
1936 }; | 1937 }; |
1937 | 1938 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) | 2139 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) |
2139 .WillRepeatedly(Return(false)); | 2140 .WillRepeatedly(Return(false)); |
2140 target_info = RunDownloadTargetDeterminer( | 2141 target_info = RunDownloadTargetDeterminer( |
2141 GetPathInDownloadDir(kInitialPath), item.get()); | 2142 GetPathInDownloadDir(kInitialPath), item.get()); |
2142 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2143 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
2143 } | 2144 } |
2144 | 2145 |
2145 #endif // defined(ENABLE_PLUGINS) | 2146 #endif // defined(ENABLE_PLUGINS) |
2146 | 2147 |
2147 } // namespace | 2148 } // namespace |
OLD | NEW |