OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/memory/scoped_ptr.h" | |
6 #include "content/gpu/gpu_idirect3d9_mock_win.h" | |
7 #include "content/gpu/gpu_info_collector.h" | |
8 #include "content/public/common/gpu_info.h" | |
9 #include "testing/gmock/include/gmock/gmock.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | |
11 | |
12 using ::testing::_; | |
13 using ::testing::Return; | |
14 using ::testing::SetArgumentPointee; | |
15 | |
16 class GPUInfoTest : public testing::Test { | |
17 public: | |
18 GPUInfoTest() { } | |
19 virtual ~GPUInfoTest() { } | |
20 | |
21 protected: | |
22 void SetUp() { | |
23 // Test variables taken from Lenovo T61 | |
24 test_identifier_.VendorId = 0x10de; | |
25 test_identifier_.DeviceId = 0x429; | |
26 test_identifier_.DriverVersion.QuadPart = 0x6000e000b1e23; // 6.14.11.7715 | |
27 test_caps_.PixelShaderVersion = 0xffff0300; // 3.0 | |
28 test_caps_.VertexShaderVersion = 0xfffe0300; // 3.0 | |
29 | |
30 EXPECT_CALL(d3d_, GetDeviceCaps(_, _, _)) | |
31 .WillOnce(DoAll(SetArgumentPointee<2>(test_caps_), | |
32 Return(D3D_OK))); | |
33 EXPECT_CALL(d3d_, QueryInterface(__uuidof(IDirect3D9Ex), _)) | |
34 .WillOnce(Return(E_NOINTERFACE)); | |
35 } | |
36 void TearDown() { | |
37 } | |
38 | |
39 public: | |
40 IDirect3D9Mock d3d_; | |
41 private: | |
42 D3DADAPTER_IDENTIFIER9 test_identifier_; | |
43 D3DCAPS9 test_caps_; | |
44 }; | |
45 | |
46 TEST_F(GPUInfoTest, PixelShaderVersionD3D) { | |
47 content::GPUInfo gpu_info; | |
48 ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); | |
49 EXPECT_EQ(gpu_info.pixel_shader_version, "3.0"); | |
50 } | |
51 | |
52 TEST_F(GPUInfoTest, VertexShaderVersionD3D) { | |
53 content::GPUInfo gpu_info; | |
54 ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); | |
55 EXPECT_EQ(gpu_info.vertex_shader_version, "3.0"); | |
56 } | |
OLD | NEW |