Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 10910168: Separate plugin_metadata from plugin_installer, thread-safe plugin_finder (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix policy tests Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 #if defined(OFFICIAL_BUILD) 271 #if defined(OFFICIAL_BUILD)
272 // Official builds bundle Flash. 272 // Official builds bundle Flash.
273 EXPECT_TRUE(flash); 273 EXPECT_TRUE(flash);
274 #else 274 #else
275 if (!flash) 275 if (!flash)
276 LOG(INFO) << "Test skipped because the Flash plugin couldn't be found."; 276 LOG(INFO) << "Test skipped because the Flash plugin couldn't be found.";
277 #endif 277 #endif
278 return flash; 278 return flash;
279 } 279 }
280 280
281 void PostTaskEnablePlugin(PluginPrefs* plugin_prefs,
282 const webkit::WebPluginInfo* plugin,
283 bool enabled,
284 bool* ok) {
285 plugin_prefs->EnablePlugin(enabled, plugin->path,
286 base::Bind(CopyValueAndQuit<bool>, ok));
287 }
288
281 bool SetPluginEnabled(PluginPrefs* plugin_prefs, 289 bool SetPluginEnabled(PluginPrefs* plugin_prefs,
282 const webkit::WebPluginInfo* plugin, 290 const webkit::WebPluginInfo* plugin,
283 bool enabled) { 291 bool enabled) {
284 bool ok = false; 292 bool ok = false;
285 plugin_prefs->EnablePlugin(enabled, plugin->path, 293 MessageLoop::current()->PostTask(FROM_HERE,
Bernhard Bauer 2012/09/24 18:06:04 Wait, I don't understand. We call the callback syn
ibraaaa 2012/09/24 18:18:36 Yes, that is the reason we are failing. Do you me
Bernhard Bauer 2012/09/24 18:27:31 Hm, what I meant was that whether PluginPrefs::Ena
ibraaaa 2012/09/24 18:31:26 Well, I am fine but why do we add a needless callb
ibraaaa 2012/09/24 20:07:13 Done.
286 base::Bind(CopyValueAndQuit<bool>, &ok)); 294 base::Bind(&PostTaskEnablePlugin,
295 base::Unretained(plugin_prefs),
296 base::Unretained(plugin),
297 enabled,
298 base::Unretained(&ok)));
287 content::RunMessageLoop(); 299 content::RunMessageLoop();
288 return ok; 300 return ok;
289 } 301 }
290 302
291 int CountPluginsOnIOThread() { 303 int CountPluginsOnIOThread() {
292 int count = 0; 304 int count = 0;
293 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { 305 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
294 if (iter.GetData().type == content::PROCESS_TYPE_PLUGIN || 306 if (iter.GetData().type == content::PROCESS_TYPE_PLUGIN ||
295 iter.GetData().type == content::PROCESS_TYPE_PPAPI_PLUGIN) { 307 iter.GetData().type == content::PROCESS_TYPE_PPAPI_PLUGIN) {
296 count++; 308 count++;
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 INSTANTIATE_TEST_CASE_P( 1413 INSTANTIATE_TEST_CASE_P(
1402 RestoreOnStartupPolicyTestInstance, 1414 RestoreOnStartupPolicyTestInstance,
1403 RestoreOnStartupPolicyTest, 1415 RestoreOnStartupPolicyTest,
1404 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP, 1416 testing::Values(&RestoreOnStartupPolicyTest::HomepageIsNotNTP,
1405 &RestoreOnStartupPolicyTest::HomepageIsNTP, 1417 &RestoreOnStartupPolicyTest::HomepageIsNTP,
1406 &RestoreOnStartupPolicyTest::ListOfURLs, 1418 &RestoreOnStartupPolicyTest::ListOfURLs,
1407 &RestoreOnStartupPolicyTest::NTP, 1419 &RestoreOnStartupPolicyTest::NTP,
1408 &RestoreOnStartupPolicyTest::Last)); 1420 &RestoreOnStartupPolicyTest::Last));
1409 1421
1410 } // namespace policy 1422 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698