OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chrome_plugin_service_filter.h" | 5 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const url::Origin& main_frame_origin, | 58 const url::Origin& main_frame_origin, |
59 const void* resource_context, | 59 const void* resource_context, |
60 const content::WebPluginInfo& plugin_info) { | 60 const content::WebPluginInfo& plugin_info) { |
61 bool is_available = false; | 61 bool is_available = false; |
62 | 62 |
63 // ChromePluginServiceFilter::IsPluginAvailable always runs on the IO | 63 // ChromePluginServiceFilter::IsPluginAvailable always runs on the IO |
64 // thread. Use a RunLoop to ensure this method blocks until it posts back. | 64 // thread. Use a RunLoop to ensure this method blocks until it posts back. |
65 base::RunLoop run_loop; | 65 base::RunLoop run_loop; |
66 content::BrowserThread::PostTaskAndReply( | 66 content::BrowserThread::PostTaskAndReply( |
67 content::BrowserThread::IO, FROM_HERE, | 67 content::BrowserThread::IO, FROM_HERE, |
68 base::Bind(&ChromePluginServiceFilterTest::IsPluginAvailableOnIOThread, | 68 base::BindOnce( |
69 base::Unretained(this), plugin_content_url, | 69 &ChromePluginServiceFilterTest::IsPluginAvailableOnIOThread, |
70 main_frame_origin, resource_context, plugin_info, | 70 base::Unretained(this), plugin_content_url, main_frame_origin, |
71 &is_available), | 71 resource_context, plugin_info, &is_available), |
72 run_loop.QuitClosure()); | 72 run_loop.QuitClosure()); |
73 run_loop.Run(); | 73 run_loop.Run(); |
74 | 74 |
75 return is_available; | 75 return is_available; |
76 } | 76 } |
77 | 77 |
78 protected: | 78 protected: |
79 void SetUp() override { | 79 void SetUp() override { |
80 ChromeRenderViewHostTestHarness::SetUp(); | 80 ChromeRenderViewHostTestHarness::SetUp(); |
81 SiteEngagementScore::SetParamValuesForTesting(); | 81 SiteEngagementScore::SetParamValuesForTesting(); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 service->ResetBaseScoreForURL(url, 0); | 433 service->ResetBaseScoreForURL(url, 0); |
434 EXPECT_FALSE(IsPluginAvailable( | 434 EXPECT_FALSE(IsPluginAvailable( |
435 url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 435 url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); |
436 | 436 |
437 // Allow flash temporarily. | 437 // Allow flash temporarily. |
438 FlashTemporaryPermissionTracker::Get(profile())->FlashEnabledForWebContents( | 438 FlashTemporaryPermissionTracker::Get(profile())->FlashEnabledForWebContents( |
439 web_contents()); | 439 web_contents()); |
440 EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 440 EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, |
441 profile()->GetResourceContext(), flash_plugin)); | 441 profile()->GetResourceContext(), flash_plugin)); |
442 } | 442 } |
OLD | NEW |