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
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "gpu/config/gpu_control_list_jsons.h"
8 #include "gpu/config/gpu_driver_bug_list.h"
9 #include "gpu/config/gpu_driver_bug_workaround_type.h"
10 #include "gpu/config/gpu_info.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 const char kOsVersion
[] = "10.6.4";
17 class GpuDriverBugListTest
: public testing::Test
{
19 GpuDriverBugListTest() { }
21 virtual ~GpuDriverBugListTest() { }
23 const GPUInfo
& gpu_info() const {
28 virtual void SetUp() {
29 gpu_info_
.gpu
.vendor_id
= 0x10de;
30 gpu_info_
.gpu
.device_id
= 0x0640;
31 gpu_info_
.driver_vendor
= "NVIDIA";
32 gpu_info_
.driver_version
= "1.6.18";
33 gpu_info_
.driver_date
= "7-14-2009";
34 gpu_info_
.machine_model
= "MacBookPro 7.1";
35 gpu_info_
.gl_vendor
= "NVIDIA Corporation";
36 gpu_info_
.gl_renderer
= "NVIDIA GeForce GT 120 OpenGL Engine";
37 gpu_info_
.performance_stats
.graphics
= 5.0;
38 gpu_info_
.performance_stats
.gaming
= 5.0;
39 gpu_info_
.performance_stats
.overall
= 5.0;
42 virtual void TearDown() {
49 TEST_F(GpuDriverBugListTest
, CurrentDriverBugListValidation
) {
50 scoped_ptr
<GpuDriverBugList
> list(GpuDriverBugList::Create());
52 EXPECT_TRUE(list
->LoadList(kGpuDriverBugListJson
, GpuControlList::kAllOs
));
55 TEST_F(GpuDriverBugListTest
, CurrentListForARM
) {
56 scoped_ptr
<GpuDriverBugList
> list(GpuDriverBugList::Create());
57 EXPECT_TRUE(list
->LoadList(kGpuDriverBugListJson
, GpuControlList::kAllOs
));
60 gpu_info
.gl_vendor
= "ARM";
61 gpu_info
.gl_renderer
= "MALi_T604";
62 std::set
<int> bugs
= list
->MakeDecision(
63 GpuControlList::kOsAndroid
, "4.1", gpu_info
);
64 EXPECT_EQ(1u, bugs
.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS
));
67 TEST_F(GpuDriverBugListTest
, CurrentListForImagination
) {
68 scoped_ptr
<GpuDriverBugList
> list(GpuDriverBugList::Create());
69 EXPECT_TRUE(list
->LoadList(kGpuDriverBugListJson
, GpuControlList::kAllOs
));
72 gpu_info
.gl_vendor
= "Imagination Technologies";
73 gpu_info
.gl_renderer
= "PowerVR SGX 540";
74 std::set
<int> bugs
= list
->MakeDecision(
75 GpuControlList::kOsAndroid
, "4.1", gpu_info
);
76 EXPECT_EQ(1u, bugs
.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS
));