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.
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/process_manager.h"
12 // Tests that background pages are marked as never visible to prevent GPU
13 // resource allocation. See crbug.com/362165 and crbug.com/163698.
14 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest
, BackgroundPageIsNeverVisible
) {
15 ASSERT_TRUE(LoadExtension(
16 test_data_dir_
.AppendASCII("good").AppendASCII("Extensions")
17 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
18 .AppendASCII("1.0.0.0")));
20 extensions::ProcessManager
* manager
=
21 extensions::ProcessManager::Get(browser()->profile());
22 extensions::ExtensionHost
* host
=
23 FindHostWithPath(manager
, "/backgroundpage.html", 1);
24 ASSERT_TRUE(host
->host_contents()->GetDelegate()->IsNeverVisible(
25 host
->host_contents()));