| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "gpu/config/gpu_driver_bug_list.h" | 6 #include "gpu/config/gpu_driver_bug_list.h" |
| 7 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 7 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 8 #include "gpu/config/gpu_info.h" | 8 #include "gpu/config/gpu_info.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace gpu { | 11 namespace gpu { |
| 12 | 12 |
| 13 class GpuDriverBugListTest : public testing::Test { | 13 class GpuDriverBugListTest : public testing::Test { |
| 14 public: | 14 public: |
| 15 GpuDriverBugListTest() {} | 15 GpuDriverBugListTest() {} |
| 16 ~GpuDriverBugListTest() override {} | 16 ~GpuDriverBugListTest() override {} |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 #if defined(OS_ANDROID) |
| 19 TEST_F(GpuDriverBugListTest, CurrentListForARM) { | 20 TEST_F(GpuDriverBugListTest, CurrentListForARM) { |
| 20 std::unique_ptr<GpuDriverBugList> list = GpuDriverBugList::Create(); | 21 std::unique_ptr<GpuDriverBugList> list = GpuDriverBugList::Create(); |
| 21 GPUInfo gpu_info; | 22 GPUInfo gpu_info; |
| 22 gpu_info.gl_vendor = "ARM"; | 23 gpu_info.gl_vendor = "ARM"; |
| 23 gpu_info.gl_renderer = "MALi_T604"; | 24 gpu_info.gl_renderer = "MALi_T604"; |
| 24 std::set<int> bugs = list->MakeDecision( | 25 std::set<int> bugs = list->MakeDecision( |
| 25 GpuControlList::kOsAndroid, "4.1", gpu_info); | 26 GpuControlList::kOsAndroid, "4.1", gpu_info); |
| 26 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); | 27 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); |
| 27 } | 28 } |
| 28 | 29 |
| 29 TEST_F(GpuDriverBugListTest, CurrentListForImagination) { | 30 TEST_F(GpuDriverBugListTest, CurrentListForImagination) { |
| 30 std::unique_ptr<GpuDriverBugList> list = GpuDriverBugList::Create(); | 31 std::unique_ptr<GpuDriverBugList> list = GpuDriverBugList::Create(); |
| 31 GPUInfo gpu_info; | 32 GPUInfo gpu_info; |
| 32 gpu_info.gl_vendor = "Imagination Technologies"; | 33 gpu_info.gl_vendor = "Imagination Technologies"; |
| 33 gpu_info.gl_renderer = "PowerVR SGX 540"; | 34 gpu_info.gl_renderer = "PowerVR SGX 540"; |
| 34 std::set<int> bugs = list->MakeDecision( | 35 std::set<int> bugs = list->MakeDecision( |
| 35 GpuControlList::kOsAndroid, "4.1", gpu_info); | 36 GpuControlList::kOsAndroid, "4.1", gpu_info); |
| 36 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); | 37 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); |
| 37 } | 38 } |
| 39 #endif // OS_ANDROID |
| 38 | 40 |
| 39 TEST_F(GpuDriverBugListTest, AppendSingleWorkaround) { | 41 TEST_F(GpuDriverBugListTest, AppendSingleWorkaround) { |
| 40 base::CommandLine command_line(0, NULL); | 42 base::CommandLine command_line(0, NULL); |
| 41 command_line.AppendSwitch(GpuDriverBugWorkaroundTypeToString( | 43 command_line.AppendSwitch(GpuDriverBugWorkaroundTypeToString( |
| 42 DISABLE_CHROMIUM_FRAMEBUFFER_MULTISAMPLE)); | 44 DISABLE_CHROMIUM_FRAMEBUFFER_MULTISAMPLE)); |
| 43 std::set<int> workarounds; | 45 std::set<int> workarounds; |
| 44 workarounds.insert(EXIT_ON_CONTEXT_LOST); | 46 workarounds.insert(EXIT_ON_CONTEXT_LOST); |
| 45 workarounds.insert(INIT_VERTEX_ATTRIBUTES); | 47 workarounds.insert(INIT_VERTEX_ATTRIBUTES); |
| 46 EXPECT_EQ(2u, workarounds.size()); | 48 EXPECT_EQ(2u, workarounds.size()); |
| 47 GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 49 GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 EXPECT_EQ(2u, workarounds.size()); | 62 EXPECT_EQ(2u, workarounds.size()); |
| 61 EXPECT_EQ(1u, workarounds.count(FORCE_INTEGRATED_GPU)); | 63 EXPECT_EQ(1u, workarounds.count(FORCE_INTEGRATED_GPU)); |
| 62 GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 64 GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
| 63 &workarounds, command_line); | 65 &workarounds, command_line); |
| 64 EXPECT_EQ(2u, workarounds.size()); | 66 EXPECT_EQ(2u, workarounds.size()); |
| 65 EXPECT_EQ(0u, workarounds.count(FORCE_INTEGRATED_GPU)); | 67 EXPECT_EQ(0u, workarounds.count(FORCE_INTEGRATED_GPU)); |
| 66 EXPECT_EQ(1u, workarounds.count(FORCE_DISCRETE_GPU)); | 68 EXPECT_EQ(1u, workarounds.count(FORCE_DISCRETE_GPU)); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace gpu | 71 } // namespace gpu |
| OLD | NEW |