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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/gpu/gpu_data_manager_impl.h" | 7 #include "content/browser/gpu/gpu_data_manager_impl.h" |
8 #include "content/public/browser/gpu_data_manager_observer.h" | 8 #include "content/public/browser/gpu_data_manager_observer.h" |
9 #include "content/public/common/gpu_info.h" | 9 #include "content/public/common/gpu_info.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 " \"blacklist\": [\n" | 89 " \"blacklist\": [\n" |
90 " \"accelerated_2d_canvas\"\n" | 90 " \"accelerated_2d_canvas\"\n" |
91 " ]\n" | 91 " ]\n" |
92 " }\n" | 92 " }\n" |
93 " ]\n" | 93 " ]\n" |
94 "}"; | 94 "}"; |
95 | 95 |
96 content::GPUInfo gpu_info; | 96 content::GPUInfo gpu_info; |
97 gpu_info.gpu.vendor_id = 0x10de; | 97 gpu_info.gpu.vendor_id = 0x10de; |
98 gpu_info.gpu.device_id = 0x0640; | 98 gpu_info.gpu.device_id = 0x0640; |
99 manager->Initialize("0", blacklist_json, gpu_info); | 99 manager->InitializeForTesting(blacklist_json, gpu_info); |
100 | 100 |
101 EXPECT_TRUE(manager->GpuAccessAllowed()); | 101 EXPECT_TRUE(manager->GpuAccessAllowed()); |
102 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, | 102 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, |
103 manager->GetBlacklistedFeatures()); | 103 manager->GetBlacklistedFeatures()); |
104 | 104 |
105 gpu_info.gl_renderer = "NVIDIA GeForce GT 120"; | 105 gpu_info.gl_renderer = "NVIDIA GeForce GT 120"; |
106 manager->UpdateGpuInfo(gpu_info); | 106 manager->UpdateGpuInfo(gpu_info); |
107 EXPECT_FALSE(manager->GpuAccessAllowed()); | 107 EXPECT_FALSE(manager->GpuAccessAllowed()); |
108 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL | | 108 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL | |
109 content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, | 109 content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, |
(...skipping 26 matching lines...) Expand all Loading... |
136 " \"blacklist\": [\n" | 136 " \"blacklist\": [\n" |
137 " \"webgl\"\n" | 137 " \"webgl\"\n" |
138 " ]\n" | 138 " ]\n" |
139 " }\n" | 139 " }\n" |
140 " ]\n" | 140 " ]\n" |
141 "}"; | 141 "}"; |
142 | 142 |
143 content::GPUInfo gpu_info; | 143 content::GPUInfo gpu_info; |
144 gpu_info.gpu.vendor_id = 0x10de; | 144 gpu_info.gpu.vendor_id = 0x10de; |
145 gpu_info.gpu.device_id = 0x0640; | 145 gpu_info.gpu.device_id = 0x0640; |
146 manager->Initialize("0", blacklist_json, gpu_info); | 146 manager->InitializeForTesting(blacklist_json, gpu_info); |
147 | 147 |
148 EXPECT_TRUE(manager->GpuAccessAllowed()); | 148 EXPECT_TRUE(manager->GpuAccessAllowed()); |
149 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, | 149 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, |
150 manager->GetBlacklistedFeatures()); | 150 manager->GetBlacklistedFeatures()); |
151 | 151 |
152 // Now assue gpu process launches and full GPU info is collected. | 152 // Now assue gpu process launches and full GPU info is collected. |
153 gpu_info.gl_renderer = "NVIDIA GeForce GT 120"; | 153 gpu_info.gl_renderer = "NVIDIA GeForce GT 120"; |
154 manager->UpdateGpuInfo(gpu_info); | 154 manager->UpdateGpuInfo(gpu_info); |
155 EXPECT_TRUE(manager->GpuAccessAllowed()); | 155 EXPECT_TRUE(manager->GpuAccessAllowed()); |
156 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); | 156 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 content::GPUVideoMemoryUsageStats vram_stats; | 206 content::GPUVideoMemoryUsageStats vram_stats; |
207 manager->UpdateVideoMemoryUsageStats(vram_stats); | 207 manager->UpdateVideoMemoryUsageStats(vram_stats); |
208 | 208 |
209 base::RunLoop run_loop; | 209 base::RunLoop run_loop; |
210 run_loop.RunUntilIdle(); | 210 run_loop.RunUntilIdle(); |
211 EXPECT_TRUE(observer.video_memory_usage_stats_updated()); | 211 EXPECT_TRUE(observer.video_memory_usage_stats_updated()); |
212 | 212 |
213 delete manager; | 213 delete manager; |
214 } | 214 } |
215 | 215 |
OLD | NEW |