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_info_message_filter.h" | 5 #include "chrome/browser/plugins/plugin_info_message_filter.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/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 protected: | 106 protected: |
107 base::FilePath foo_plugin_path_; | 107 base::FilePath foo_plugin_path_; |
108 base::FilePath bar_plugin_path_; | 108 base::FilePath bar_plugin_path_; |
109 FakePluginServiceFilter filter_; | 109 FakePluginServiceFilter filter_; |
110 PluginInfoMessageFilter::Context context_; | 110 PluginInfoMessageFilter::Context context_; |
111 | 111 |
112 private: | 112 private: |
113 void PluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins) { | 113 void PluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins) { |
114 MessageLoop::current()->Quit(); | 114 base::MessageLoop::current()->Quit(); |
115 } | 115 } |
116 | 116 |
117 MessageLoop message_loop_; | 117 base::MessageLoop message_loop_; |
118 // PluginService::GetPlugins on Windows jumps to the FILE thread even with | 118 // PluginService::GetPlugins on Windows jumps to the FILE thread even with |
119 // a MockPluginList. | 119 // a MockPluginList. |
120 content::TestBrowserThread file_thread_; | 120 content::TestBrowserThread file_thread_; |
121 base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService. | 121 base::ShadowingAtExitManager at_exit_manager_; // Destroys the PluginService. |
122 webkit::npapi::MockPluginList plugin_list_; | 122 webkit::npapi::MockPluginList plugin_list_; |
123 }; | 123 }; |
124 | 124 |
125 TEST_F(PluginInfoMessageFilterTest, FindEnabledPlugin) { | 125 TEST_F(PluginInfoMessageFilterTest, FindEnabledPlugin) { |
126 filter_.set_plugin_enabled(foo_plugin_path_, true); | 126 filter_.set_plugin_enabled(foo_plugin_path_, true); |
127 filter_.set_plugin_enabled(bar_plugin_path_, true); | 127 filter_.set_plugin_enabled(bar_plugin_path_, true); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ChromeViewHostMsg_GetPluginInfo_Status status; | 165 ChromeViewHostMsg_GetPluginInfo_Status status; |
166 webkit::WebPluginInfo plugin; | 166 webkit::WebPluginInfo plugin; |
167 std::string actual_mime_type; | 167 std::string actual_mime_type; |
168 EXPECT_FALSE(context_.FindEnabledPlugin( | 168 EXPECT_FALSE(context_.FindEnabledPlugin( |
169 0, GURL(), GURL(), "baz/blurp", &status, &plugin, &actual_mime_type, | 169 0, GURL(), GURL(), "baz/blurp", &status, &plugin, &actual_mime_type, |
170 NULL)); | 170 NULL)); |
171 EXPECT_EQ(ChromeViewHostMsg_GetPluginInfo_Status::kNotFound, status.value); | 171 EXPECT_EQ(ChromeViewHostMsg_GetPluginInfo_Status::kNotFound, status.value); |
172 EXPECT_EQ(FILE_PATH_LITERAL(""), plugin.path.value()); | 172 EXPECT_EQ(FILE_PATH_LITERAL(""), plugin.path.value()); |
173 } | 173 } |
174 } | 174 } |
OLD | NEW |