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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/ui/browser.h" 7 #include "content/public/browser/render_view_host.h" 8 #include "content/public/common/web_preferences.h" 9 #include "extensions/browser/extension_host.h" 10 #include "extensions/browser/extension_system.h" 11 #include "extensions/browser/process_manager.h" 12 13 // Tests that background pages are marked as never visible to prevent GPU 14 // resource allocation. See crbug.com/362165 and crbug.com/163698. 15 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, BackgroundPageIsNeverVisible) { 16 ASSERT_TRUE(LoadExtension( 17 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") 18 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") 19 .AppendASCII("1.0.0.0"))); 20 21 extensions::ProcessManager* manager = 22 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); 23 extensions::ExtensionHost* host = 24 FindHostWithPath(manager, "/backgroundpage.html", 1); 25 ASSERT_TRUE(host->host_contents()->GetDelegate()->IsNeverVisible( 26 host->host_contents())); 27 } 28