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
3 // found in the LICENSE file.
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"
13 using ::testing::Return
;
14 using ::testing::SetArgumentPointee
;
16 class GPUInfoTest
: public testing::Test
{
19 virtual ~GPUInfoTest() { }
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
30 EXPECT_CALL(d3d_
, GetDeviceCaps(_
, _
, _
))
31 .WillOnce(DoAll(SetArgumentPointee
<2>(test_caps_
),
33 EXPECT_CALL(d3d_
, QueryInterface(__uuidof(IDirect3D9Ex
), _
))
34 .WillOnce(Return(E_NOINTERFACE
));
35 EXPECT_CALL(d3d_
, Release());
43 D3DADAPTER_IDENTIFIER9 test_identifier_
;
47 TEST_F(GPUInfoTest
, PixelShaderVersionD3D
) {
48 content::GPUInfo gpu_info
;
49 ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_
, &gpu_info
));
50 EXPECT_EQ(gpu_info
.pixel_shader_version
, "3.0");
53 TEST_F(GPUInfoTest
, VertexShaderVersionD3D
) {
54 content::GPUInfo gpu_info
;
55 ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_
, &gpu_info
));
56 EXPECT_EQ(gpu_info
.vertex_shader_version
, "3.0");