| 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 #include "base/memory/scoped_ptr.h" | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 8 #include "gpu/config/gpu_control_list_jsons.h" | 10 #include "gpu/config/gpu_control_list_jsons.h" |
| 9 #include "gpu/config/gpu_driver_bug_list.h" | 11 #include "gpu/config/gpu_driver_bug_list.h" |
| 10 #include "gpu/config/gpu_info.h" | 12 #include "gpu/config/gpu_info.h" |
| 11 #include "gpu/config/gpu_info_collector.h" | 13 #include "gpu/config/gpu_info_collector.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/gl/gl_switches.h" | 15 #include "ui/gl/gl_switches.h" |
| 14 | 16 |
| 15 namespace gpu { | 17 namespace gpu { |
| 16 | 18 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 std::set<int> features; | 74 std::set<int> features; |
| 73 StringToFeatureSet("1,9", &features); | 75 StringToFeatureSet("1,9", &features); |
| 74 EXPECT_EQ(2u, features.size()); | 76 EXPECT_EQ(2u, features.size()); |
| 75 } | 77 } |
| 76 } | 78 } |
| 77 | 79 |
| 78 TEST(GpuUtilTest, | 80 TEST(GpuUtilTest, |
| 79 ApplyGpuDriverBugWorkarounds_DisabledExtensions) { | 81 ApplyGpuDriverBugWorkarounds_DisabledExtensions) { |
| 80 GPUInfo gpu_info; | 82 GPUInfo gpu_info; |
| 81 CollectBasicGraphicsInfo(&gpu_info); | 83 CollectBasicGraphicsInfo(&gpu_info); |
| 82 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 84 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
| 83 list->LoadList(kGpuDriverBugListJson, GpuControlList::kCurrentOsOnly); | 85 list->LoadList(kGpuDriverBugListJson, GpuControlList::kCurrentOsOnly); |
| 84 list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); | 86 list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); |
| 85 std::vector<std::string> expected_disabled_extensions = | 87 std::vector<std::string> expected_disabled_extensions = |
| 86 list->GetDisabledExtensions(); | 88 list->GetDisabledExtensions(); |
| 87 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 89 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 88 ApplyGpuDriverBugWorkarounds(gpu_info, &command_line); | 90 ApplyGpuDriverBugWorkarounds(gpu_info, &command_line); |
| 89 | 91 |
| 90 std::vector<std::string> actual_disabled_extensions = base::SplitString( | 92 std::vector<std::string> actual_disabled_extensions = base::SplitString( |
| 91 command_line.GetSwitchValueASCII(switches::kDisableGLExtensions), ", ;", | 93 command_line.GetSwitchValueASCII(switches::kDisableGLExtensions), ", ;", |
| 92 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 94 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 93 sort(expected_disabled_extensions.begin(), | 95 sort(expected_disabled_extensions.begin(), |
| 94 expected_disabled_extensions.end()); | 96 expected_disabled_extensions.end()); |
| 95 sort(actual_disabled_extensions.begin(), actual_disabled_extensions.end()); | 97 sort(actual_disabled_extensions.begin(), actual_disabled_extensions.end()); |
| 96 | 98 |
| 97 EXPECT_EQ(expected_disabled_extensions, actual_disabled_extensions); | 99 EXPECT_EQ(expected_disabled_extensions, actual_disabled_extensions); |
| 98 } | 100 } |
| 99 | 101 |
| 100 } // namespace gpu | 102 } // namespace gpu |
| OLD | NEW |