| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/config/gpu_util.h" | 5 #include "gpu/config/gpu_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "gpu/config/gpu_control_list_jsons.h" | |
| 12 #include "gpu/config/gpu_driver_bug_list.h" | 11 #include "gpu/config/gpu_driver_bug_list.h" |
| 13 #include "gpu/config/gpu_info.h" | 12 #include "gpu/config/gpu_info.h" |
| 14 #include "gpu/config/gpu_info_collector.h" | 13 #include "gpu/config/gpu_info_collector.h" |
| 15 #include "gpu/config/gpu_switches.h" | 14 #include "gpu/config/gpu_switches.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "ui/gl/gl_switches.h" | 16 #include "ui/gl/gl_switches.h" |
| 18 | 17 |
| 19 namespace gpu { | 18 namespace gpu { |
| 20 | 19 |
| 21 TEST(GpuUtilTest, StringToFeatureSet) { | 20 TEST(GpuUtilTest, StringToFeatureSet) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 StringToFeatureSet("1,9", &features); | 36 StringToFeatureSet("1,9", &features); |
| 38 EXPECT_EQ(2u, features.size()); | 37 EXPECT_EQ(2u, features.size()); |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 | 40 |
| 42 TEST(GpuUtilTest, | 41 TEST(GpuUtilTest, |
| 43 ApplyGpuDriverBugWorkarounds_DisabledExtensions) { | 42 ApplyGpuDriverBugWorkarounds_DisabledExtensions) { |
| 44 GPUInfo gpu_info; | 43 GPUInfo gpu_info; |
| 45 CollectBasicGraphicsInfo(&gpu_info); | 44 CollectBasicGraphicsInfo(&gpu_info); |
| 46 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 45 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
| 47 list->LoadList(kGpuDriverBugListJson, GpuControlList::kCurrentOsOnly); | |
| 48 list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); | 46 list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); |
| 49 std::vector<std::string> expected_disabled_extensions = | 47 std::vector<std::string> expected_disabled_extensions = |
| 50 list->GetDisabledExtensions(); | 48 list->GetDisabledExtensions(); |
| 51 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 49 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 52 ApplyGpuDriverBugWorkarounds(gpu_info, &command_line); | 50 ApplyGpuDriverBugWorkarounds(gpu_info, &command_line); |
| 53 | 51 |
| 54 std::vector<std::string> actual_disabled_extensions = base::SplitString( | 52 std::vector<std::string> actual_disabled_extensions = base::SplitString( |
| 55 command_line.GetSwitchValueASCII(switches::kDisableGLExtensions), ", ;", | 53 command_line.GetSwitchValueASCII(switches::kDisableGLExtensions), ", ;", |
| 56 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 54 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 57 sort(expected_disabled_extensions.begin(), | 55 sort(expected_disabled_extensions.begin(), |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 EXPECT_EQ(gpu_info.secondary_gpus.size(), 2ul); | 161 EXPECT_EQ(gpu_info.secondary_gpus.size(), 2ul); |
| 164 | 162 |
| 165 command_line.AppendSwitchASCII(switches::kGpuTestingSecondaryVendorIDs, ""); | 163 command_line.AppendSwitchASCII(switches::kGpuTestingSecondaryVendorIDs, ""); |
| 166 command_line.AppendSwitchASCII(switches::kGpuTestingSecondaryDeviceIDs, ""); | 164 command_line.AppendSwitchASCII(switches::kGpuTestingSecondaryDeviceIDs, ""); |
| 167 | 165 |
| 168 ParseSecondaryGpuDevicesFromCommandLine(command_line, &gpu_info); | 166 ParseSecondaryGpuDevicesFromCommandLine(command_line, &gpu_info); |
| 169 EXPECT_EQ(gpu_info.secondary_gpus.size(), 0ul); | 167 EXPECT_EQ(gpu_info.secondary_gpus.size(), 0ul); |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace gpu | 170 } // namespace gpu |
| OLD | NEW |