OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/gpu/gpu_util.h" | 5 #include "content/browser/gpu/gpu_util.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 using content::GpuFeatureType; | 8 using content::GpuFeatureType; |
9 | 9 |
10 TEST(GpuUtilsTest, GpuFeatureTypFromString) { | 10 TEST(GpuUtilsTest, GpuFeatureTypFromString) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 EXPECT_STREQ( | 81 EXPECT_STREQ( |
82 gpu_util::GpuFeatureTypeToString( | 82 gpu_util::GpuFeatureTypeToString( |
83 static_cast<content::GpuFeatureType>( | 83 static_cast<content::GpuFeatureType>( |
84 content::GPU_FEATURE_TYPE_WEBGL | | 84 content::GPU_FEATURE_TYPE_WEBGL | |
85 content::GPU_FEATURE_TYPE_ALL)).c_str(), | 85 content::GPU_FEATURE_TYPE_ALL)).c_str(), |
86 "all"); | 86 "all"); |
87 } | 87 } |
88 | 88 |
89 TEST(GpuUtilsTest, GpuSwitchingOptionFromString) { | 89 TEST(GpuUtilsTest, GpuSwitchingOptionFromString) { |
90 // Test StringToGpuSwitchingOption. | 90 // Test StringToGpuSwitchingOption. |
91 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption("automatic"), | 91 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption( |
92 content::GPU_SWITCHING_AUTOMATIC); | 92 kGpuSwitchingOptionNameAutomatic), |
93 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption("force_discrete"), | 93 content::GPU_SWITCHING_OPTION_AUTOMATIC); |
94 content::GPU_SWITCHING_FORCE_DISCRETE); | 94 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption( |
95 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption("force_integrated"), | 95 kGpuSwitchingOptionNameForceDiscrete), |
96 content::GPU_SWITCHING_FORCE_INTEGRATED); | 96 content::GPU_SWITCHING_OPTION_FORCE_DISCRETE); |
| 97 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption( |
| 98 kGpuSwitchingOptionNameForceIntegrated), |
| 99 content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED); |
97 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption("xxx"), | 100 EXPECT_EQ(gpu_util::StringToGpuSwitchingOption("xxx"), |
98 content::GPU_SWITCHING_UNKNOWN); | 101 content::GPU_SWITCHING_OPTION_UNKNOWN); |
99 } | 102 } |
100 | 103 |
| 104 TEST(GpuUtilsTest, GpuSwitchingOptionToString) { |
| 105 // Test GpuSwitchingOptionToString. |
| 106 EXPECT_STREQ( |
| 107 gpu_util::GpuSwitchingOptionToString( |
| 108 content::GPU_SWITCHING_OPTION_AUTOMATIC).c_str(), |
| 109 kGpuSwitchingOptionNameAutomatic); |
| 110 EXPECT_STREQ( |
| 111 gpu_util::GpuSwitchingOptionToString( |
| 112 content::GPU_SWITCHING_OPTION_FORCE_DISCRETE).c_str(), |
| 113 kGpuSwitchingOptionNameForceDiscrete); |
| 114 EXPECT_STREQ( |
| 115 gpu_util::GpuSwitchingOptionToString( |
| 116 content::GPU_SWITCHING_OPTION_FORCE_INTEGRATED).c_str(), |
| 117 kGpuSwitchingOptionNameForceIntegrated); |
| 118 } |
| 119 |
OLD | NEW |