diff options
author | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 20:05:00 +0000 |
---|---|---|
committer | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 20:05:00 +0000 |
commit | d7b5cc74aad6ae9f5f8425a9dba0c6f3b7a4e058 (patch) | |
tree | 80ed4f402a2df66036b1c46a80ff29d77dd2fa64 /gpu/config/gpu_driver_bug_list_unittest.cc | |
parent | 863b582d75c8f9acf404751d7e709803df1f7bb9 (diff) | |
download | chromium_src-d7b5cc74aad6ae9f5f8425a9dba0c6f3b7a4e058.zip chromium_src-d7b5cc74aad6ae9f5f8425a9dba0c6f3b7a4e058.tar.gz chromium_src-d7b5cc74aad6ae9f5f8425a9dba0c6f3b7a4e058.tar.bz2 |
Move GPU device/driver info related code from content to gpu.
Try to reland r201380 with build fix.
This has been suggested by gman, and agreed by kbr and jam, for the following reasons:
1) These are gpu related code, and are independent of content / browser, so putting them under gpu/ is the right thing to do conceptually.
2) This enables us to set up tests in various places with the correct blacklisting/driver_bug_workarounds information. Otherwise, for the moment, gpu/ has no visibility into content/ side, so we have to duplicate the driver_bug_workarounds code and hardwire them for testing purpose. This is going to cause a lot of bugs in the future, as we have the two pieces of code for the same thing (one for chrome and one for testing) and people will easily forget to update one or the other.
As for this patch, I didn't change the logic, and try to minimize the refactoring. All improvements enabled by this relocation will be done in follow-up CLs.
BUG=230477
TEST=tree
TBR=apatrick@chromium.org, joi@chromium.org, kbr@chromium.org, piman@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/15745014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/config/gpu_driver_bug_list_unittest.cc')
-rw-r--r-- | gpu/config/gpu_driver_bug_list_unittest.cc | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/gpu/config/gpu_driver_bug_list_unittest.cc b/gpu/config/gpu_driver_bug_list_unittest.cc new file mode 100644 index 0000000..60bc339 --- /dev/null +++ b/gpu/config/gpu_driver_bug_list_unittest.cc @@ -0,0 +1,81 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "gpu/config/gpu_control_list_jsons.h" +#include "gpu/config/gpu_driver_bug_list.h" +#include "gpu/config/gpu_driver_bug_workaround_type.h" +#include "gpu/config/gpu_info.h" +#include "testing/gtest/include/gtest/gtest.h" + +const char kOsVersion[] = "10.6.4"; + +namespace gpu { + +class GpuDriverBugListTest : public testing::Test { + public: + GpuDriverBugListTest() { } + + virtual ~GpuDriverBugListTest() { } + + const GPUInfo& gpu_info() const { + return gpu_info_; + } + + protected: + virtual void SetUp() { + gpu_info_.gpu.vendor_id = 0x10de; + gpu_info_.gpu.device_id = 0x0640; + gpu_info_.driver_vendor = "NVIDIA"; + gpu_info_.driver_version = "1.6.18"; + gpu_info_.driver_date = "7-14-2009"; + gpu_info_.machine_model = "MacBookPro 7.1"; + gpu_info_.gl_vendor = "NVIDIA Corporation"; + gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; + gpu_info_.performance_stats.graphics = 5.0; + gpu_info_.performance_stats.gaming = 5.0; + gpu_info_.performance_stats.overall = 5.0; + } + + virtual void TearDown() { + } + + private: + GPUInfo gpu_info_; +}; + +TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) { + scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); + std::string json; + EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); + EXPECT_FALSE(list->contains_unknown_fields()); +} + +TEST_F(GpuDriverBugListTest, CurrentListForARM) { + scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); + EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); + + GPUInfo gpu_info; + gpu_info.gl_vendor = "ARM"; + gpu_info.gl_renderer = "MALi_T604"; + std::set<int> bugs = list->MakeDecision( + GpuControlList::kOsAndroid, "4.1", gpu_info); + EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); +} + +TEST_F(GpuDriverBugListTest, CurrentListForImagination) { + scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); + EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); + + GPUInfo gpu_info; + gpu_info.gl_vendor = "Imagination Technologies"; + gpu_info.gl_renderer = "PowerVR SGX 540"; + std::set<int> bugs = list->MakeDecision( + GpuControlList::kOsAndroid, "4.1", gpu_info); + EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); +} + +} // namespace gpu + |