| 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 6 // Use of this source code is governed by a BSD-style license that can be | |
| 7 // found in the LICENSE file. | |
| 8 | |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 11 #include "content/public/browser/render_view_host.h" | 7 #include "content/public/browser/render_view_host.h" |
| 12 #include "extensions/browser/extension_host.h" | 8 #include "extensions/browser/extension_host.h" |
| 13 #include "extensions/browser/extension_system.h" | 9 #include "extensions/browser/extension_system.h" |
| 14 #include "extensions/browser/process_manager.h" | 10 #include "extensions/browser/process_manager.h" |
| 15 #include "webkit/common/webpreferences.h" | 11 #include "webkit/common/webpreferences.h" |
| 16 | 12 |
| 17 // Tests that GPU acceleration is disabled for extension background | 13 // Tests that background pages are marked as never visible to prevent GPU |
| 18 // pages. See crbug.com/163698 . | 14 // resource allocation. See crbug.com/362165 and crbug.com/163698. |
| 19 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WebKitPrefsBackgroundPage) { | 15 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, BackgroundPageIsNeverVisible) { |
| 20 ASSERT_TRUE(LoadExtension( | 16 ASSERT_TRUE(LoadExtension( |
| 21 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | 17 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") |
| 22 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 18 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 23 .AppendASCII("1.0.0.0"))); | 19 .AppendASCII("1.0.0.0"))); |
| 24 | 20 |
| 25 extensions::ProcessManager* manager = | 21 extensions::ProcessManager* manager = |
| 26 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 22 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 27 extensions::ExtensionHost* host = | 23 extensions::ExtensionHost* host = |
| 28 FindHostWithPath(manager, "/backgroundpage.html", 1); | 24 FindHostWithPath(manager, "/backgroundpage.html", 1); |
| 29 WebPreferences prefs = | 25 ASSERT_TRUE(host->host_contents()->GetDelegate()->IsNeverVisible( |
| 30 host->render_view_host()->GetWebkitPreferences(); | 26 host->host_contents())); |
| 31 ASSERT_FALSE(prefs.accelerated_compositing_enabled); | |
| 32 } | 27 } |
| OLD | NEW |