- add sources.
[platform/framework/web/crosswalk.git] / src / gpu / config / gpu_driver_bug_list_unittest.cc
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.
4
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"
12
13 namespace gpu {
14
15 class GpuDriverBugListTest : public testing::Test {
16  public:
17   GpuDriverBugListTest() { }
18
19   virtual ~GpuDriverBugListTest() { }
20
21   const GPUInfo& gpu_info() const {
22     return gpu_info_;
23   }
24
25  protected:
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;
38   }
39
40   virtual void TearDown() {
41   }
42
43  private:
44   GPUInfo gpu_info_;
45 };
46
47 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) {
48   scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
49   std::string json;
50   EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
51 }
52
53 TEST_F(GpuDriverBugListTest, CurrentListForARM) {
54   scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
55   EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
56
57   GPUInfo gpu_info;
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));
63 }
64
65 TEST_F(GpuDriverBugListTest, CurrentListForImagination) {
66   scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
67   EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
68
69   GPUInfo gpu_info;
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));
75 }
76
77 }  // namespace gpu
78