| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/test/gpu/gpu_test_config.h" | |
| 6 #include "gpu/config/gpu_info.h" | 5 #include "gpu/config/gpu_info.h" |
| 6 #include "gpu/config/gpu_test_config.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace gpu { |
| 10 |
| 9 class GPUTestConfigTest : public testing::Test { | 11 class GPUTestConfigTest : public testing::Test { |
| 10 public: | 12 public: |
| 11 GPUTestConfigTest() { } | 13 GPUTestConfigTest() { } |
| 12 | 14 |
| 13 virtual ~GPUTestConfigTest() { } | 15 virtual ~GPUTestConfigTest() { } |
| 14 | 16 |
| 15 protected: | 17 protected: |
| 16 virtual void SetUp() { } | 18 virtual void SetUp() { } |
| 17 | 19 |
| 18 virtual void TearDown() { } | 20 virtual void TearDown() { } |
| 19 }; | 21 }; |
| 20 | 22 |
| 21 TEST_F(GPUTestConfigTest, EmptyValues) { | 23 TEST_F(GPUTestConfigTest, EmptyValues) { |
| 22 GPUTestConfig config; | 24 GPUTestConfig config; |
| 23 EXPECT_EQ(GPUTestConfig::kOsUnknown, config.os()); | 25 EXPECT_EQ(GPUTestConfig::kOsUnknown, config.os()); |
| 24 EXPECT_EQ(0u, config.gpu_vendor().size()); | 26 EXPECT_EQ(0u, config.gpu_vendor().size()); |
| 25 EXPECT_EQ(0u, config.gpu_device_id()); | 27 EXPECT_EQ(0u, config.gpu_device_id()); |
| 26 EXPECT_EQ(GPUTestConfig::kBuildTypeUnknown, config.build_type()); | 28 EXPECT_EQ(GPUTestConfig::kBuildTypeUnknown, config.build_type()); |
| 27 } | 29 } |
| 28 | 30 |
| 29 TEST_F(GPUTestConfigTest, SetGPUInfo) { | 31 TEST_F(GPUTestConfigTest, SetGPUInfo) { |
| 30 gpu::GPUInfo gpu_info; | 32 GPUInfo gpu_info; |
| 31 gpu_info.gpu.vendor_id = 0x10de; | 33 gpu_info.gpu.vendor_id = 0x10de; |
| 32 gpu_info.gpu.device_id = 0x0640; | 34 gpu_info.gpu.device_id = 0x0640; |
| 33 GPUTestBotConfig config; | 35 GPUTestBotConfig config; |
| 34 EXPECT_TRUE(config.SetGPUInfo(gpu_info)); | 36 EXPECT_TRUE(config.SetGPUInfo(gpu_info)); |
| 35 EXPECT_EQ(1u, config.gpu_vendor().size()); | 37 EXPECT_EQ(1u, config.gpu_vendor().size()); |
| 36 EXPECT_EQ(gpu_info.gpu.vendor_id, config.gpu_vendor()[0]); | 38 EXPECT_EQ(gpu_info.gpu.vendor_id, config.gpu_vendor()[0]); |
| 37 EXPECT_EQ(gpu_info.gpu.device_id, config.gpu_device_id()); | 39 EXPECT_EQ(gpu_info.gpu.device_id, config.gpu_device_id()); |
| 38 | 40 |
| 39 gpu_info.gpu.vendor_id = 0x8086; | 41 gpu_info.gpu.vendor_id = 0x8086; |
| 40 gpu_info.gpu.device_id = 0x0046; | 42 gpu_info.gpu.device_id = 0x0046; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 config.set_os(GPUTestConfig::kOsWin7); | 237 config.set_os(GPUTestConfig::kOsWin7); |
| 236 GPUTestConfig config2; | 238 GPUTestConfig config2; |
| 237 config2.AddGPUVendor(0x10de); | 239 config2.AddGPUVendor(0x10de); |
| 238 EXPECT_TRUE(config.OverlapsWith(config2)); | 240 EXPECT_TRUE(config.OverlapsWith(config2)); |
| 239 EXPECT_TRUE(config2.OverlapsWith(config)); | 241 EXPECT_TRUE(config2.OverlapsWith(config)); |
| 240 } | 242 } |
| 241 } | 243 } |
| 242 | 244 |
| 243 TEST_F(GPUTestConfigTest, LoadCurrentConfig) { | 245 TEST_F(GPUTestConfigTest, LoadCurrentConfig) { |
| 244 GPUTestBotConfig config; | 246 GPUTestBotConfig config; |
| 245 gpu::GPUInfo gpu_info; | 247 GPUInfo gpu_info; |
| 246 gpu_info.gpu.vendor_id = 0x10de; | 248 gpu_info.gpu.vendor_id = 0x10de; |
| 247 gpu_info.gpu.device_id = 0x0640; | 249 gpu_info.gpu.device_id = 0x0640; |
| 248 EXPECT_TRUE(config.LoadCurrentConfig(&gpu_info)); | 250 EXPECT_TRUE(config.LoadCurrentConfig(&gpu_info)); |
| 249 EXPECT_TRUE(config.IsValid()); | 251 EXPECT_TRUE(config.IsValid()); |
| 250 } | 252 } |
| 251 | 253 |
| 254 } // namespace gpu |
| 255 |
| OLD | NEW |