| 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 "chrome/browser/plugins/plugin_prefs.h" | 5 #include "chrome/browser/plugins/plugin_prefs.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 void CanEnablePluginCallback(const base::Closure& quit_closure, | 27 void CanEnablePluginCallback(const base::Closure& quit_closure, |
| 28 bool expected_can_change, | 28 bool expected_can_change, |
| 29 bool did_change) { | 29 bool did_change) { |
| 30 EXPECT_EQ(expected_can_change, did_change); | 30 EXPECT_EQ(expected_can_change, did_change); |
| 31 quit_closure.Run(); | 31 quit_closure.Run(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 #if !(defined(OS_LINUX) && defined(USE_AURA)) |
| 34 base::FilePath GetComponentUpdatedPepperFlashPath( | 35 base::FilePath GetComponentUpdatedPepperFlashPath( |
| 35 const base::FilePath::StringType& version) { | 36 const base::FilePath::StringType& version) { |
| 36 base::FilePath path; | 37 base::FilePath path; |
| 37 EXPECT_TRUE(PathService::Get( | 38 EXPECT_TRUE(PathService::Get( |
| 38 chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &path)); | 39 chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &path)); |
| 39 path = path.Append(version); | 40 path = path.Append(version); |
| 40 path = path.Append(chrome::kPepperFlashPluginFilename); | 41 path = path.Append(chrome::kPepperFlashPluginFilename); |
| 41 return path; | 42 return path; |
| 42 } | 43 } |
| 43 | 44 |
| 44 base::FilePath GetBundledPepperFlashPath() { | 45 base::FilePath GetBundledPepperFlashPath() { |
| 45 base::FilePath path; | 46 base::FilePath path; |
| 46 EXPECT_TRUE(PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &path)); | 47 EXPECT_TRUE(PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &path)); |
| 47 return path; | 48 return path; |
| 48 } | 49 } |
| 50 #endif // !(defined(OS_LINUX) && defined(USE_AURA)) |
| 49 | 51 |
| 50 void GotPlugins(const base::Closure& quit_closure, | 52 void GotPlugins(const base::Closure& quit_closure, |
| 51 const std::vector<content::WebPluginInfo>& plugins) { | 53 const std::vector<content::WebPluginInfo>& plugins) { |
| 52 quit_closure.Run(); | 54 quit_closure.Run(); |
| 53 } | 55 } |
| 54 | 56 |
| 55 } // namespace | 57 } // namespace |
| 56 | 58 |
| 57 class PluginPrefsTest : public ::testing::Test { | 59 class PluginPrefsTest : public ::testing::Test { |
| 58 public: | 60 public: |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); | 275 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); |
| 274 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); | 276 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); |
| 275 | 277 |
| 276 EnablePluginSynchronously(true, bundled_plugin.path, true); | 278 EnablePluginSynchronously(true, bundled_plugin.path, true); |
| 277 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); | 279 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_1)); |
| 278 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); | 280 EXPECT_FALSE(plugin_prefs_->IsPluginEnabled(component_updated_plugin_2)); |
| 279 EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); | 281 EXPECT_TRUE(plugin_prefs_->IsPluginEnabled(bundled_plugin)); |
| 280 } | 282 } |
| 281 | 283 |
| 282 #endif | 284 #endif |
| OLD | NEW |