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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_unittest.cc

Issue 10968042: Some extra testing for GpuDataManager. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl.cc ('k') | no next file » | 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/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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 TEST_F(GpuDataManagerImplTest, BlacklistCard) { 161 TEST_F(GpuDataManagerImplTest, BlacklistCard) {
162 GpuDataManagerImpl* manager = new GpuDataManagerImpl(); 162 GpuDataManagerImpl* manager = new GpuDataManagerImpl();
163 ASSERT_TRUE(manager); 163 ASSERT_TRUE(manager);
164 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); 164 EXPECT_EQ(0, manager->GetBlacklistedFeatures());
165 EXPECT_TRUE(manager->GpuAccessAllowed()); 165 EXPECT_TRUE(manager->GpuAccessAllowed());
166 166
167 manager->BlacklistCard(); 167 manager->BlacklistCard();
168 EXPECT_FALSE(manager->GpuAccessAllowed()); 168 EXPECT_FALSE(manager->GpuAccessAllowed());
169 EXPECT_EQ(content::GPU_FEATURE_TYPE_ALL,
170 manager->GetBlacklistedFeatures());
171
172 delete manager;
173 }
174
175 TEST_F(GpuDataManagerImplTest, SoftwareRendering) {
176 GpuDataManagerImpl* manager = new GpuDataManagerImpl();
177 ASSERT_TRUE(manager);
178 EXPECT_EQ(0, manager->GetBlacklistedFeatures());
179 EXPECT_TRUE(manager->GpuAccessAllowed());
180
181 EXPECT_FALSE(manager->ShouldUseSoftwareRendering());
182
183 manager->BlacklistCard();
jbauman 2012/09/21 21:02:38 It might also be nice to add a test (in a separate
184 EXPECT_FALSE(manager->GpuAccessAllowed());
185 EXPECT_FALSE(manager->ShouldUseSoftwareRendering());
169 186
170 // If software rendering is enabled, even if we blacklist GPU, 187 // If software rendering is enabled, even if we blacklist GPU,
171 // GPU process is still allowed. 188 // GPU process is still allowed.
172 manager->software_rendering_ = true; 189 const FilePath test_path(FILE_PATH_LITERAL("AnyPath"));
190 manager->RegisterSwiftShaderPath(test_path);
191 EXPECT_TRUE(manager->ShouldUseSoftwareRendering());
173 EXPECT_TRUE(manager->GpuAccessAllowed()); 192 EXPECT_TRUE(manager->GpuAccessAllowed());
193 EXPECT_EQ(content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS,
194 manager->GetBlacklistedFeatures());
174 195
175 delete manager; 196 delete manager;
176 } 197 }
177 198
178 TEST_F(GpuDataManagerImplTest, GpuInfoUpdate) { 199 TEST_F(GpuDataManagerImplTest, GpuInfoUpdate) {
179 GpuDataManagerImpl* manager = new GpuDataManagerImpl(); 200 GpuDataManagerImpl* manager = new GpuDataManagerImpl();
180 ASSERT_TRUE(manager); 201 ASSERT_TRUE(manager);
181 202
182 TestObserver observer; 203 TestObserver observer;
183 manager->AddObserver(&observer); 204 manager->AddObserver(&observer);
(...skipping 22 matching lines...) Expand all
206 content::GPUVideoMemoryUsageStats vram_stats; 227 content::GPUVideoMemoryUsageStats vram_stats;
207 manager->UpdateVideoMemoryUsageStats(vram_stats); 228 manager->UpdateVideoMemoryUsageStats(vram_stats);
208 229
209 base::RunLoop run_loop; 230 base::RunLoop run_loop;
210 run_loop.RunUntilIdle(); 231 run_loop.RunUntilIdle();
211 EXPECT_TRUE(observer.video_memory_usage_stats_updated()); 232 EXPECT_TRUE(observer.video_memory_usage_stats_updated());
212 233
213 delete manager; 234 delete manager;
214 } 235 }
215 236
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698