| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 ASSERT_NO_FATAL_FAILURE(LoadAndWait(browser(), url, false)); | 240 ASSERT_NO_FATAL_FAILURE(LoadAndWait(browser(), url, false)); |
| 241 EnsureFlashProcessCount(0); | 241 EnsureFlashProcessCount(0); |
| 242 | 242 |
| 243 // Now enable it again. | 243 // Now enable it again. |
| 244 EnableFlash(true, profile); | 244 EnableFlash(true, profile); |
| 245 ASSERT_NO_FATAL_FAILURE(LoadAndWait(browser(), url, true)); | 245 ASSERT_NO_FATAL_FAILURE(LoadAndWait(browser(), url, true)); |
| 246 EnsureFlashProcessCount(1); | 246 EnsureFlashProcessCount(1); |
| 247 } | 247 } |
| 248 | 248 |
| 249 #if defined(OFFICIAL_BUILD) |
| 249 // Verify that the official builds have the known set of plugins. | 250 // Verify that the official builds have the known set of plugins. |
| 250 IN_PROC_BROWSER_TEST_F(ChromePluginTest, InstalledPlugins) { | 251 IN_PROC_BROWSER_TEST_F(ChromePluginTest, InstalledPlugins) { |
| 251 #if !defined(OFFICIAL_BUILD) | |
| 252 return; | |
| 253 #endif | |
| 254 const char* expected[] = { | 252 const char* expected[] = { |
| 255 "Chrome PDF Viewer", | 253 "Chrome PDF Viewer", |
| 256 "Shockwave Flash", | 254 "Shockwave Flash", |
| 257 "Native Client", | 255 "Native Client", |
| 258 "Chrome Remote Desktop Viewer", | 256 "Chrome Remote Desktop Viewer", |
| 259 #if defined(OS_CHROMEOS) | 257 #if defined(OS_CHROMEOS) |
| 260 "Google Talk Plugin", | 258 "Google Talk Plugin", |
| 261 "Google Talk Plugin Video Accelerator", | 259 "Google Talk Plugin Video Accelerator", |
| 262 "Netflix", | 260 "Netflix", |
| 263 #endif | 261 #endif |
| 264 }; | 262 }; |
| 265 | 263 |
| 266 std::vector<content::WebPluginInfo> plugins = GetPlugins(); | 264 std::vector<content::WebPluginInfo> plugins = GetPlugins(); |
| 267 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { | 265 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { |
| 268 size_t j = 0; | 266 size_t j = 0; |
| 269 for (; j < plugins.size(); ++j) { | 267 for (; j < plugins.size(); ++j) { |
| 270 if (plugins[j].name == base::ASCIIToUTF16(expected[i])) | 268 if (plugins[j].name == base::ASCIIToUTF16(expected[i])) |
| 271 break; | 269 break; |
| 272 } | 270 } |
| 273 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; | 271 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; |
| 274 } | 272 } |
| 275 } | 273 } |
| 274 #endif |
| 276 | 275 |
| 277 #if defined(OS_WIN) | 276 #if defined(OS_WIN) |
| 278 | 277 |
| 279 namespace { | 278 namespace { |
| 280 | 279 |
| 281 BOOL CALLBACK EnumerateChildren(HWND hwnd, LPARAM l_param) { | 280 BOOL CALLBACK EnumerateChildren(HWND hwnd, LPARAM l_param) { |
| 282 HWND* child = reinterpret_cast<HWND*>(l_param); | 281 HWND* child = reinterpret_cast<HWND*>(l_param); |
| 283 *child = hwnd; | 282 *child = hwnd; |
| 284 // The first child window is the plugin, then its children. So stop | 283 // The first child window is the plugin, then its children. So stop |
| 285 // enumerating after the first callback. | 284 // enumerating after the first callback. |
| 286 return FALSE; | 285 return FALSE; |
| 287 } | 286 } |
| 288 | 287 |
| 289 } | 288 } // namespace |
| 290 | 289 |
| 291 // Test that if a background tab loads an NPAPI plugin, they are displayed after | 290 // Test that if a background tab loads an NPAPI plugin, they are displayed after |
| 292 // switching to that page. http://crbug.com/335900 | 291 // switching to that page. http://crbug.com/335900 |
| 293 IN_PROC_BROWSER_TEST_F(ChromePluginTest, WindowedNPAPIPluginHidden) { | 292 IN_PROC_BROWSER_TEST_F(ChromePluginTest, WindowedNPAPIPluginHidden) { |
| 294 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, | 293 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, |
| 295 true); | 294 true); |
| 296 | 295 |
| 297 // First load the page in the background and wait for the NPAPI plugin's | 296 // First load the page in the background and wait for the NPAPI plugin's |
| 298 // window to be created. | 297 // window to be created. |
| 299 GURL url = ui_test_utils::GetTestUrl( | 298 GURL url = ui_test_utils::GetTestUrl( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 330 HWND hwnd = | 329 HWND hwnd = |
| 331 tab->GetView()->GetNativeView()->GetHost()->GetAcceleratedWidget(); | 330 tab->GetView()->GetNativeView()->GetHost()->GetAcceleratedWidget(); |
| 332 EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); | 331 EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); |
| 333 | 332 |
| 334 RECT region; | 333 RECT region; |
| 335 int result = GetWindowRgnBox(child, ®ion); | 334 int result = GetWindowRgnBox(child, ®ion); |
| 336 ASSERT_NE(result, NULLREGION); | 335 ASSERT_NE(result, NULLREGION); |
| 337 } | 336 } |
| 338 | 337 |
| 339 #endif | 338 #endif |
| OLD | NEW |