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 "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 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 // needs to disable plugin discovery and we need to use a | 2008 // needs to disable plugin discovery and we need to use a |
2009 // ShadowingAtExitManager to discard the tainted PluginService. Unfortunately, | 2009 // ShadowingAtExitManager to discard the tainted PluginService. Unfortunately, |
2010 // PluginService carries global state. | 2010 // PluginService carries global state. |
2011 class DownloadTargetDeterminerTestWithPlugin | 2011 class DownloadTargetDeterminerTestWithPlugin |
2012 : public DownloadTargetDeterminerTest { | 2012 : public DownloadTargetDeterminerTest { |
2013 public: | 2013 public: |
2014 DownloadTargetDeterminerTestWithPlugin() | 2014 DownloadTargetDeterminerTestWithPlugin() |
2015 : old_plugin_service_filter_(NULL) {} | 2015 : old_plugin_service_filter_(NULL) {} |
2016 | 2016 |
2017 void SetUp() override { | 2017 void SetUp() override { |
| 2018 DownloadTargetDeterminerTest::SetUp(); |
2018 content::PluginService* plugin_service = | 2019 content::PluginService* plugin_service = |
2019 content::PluginService::GetInstance(); | 2020 content::PluginService::GetInstance(); |
2020 plugin_service->Init(); | 2021 plugin_service->Init(); |
2021 plugin_service->DisablePluginsDiscoveryForTesting(); | 2022 plugin_service->DisablePluginsDiscoveryForTesting(); |
2022 old_plugin_service_filter_ = plugin_service->GetFilter(); | 2023 old_plugin_service_filter_ = plugin_service->GetFilter(); |
2023 plugin_service->SetFilter(&mock_plugin_filter_); | 2024 plugin_service->SetFilter(&mock_plugin_filter_); |
2024 DownloadTargetDeterminerTest::SetUp(); | |
2025 } | 2025 } |
2026 | 2026 |
2027 void TearDown() override { | 2027 void TearDown() override { |
2028 content::PluginService::GetInstance()->SetFilter( | 2028 content::PluginService::GetInstance()->SetFilter( |
2029 old_plugin_service_filter_); | 2029 old_plugin_service_filter_); |
2030 DownloadTargetDeterminerTest::TearDown(); | 2030 DownloadTargetDeterminerTest::TearDown(); |
2031 } | 2031 } |
2032 | 2032 |
2033 protected: | 2033 protected: |
2034 content::PluginServiceFilter* old_plugin_service_filter_; | 2034 content::PluginServiceFilter* old_plugin_service_filter_; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(npapi_plugin.path())) | 2236 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(npapi_plugin.path())) |
2237 .WillRepeatedly(Return(true)); | 2237 .WillRepeatedly(Return(true)); |
2238 | 2238 |
2239 target_info = RunDownloadTargetDeterminer( | 2239 target_info = RunDownloadTargetDeterminer( |
2240 GetPathInDownloadDir(kInitialPath), item.get()); | 2240 GetPathInDownloadDir(kInitialPath), item.get()); |
2241 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2241 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
2242 } | 2242 } |
2243 #endif // defined(ENABLE_PLUGINS) | 2243 #endif // defined(ENABLE_PLUGINS) |
2244 | 2244 |
2245 } // namespace | 2245 } // namespace |
OLD | NEW |