gpu_util_unittest.cc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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
  3. // found in the LICENSE file.
  4. #include "gpu/config/gpu_util.h"
  5. #include "base/command_line.h"
  6. #include "gpu/config/gpu_driver_bug_workaround_type.h"
  7. #include "gpu/config/gpu_info.h"
  8. #include "gpu/config/gpu_preferences.h"
  9. #include "gpu/config/gpu_switches.h"
  10. #include "testing/gtest/include/gtest/gtest.h"
  11. namespace gpu {
  12. TEST(GpuUtilTest, GetGpuFeatureInfo_WorkaroundFromCommandLine) {
  13. {
  14. base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
  15. GPUInfo gpu_info;
  16. GpuFeatureInfo gpu_feature_info = ComputeGpuFeatureInfo(
  17. gpu_info, GpuPreferences(), &command_line, nullptr);
  18. EXPECT_FALSE(gpu_feature_info.IsWorkaroundEnabled(
  19. USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
  20. }
  21. {
  22. base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
  23. command_line.AppendSwitchASCII(GpuDriverBugWorkaroundTypeToString(
  24. USE_GPU_DRIVER_WORKAROUND_FOR_TESTING),
  25. "1");
  26. GPUInfo gpu_info;
  27. GpuFeatureInfo gpu_feature_info = ComputeGpuFeatureInfo(
  28. gpu_info, GpuPreferences(), &command_line, nullptr);
  29. EXPECT_TRUE(gpu_feature_info.IsWorkaroundEnabled(
  30. USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
  31. }
  32. {
  33. base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
  34. command_line.AppendSwitchASCII(switches::kGpuDriverBugListTestGroup, "1");
  35. // See gpu/config/gpu_driver_bug_list.json, test_group 1, entry 215.
  36. GPUInfo gpu_info;
  37. GpuFeatureInfo gpu_feature_info = ComputeGpuFeatureInfo(
  38. gpu_info, GpuPreferences(), &command_line, nullptr);
  39. EXPECT_TRUE(gpu_feature_info.IsWorkaroundEnabled(
  40. USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
  41. }
  42. {
  43. base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
  44. command_line.AppendSwitchASCII(switches::kGpuDriverBugListTestGroup, "1");
  45. command_line.AppendSwitchASCII(GpuDriverBugWorkaroundTypeToString(
  46. USE_GPU_DRIVER_WORKAROUND_FOR_TESTING),
  47. "0");
  48. // See gpu/config/gpu_driver_bug_list.json, test_group 1, entry 215.
  49. GPUInfo gpu_info;
  50. GpuFeatureInfo gpu_feature_info = ComputeGpuFeatureInfo(
  51. gpu_info, GpuPreferences(), &command_line, nullptr);
  52. EXPECT_FALSE(gpu_feature_info.IsWorkaroundEnabled(
  53. USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
  54. }
  55. }
  56. } // namespace gpu