Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private_unittest.cc

Issue 435383002: adds WARP support to Chromium, for Metro mode only, on Windows 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: renamed switch Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/browser/gpu/gpu_data_manager_impl_private.h" 9 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
10 #include "content/public/browser/gpu_data_manager_observer.h" 10 #include "content/public/browser/gpu_data_manager_observer.h"
11 #include "gpu/command_buffer/service/gpu_switches.h" 11 #include "gpu/command_buffer/service/gpu_switches.h"
12 #include "gpu/config/gpu_feature_type.h" 12 #include "gpu/config/gpu_feature_type.h"
13 #include "gpu/config/gpu_info.h" 13 #include "gpu/config/gpu_info.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 #if defined(OS_WIN)
18 #include "base/win/windows_version.h"
19 #endif
20
17 #define LONG_STRING_CONST(...) #__VA_ARGS__ 21 #define LONG_STRING_CONST(...) #__VA_ARGS__
18 22
19 namespace content { 23 namespace content {
20 namespace { 24 namespace {
21 25
22 class TestObserver : public GpuDataManagerObserver { 26 class TestObserver : public GpuDataManagerObserver {
23 public: 27 public:
24 TestObserver() 28 TestObserver()
25 : gpu_info_updated_(false), 29 : gpu_info_updated_(false),
26 video_memory_usage_stats_updated_(false) { 30 video_memory_usage_stats_updated_(false) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 EXPECT_FALSE(manager->ShouldUseSwiftShader()); 281 EXPECT_FALSE(manager->ShouldUseSwiftShader());
278 282
279 manager->DisableHardwareAcceleration(); 283 manager->DisableHardwareAcceleration();
280 EXPECT_TRUE(manager->GpuAccessAllowed(NULL)); 284 EXPECT_TRUE(manager->GpuAccessAllowed(NULL));
281 EXPECT_TRUE(manager->ShouldUseSwiftShader()); 285 EXPECT_TRUE(manager->ShouldUseSwiftShader());
282 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); 286 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount());
283 EXPECT_TRUE(manager->IsFeatureBlacklisted( 287 EXPECT_TRUE(manager->IsFeatureBlacklisted(
284 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); 288 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS));
285 } 289 }
286 290
291 TEST_F(GpuDataManagerImplPrivateTest, WarpEnabledOverridesSwiftShader) {
292 // If WARP fallback is enabled on Windows 8 it should not allow SwiftShader
293 // to be enabled.
294 #if defined(OS_WIN)
295 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
296 ScopedGpuDataManagerImplPrivate manager;
297 manager->ForceWarpModeForTesting();
298 const base::FilePath test_path(FILE_PATH_LITERAL("AnyPath"));
299 manager->RegisterSwiftShaderPath(test_path);
300 manager->DisableHardwareAcceleration();
301 EXPECT_TRUE(manager->ShouldUseWarp());
302 EXPECT_FALSE(manager->ShouldUseSwiftShader());
303 }
304 #endif
305 }
306
287 TEST_F(GpuDataManagerImplPrivateTest, GpuInfoUpdate) { 307 TEST_F(GpuDataManagerImplPrivateTest, GpuInfoUpdate) {
288 ScopedGpuDataManagerImpl manager; 308 ScopedGpuDataManagerImpl manager;
289 309
290 TestObserver observer; 310 TestObserver observer;
291 manager->AddObserver(&observer); 311 manager->AddObserver(&observer);
292 312
293 { 313 {
294 base::RunLoop run_loop; 314 base::RunLoop run_loop;
295 run_loop.RunUntilIdle(); 315 run_loop.RunUntilIdle();
296 } 316 }
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1)); 749 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1));
730 { 750 {
731 base::RunLoop run_loop; 751 base::RunLoop run_loop;
732 run_loop.RunUntilIdle(); 752 run_loop.RunUntilIdle();
733 } 753 }
734 EXPECT_TRUE(observer.gpu_info_updated()); 754 EXPECT_TRUE(observer.gpu_info_updated());
735 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); 755 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount());
736 } 756 }
737 757
738 } // namespace content 758 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | content/browser/gpu/gpu_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698