Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: gpu/config/gpu_info_collector_unittest.cc

Issue 1503223005: Identify the active GPU using GL strings in multiple GPU situation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/config/gpu_info_collector.cc ('k') | gpu/config/software_rendering_list_json.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/strings/string_split.h" 6 #include "base/strings/string_split.h"
7 #include "gpu/config/gpu_info.h" 7 #include "gpu/config/gpu_info.h"
8 #include "gpu/config/gpu_info_collector.h" 8 #include "gpu/config/gpu_info_collector.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 GPUInfo gpu_info; 295 GPUInfo gpu_info;
296 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) { 296 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) {
297 gpu_info.gl_renderer = kTestStrings[i].gl_renderer; 297 gpu_info.gl_renderer = kTestStrings[i].gl_renderer;
298 gpu_info.gl_vendor = kTestStrings[i].gl_vendor; 298 gpu_info.gl_vendor = kTestStrings[i].gl_vendor;
299 gpu_info.gl_version = kTestStrings[i].gl_version; 299 gpu_info.gl_version = kTestStrings[i].gl_version;
300 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess); 300 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess);
301 EXPECT_EQ(gpu_info.driver_version, kTestStrings[i].expected_driver_version); 301 EXPECT_EQ(gpu_info.driver_version, kTestStrings[i].expected_driver_version);
302 } 302 }
303 } 303 }
304 304
305 TEST(MultiGPUsTest, IdentifyActiveGPU) {
306 GPUInfo::GPUDevice nvidia_gpu;
307 nvidia_gpu.vendor_id = 0x10de;
308 nvidia_gpu.device_id = 0x0df8;
309 GPUInfo::GPUDevice intel_gpu;
310 intel_gpu.vendor_id = 0x8086;
311 intel_gpu.device_id = 0x0416;
312
313 GPUInfo gpu_info;
314 gpu_info.gpu = nvidia_gpu;
315 gpu_info.secondary_gpus.push_back(intel_gpu);
316
317 EXPECT_FALSE(gpu_info.gpu.active);
318 EXPECT_FALSE(gpu_info.secondary_gpus[0].active);
319
320 IdentifyActiveGPU(&gpu_info);
321 EXPECT_FALSE(gpu_info.gpu.active);
322 EXPECT_FALSE(gpu_info.secondary_gpus[0].active);
323
324 gpu_info.gl_vendor = "Intel Open Source Technology Center";
325 gpu_info.gl_renderer = "Mesa DRI Intel(R) Haswell Mobile";
326 IdentifyActiveGPU(&gpu_info);
327 EXPECT_FALSE(gpu_info.gpu.active);
328 EXPECT_TRUE(gpu_info.secondary_gpus[0].active);
329
330 gpu_info.gl_vendor = "NVIDIA Corporation";
331 gpu_info.gl_renderer = "Quadro 600/PCIe/SSE2";
332 IdentifyActiveGPU(&gpu_info);
333 EXPECT_TRUE(gpu_info.gpu.active);
334 EXPECT_FALSE(gpu_info.secondary_gpus[0].active);
335 }
336
337 TEST(MultiGPUsTest, IdentifyActiveGPUAvoidFalseMatch) {
338 // Verify that "Corporation" won't be matched with "ati".
339 GPUInfo::GPUDevice amd_gpu;
340 amd_gpu.vendor_id = 0x1002;
341 amd_gpu.device_id = 0x0df8;
342 GPUInfo::GPUDevice intel_gpu;
343 intel_gpu.vendor_id = 0x8086;
344 intel_gpu.device_id = 0x0416;
345
346 GPUInfo gpu_info;
347 gpu_info.gpu = amd_gpu;
348 gpu_info.secondary_gpus.push_back(intel_gpu);
349
350 gpu_info.gl_vendor = "Google Corporation";
351 gpu_info.gl_renderer = "Chrome GPU Team";
352 IdentifyActiveGPU(&gpu_info);
353 EXPECT_FALSE(gpu_info.gpu.active);
354 EXPECT_FALSE(gpu_info.secondary_gpus[0].active);
355 }
356
305 } // namespace gpu 357 } // namespace gpu
306 358
OLDNEW
« no previous file with comments | « gpu/config/gpu_info_collector.cc ('k') | gpu/config/software_rendering_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698