Index: gpu/config/gpu_driver_bug_list_unittest.cc |
diff --git a/gpu/config/gpu_driver_bug_list_unittest.cc b/gpu/config/gpu_driver_bug_list_unittest.cc |
index 1e4090b6084b0f7152218c4be87dc9bd6e8167ac..6d93674b3d7bf01bf34be730eacb63eb39e3c2d0 100644 |
--- a/gpu/config/gpu_driver_bug_list_unittest.cc |
+++ b/gpu/config/gpu_driver_bug_list_unittest.cc |
@@ -204,5 +204,34 @@ TEST_F(GpuDriverBugListTest, NVIDIANumberingScheme) { |
EXPECT_EQ(0u, bugs.count(DISABLE_D3D11)); |
} |
-} // namespace gpu |
+// Test that having two discrete graphics cards on Mac will not try to switch |
+// between them. |
+TEST_F(GpuDriverBugListTest, DualDiscreteGPUMac) { |
+ scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
+ std::string json; |
+ EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); |
+ // Just a single (AMD) card - nothing should be forced. |
+ GPUInfo gpu_info; |
+ gpu_info.gpu.vendor_id = 0x1002; |
+ std::set<int> bugs = |
+ list->MakeDecision(GpuControlList::kOsMacosx, "10.9", gpu_info); |
+ EXPECT_EQ(0u, bugs.count(FORCE_DISCRETE_GPU)); |
+ |
+ // Add an integrated (intel) card. This will always be secondary. |
+ gpu_info.secondary_gpus.resize(1); |
+ gpu_info.secondary_gpus.back().vendor_id = 0x8086; |
+ bugs = list->MakeDecision(GpuControlList::kOsMacosx, "10.9", gpu_info); |
+ EXPECT_EQ(0u, bugs.count(FORCE_DISCRETE_GPU)); |
+ |
+ // Add a secondary discrete GPU. Should force discrete. |
+ gpu_info.secondary_gpus.back().vendor_id = 0x1002; |
+ bugs = list->MakeDecision(GpuControlList::kOsMacosx, "10.9", gpu_info); |
+ EXPECT_EQ(1u, bugs.count(FORCE_DISCRETE_GPU)); |
+ |
+ // No effect on other platforms. |
+ bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); |
+ EXPECT_EQ(0u, bugs.count(FORCE_DISCRETE_GPU)); |
+} |
+ |
+} // namespace gpu |