[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 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 | |||||
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 5 | #include "chrome/browser/extensions/extension_browsertest.h" |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 6 | #include "chrome/browser/ui/browser.h" |
7 | #include "content/public/browser/render_view_host.h" | ||||
[email protected] | b3a97b5 | 2014-07-09 06:25:05 | [diff] [blame] | 8 | #include "content/public/common/web_preferences.h" |
[email protected] | 22401dc | 2014-03-21 01:38:57 | [diff] [blame] | 9 | #include "extensions/browser/extension_host.h" |
[email protected] | 98b6d94 | 2013-11-10 00:34:07 | [diff] [blame] | 10 | #include "extensions/browser/process_manager.h" |
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 11 | |
Devlin Cronin | 836f545d | 2018-05-09 00:25:05 | [diff] [blame] | 12 | namespace extensions { |
13 | |||||
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 14 | // Tests that background pages are marked as never visible to prevent GPU |
15 | // resource allocation. See crbug.com/362165 and crbug.com/163698. | ||||
16 | IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, BackgroundPageIsNeverVisible) { | ||||
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 17 | ASSERT_TRUE(LoadExtension( |
18 | test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | ||||
19 | .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | ||||
20 | .AppendASCII("1.0.0.0"))); | ||||
21 | |||||
Devlin Cronin | 836f545d | 2018-05-09 00:25:05 | [diff] [blame] | 22 | ProcessManager* manager = ProcessManager::Get(browser()->profile()); |
23 | ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); | ||||
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 24 | ASSERT_TRUE(host->host_contents()->GetDelegate()->IsNeverVisible( |
25 | host->host_contents())); | ||||
[email protected] | fad7367 | 2012-06-15 23:26:06 | [diff] [blame] | 26 | } |
Devlin Cronin | 836f545d | 2018-05-09 00:25:05 | [diff] [blame] | 27 | |
28 | } // namespace extensions |