| 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 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 FROM_HERE, | 164 FROM_HERE, |
| 165 base::Bind(&CountPluginProcesses, &actual, runner->QuitClosure())); | 165 base::Bind(&CountPluginProcesses, &actual, runner->QuitClosure())); |
| 166 runner->Run(); | 166 runner->Run(); |
| 167 ASSERT_EQ(expected, actual); | 167 ASSERT_EQ(expected, actual); |
| 168 } | 168 } |
| 169 | 169 |
| 170 private: | 170 private: |
| 171 static void CrashFlashInternal(const base::Closure& quit_task) { | 171 static void CrashFlashInternal(const base::Closure& quit_task) { |
| 172 bool found = false; | 172 bool found = false; |
| 173 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { | 173 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { |
| 174 if (iter.GetData().process_type != content::PROCESS_TYPE_PLUGIN && | 174 if (iter.GetData().process_type != content::PROCESS_TYPE_PPAPI_PLUGIN) |
| 175 iter.GetData().process_type != content::PROCESS_TYPE_PPAPI_PLUGIN) { | |
| 176 continue; | 175 continue; |
| 177 } | |
| 178 base::Process process = base::Process::DeprecatedGetProcessFromHandle( | 176 base::Process process = base::Process::DeprecatedGetProcessFromHandle( |
| 179 iter.GetData().handle); | 177 iter.GetData().handle); |
| 180 process.Terminate(0, true); | 178 process.Terminate(0, true); |
| 181 found = true; | 179 found = true; |
| 182 } | 180 } |
| 183 ASSERT_TRUE(found) << "Didn't find Flash process!"; | 181 ASSERT_TRUE(found) << "Didn't find Flash process!"; |
| 184 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task); | 182 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task); |
| 185 } | 183 } |
| 186 | 184 |
| 187 static void GetPluginsInfoCallback( | 185 static void GetPluginsInfoCallback( |
| 188 std::vector<content::WebPluginInfo>* rv, | 186 std::vector<content::WebPluginInfo>* rv, |
| 189 const base::Closure& quit_task, | 187 const base::Closure& quit_task, |
| 190 const std::vector<content::WebPluginInfo>& plugins) { | 188 const std::vector<content::WebPluginInfo>& plugins) { |
| 191 *rv = plugins; | 189 *rv = plugins; |
| 192 quit_task.Run(); | 190 quit_task.Run(); |
| 193 } | 191 } |
| 194 | 192 |
| 195 static void CountPluginProcesses(int* count, const base::Closure& quit_task) { | 193 static void CountPluginProcesses(int* count, const base::Closure& quit_task) { |
| 196 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { | 194 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { |
| 197 if (iter.GetData().process_type == content::PROCESS_TYPE_PLUGIN || | 195 if (iter.GetData().process_type == content::PROCESS_TYPE_PPAPI_PLUGIN) |
| 198 iter.GetData().process_type == content::PROCESS_TYPE_PPAPI_PLUGIN) { | |
| 199 (*count)++; | 196 (*count)++; |
| 200 } | |
| 201 } | 197 } |
| 202 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task); | 198 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task); |
| 203 } | 199 } |
| 204 }; | 200 }; |
| 205 | 201 |
| 206 // Tests a bunch of basic scenarios with Flash. | 202 // Tests a bunch of basic scenarios with Flash. |
| 207 // This test fails under ASan on Mac, see http://crbug.com/147004. | 203 // This test fails under ASan on Mac, see http://crbug.com/147004. |
| 208 // It fails elsewhere, too. See http://crbug.com/152071. | 204 // It fails elsewhere, too. See http://crbug.com/152071. |
| 209 IN_PROC_BROWSER_TEST_F(ChromePluginTest, DISABLED_Flash) { | 205 IN_PROC_BROWSER_TEST_F(ChromePluginTest, DISABLED_Flash) { |
| 210 // Official builds always have bundled Flash. | 206 // Official builds always have bundled Flash. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 for (size_t i = 0; i < arraysize(expected); ++i) { | 259 for (size_t i = 0; i < arraysize(expected); ++i) { |
| 264 size_t j = 0; | 260 size_t j = 0; |
| 265 for (; j < plugins.size(); ++j) { | 261 for (; j < plugins.size(); ++j) { |
| 266 if (plugins[j].name == base::ASCIIToUTF16(expected[i])) | 262 if (plugins[j].name == base::ASCIIToUTF16(expected[i])) |
| 267 break; | 263 break; |
| 268 } | 264 } |
| 269 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; | 265 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; |
| 270 } | 266 } |
| 271 } | 267 } |
| 272 #endif | 268 #endif |
| OLD | NEW |