| // Copyright 2021 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "base/values.h" |
| #include "chrome/browser/policy/policy_test_utils.h" |
| #include "components/policy/core/common/policy_map.h" |
| #include "components/policy/core/common/policy_types.h" |
| #include "components/policy/policy_constants.h" |
| #include "content/public/browser/gpu_data_manager.h" |
| #include "content/public/test/browser_test.h" |
| |
| namespace policy { |
| |
| // Sets the hardware acceleration mode policy before the browser is started. |
| class HardwareAccelerationModePolicyTest : public PolicyTest { |
| public: |
| HardwareAccelerationModePolicyTest() {} |
| |
| void SetUpInProcessBrowserTestFixture() override { |
| PolicyTest::SetUpInProcessBrowserTestFixture(); |
| PolicyMap policies; |
| policies.Set(key::kHardwareAccelerationModeEnabled, POLICY_LEVEL_MANDATORY, |
| POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(false), |
| nullptr); |
| provider_.UpdateChromePolicy(policies); |
| } |
| }; |
| |
| IN_PROC_BROWSER_TEST_F(HardwareAccelerationModePolicyTest, |
| HardwareAccelerationDisabled) { |
| // Verifies that hardware acceleration can be disabled with policy. |
| EXPECT_FALSE( |
| content::GpuDataManager::GetInstance()->HardwareAccelerationEnabled()); |
| } |
| |
| } // namespace policy |