| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 ScopedGpuDataManagerImplPrivate manager; | 293 ScopedGpuDataManagerImplPrivate manager; |
| 294 manager->InitializeForTesting("", gpu::GPUInfo()); | 294 manager->InitializeForTesting("", gpu::GPUInfo()); |
| 295 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); | 295 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); |
| 296 std::string reason; | 296 std::string reason; |
| 297 EXPECT_TRUE(manager->GpuAccessAllowed(&reason)); | 297 EXPECT_TRUE(manager->GpuAccessAllowed(&reason)); |
| 298 EXPECT_TRUE(reason.empty()); | 298 EXPECT_TRUE(reason.empty()); |
| 299 | 299 |
| 300 manager->DisableHardwareAcceleration(); | 300 manager->DisableHardwareAcceleration(); |
| 301 EXPECT_FALSE(manager->GpuAccessAllowed(&reason)); | 301 EXPECT_FALSE(manager->GpuAccessAllowed(&reason)); |
| 302 EXPECT_FALSE(reason.empty()); | 302 EXPECT_FALSE(reason.empty()); |
| 303 EXPECT_EQ(static_cast<size_t>(gpu::NUMBER_OF_GPU_FEATURE_TYPES), | 303 // SwiftShader is the only feature not getting disabled |
| 304 EXPECT_EQ(static_cast<size_t>(gpu::NUMBER_OF_GPU_FEATURE_TYPES - 1), |
| 304 manager->GetBlacklistedFeatureCount()); | 305 manager->GetBlacklistedFeatureCount()); |
| 305 } | 306 } |
| 306 | 307 |
| 307 TEST_F(GpuDataManagerImplPrivateTest, SwiftShaderRendering) { | 308 TEST_F(GpuDataManagerImplPrivateTest, SwiftShaderRendering) { |
| 308 // Blacklist, then register SwiftShader. | 309 // Blacklist, then register SwiftShader. |
| 309 ScopedGpuDataManagerImplPrivate manager; | 310 ScopedGpuDataManagerImplPrivate manager; |
| 310 manager->InitializeForTesting("", gpu::GPUInfo()); | 311 manager->InitializeForTesting("", gpu::GPUInfo()); |
| 311 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); | 312 EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount()); |
| 312 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); | 313 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); |
| 313 EXPECT_FALSE(manager->ShouldUseSwiftShader()); | 314 EXPECT_FALSE(manager->ShouldUseSwiftShader()); |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1)); | 833 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1)); |
| 833 { | 834 { |
| 834 base::RunLoop run_loop; | 835 base::RunLoop run_loop; |
| 835 run_loop.RunUntilIdle(); | 836 run_loop.RunUntilIdle(); |
| 836 } | 837 } |
| 837 EXPECT_TRUE(observer.gpu_info_updated()); | 838 EXPECT_TRUE(observer.gpu_info_updated()); |
| 838 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); | 839 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); |
| 839 } | 840 } |
| 840 | 841 |
| 841 } // namespace content | 842 } // namespace content |
| OLD | NEW |