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"
15 class GpuDriverBugListTest : public testing::Test {
17 GpuDriverBugListTest() { }
19 virtual ~GpuDriverBugListTest() { }
21 const GPUInfo& gpu_info() const {
26 virtual void SetUp() {
27 gpu_info_.gpu.vendor_id = 0x10de;
28 gpu_info_.gpu.device_id = 0x0640;
29 gpu_info_.driver_vendor = "NVIDIA";
30 gpu_info_.driver_version = "1.6.18";
31 gpu_info_.driver_date = "7-14-2009";
32 gpu_info_.machine_model = "MacBookPro 7.1";
33 gpu_info_.gl_vendor = "NVIDIA Corporation";
34 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
35 gpu_info_.performance_stats.graphics = 5.0;
36 gpu_info_.performance_stats.gaming = 5.0;
37 gpu_info_.performance_stats.overall = 5.0;
40 virtual void TearDown() {
47 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) {
48 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
50 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
53 TEST_F(GpuDriverBugListTest, CurrentListForARM) {
54 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
55 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
58 gpu_info.gl_vendor = "ARM";
59 gpu_info.gl_renderer = "MALi_T604";
60 std::set<int> bugs = list->MakeDecision(
61 GpuControlList::kOsAndroid, "4.1", gpu_info);
62 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
65 TEST_F(GpuDriverBugListTest, CurrentListForImagination) {
66 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
67 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
70 gpu_info.gl_vendor = "Imagination Technologies";
71 gpu_info.gl_renderer = "PowerVR SGX 540";
72 std::set<int> bugs = list->MakeDecision(
73 GpuControlList::kOsAndroid, "4.1", gpu_info);
74 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));