OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 gpu_info.driver_version = "8.21"; | 862 gpu_info.driver_version = "8.21"; |
863 type = blacklist->DetermineGpuFeatureType( | 863 type = blacklist->DetermineGpuFeatureType( |
864 GpuBlacklist::kOsLinux, &os_version, gpu_info); | 864 GpuBlacklist::kOsLinux, &os_version, gpu_info); |
865 EXPECT_EQ(type, 0); | 865 EXPECT_EQ(type, 0); |
866 | 866 |
867 gpu_info.driver_version = "8.2010"; | 867 gpu_info.driver_version = "8.2010"; |
868 type = blacklist->DetermineGpuFeatureType( | 868 type = blacklist->DetermineGpuFeatureType( |
869 GpuBlacklist::kOsLinux, &os_version, gpu_info); | 869 GpuBlacklist::kOsLinux, &os_version, gpu_info); |
870 EXPECT_EQ(type, 0); | 870 EXPECT_EQ(type, 0); |
871 } | 871 } |
| 872 |
| 873 TEST_F(GpuBlacklistTest, MultipleGPUsAny) { |
| 874 const std::string multi_gpu_json = |
| 875 "{\n" |
| 876 " \"name\": \"gpu blacklist\",\n" |
| 877 " \"version\": \"0.1\",\n" |
| 878 " \"entries\": [\n" |
| 879 " {\n" |
| 880 " \"id\": 1,\n" |
| 881 " \"os\": {\n" |
| 882 " \"type\": \"macosx\"\n" |
| 883 " },\n" |
| 884 " \"vendor_id\": \"0x8086\",\n" |
| 885 " \"device_id\": [\"0x0166\"],\n" |
| 886 " \"multi_gpu_category\": \"any\",\n" |
| 887 " \"blacklist\": [\n" |
| 888 " \"webgl\"\n" |
| 889 " ]\n" |
| 890 " }\n" |
| 891 " ]\n" |
| 892 "}"; |
| 893 Version os_version("10.6.4"); |
| 894 |
| 895 content::GPUInfo gpu_info; |
| 896 gpu_info.gpu.vendor_id = 0x10de; |
| 897 gpu_info.gpu.device_id = 0x0fd5; |
| 898 |
| 899 scoped_ptr<GpuBlacklist> blacklist(Create()); |
| 900 EXPECT_TRUE(blacklist->LoadGpuBlacklist( |
| 901 multi_gpu_json, GpuBlacklist::kAllOs)); |
| 902 GpuFeatureType type = blacklist->DetermineGpuFeatureType( |
| 903 GpuBlacklist::kOsMacosx, &os_version, gpu_info); |
| 904 EXPECT_EQ(type, 0); |
| 905 |
| 906 content::GPUInfo::GPUDevice gpu_device; |
| 907 gpu_device.vendor_id = 0x8086; |
| 908 gpu_device.device_id = 0x0166; |
| 909 gpu_info.secondary_gpus.push_back(gpu_device); |
| 910 type = blacklist->DetermineGpuFeatureType( |
| 911 GpuBlacklist::kOsMacosx, &os_version, gpu_info); |
| 912 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); |
| 913 } |
| 914 |
| 915 TEST_F(GpuBlacklistTest, MultipleGPUsSecondary) { |
| 916 const std::string multi_gpu_json = |
| 917 "{\n" |
| 918 " \"name\": \"gpu blacklist\",\n" |
| 919 " \"version\": \"0.1\",\n" |
| 920 " \"entries\": [\n" |
| 921 " {\n" |
| 922 " \"id\": 1,\n" |
| 923 " \"os\": {\n" |
| 924 " \"type\": \"macosx\"\n" |
| 925 " },\n" |
| 926 " \"vendor_id\": \"0x8086\",\n" |
| 927 " \"device_id\": [\"0x0166\"],\n" |
| 928 " \"multi_gpu_category\": \"secondary\",\n" |
| 929 " \"blacklist\": [\n" |
| 930 " \"webgl\"\n" |
| 931 " ]\n" |
| 932 " }\n" |
| 933 " ]\n" |
| 934 "}"; |
| 935 Version os_version("10.6.4"); |
| 936 |
| 937 content::GPUInfo gpu_info; |
| 938 gpu_info.gpu.vendor_id = 0x10de; |
| 939 gpu_info.gpu.device_id = 0x0fd5; |
| 940 |
| 941 scoped_ptr<GpuBlacklist> blacklist(Create()); |
| 942 EXPECT_TRUE(blacklist->LoadGpuBlacklist( |
| 943 multi_gpu_json, GpuBlacklist::kAllOs)); |
| 944 GpuFeatureType type = blacklist->DetermineGpuFeatureType( |
| 945 GpuBlacklist::kOsMacosx, &os_version, gpu_info); |
| 946 EXPECT_EQ(type, 0); |
| 947 |
| 948 content::GPUInfo::GPUDevice gpu_device; |
| 949 gpu_device.vendor_id = 0x8086; |
| 950 gpu_device.device_id = 0x0166; |
| 951 gpu_info.secondary_gpus.push_back(gpu_device); |
| 952 type = blacklist->DetermineGpuFeatureType( |
| 953 GpuBlacklist::kOsMacosx, &os_version, gpu_info); |
| 954 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); |
| 955 } |
| 956 |
OLD | NEW |