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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 TEST_F(GpuDataManagerImplTest, GpuSideBlacklisting) { | 62 TEST_F(GpuDataManagerImplTest, GpuSideBlacklisting) { |
63 // If a feature is allowed in preliminary step (browser side), but | 63 // If a feature is allowed in preliminary step (browser side), but |
64 // disabled when GPU process launches and collects full GPU info, | 64 // disabled when GPU process launches and collects full GPU info, |
65 // it's too late to let renderer know, so we basically block all GPU | 65 // it's too late to let renderer know, so we basically block all GPU |
66 // access, to be on the safe side. | 66 // access, to be on the safe side. |
67 GpuDataManagerImpl* manager = new GpuDataManagerImpl(); | 67 GpuDataManagerImpl* manager = new GpuDataManagerImpl(); |
68 ASSERT_TRUE(manager); | 68 ASSERT_TRUE(manager); |
69 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); | 69 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); |
70 EXPECT_TRUE(manager->GpuAccessAllowed()); | 70 EXPECT_TRUE(manager->GpuAccessAllowed()); |
71 | 71 |
72 manager->UpdateBlacklistedFeatures( | 72 manager->SetPreliminaryBlacklistedFeatures( |
73 content::GPU_FEATURE_TYPE_WEBGL); | 73 content::GPU_FEATURE_TYPE_WEBGL); |
74 manager->UpdatePreliminaryBlacklistedFeatures(); | |
75 EXPECT_TRUE(manager->GpuAccessAllowed()); | 74 EXPECT_TRUE(manager->GpuAccessAllowed()); |
76 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, | 75 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, |
77 manager->GetBlacklistedFeatures()); | 76 manager->GetBlacklistedFeatures()); |
78 | 77 |
79 manager->UpdateBlacklistedFeatures( | 78 manager->UpdateBlacklistedFeatures( |
80 content::GPU_FEATURE_TYPE_WEBGL); | 79 content::GPU_FEATURE_TYPE_WEBGL); |
81 EXPECT_TRUE(manager->GpuAccessAllowed()); | 80 EXPECT_TRUE(manager->GpuAccessAllowed()); |
82 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, | 81 EXPECT_EQ(content::GPU_FEATURE_TYPE_WEBGL, |
83 manager->GetBlacklistedFeatures()); | 82 manager->GetBlacklistedFeatures()); |
84 | 83 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 content::GPUVideoMemoryUsageStats vram_stats; | 138 content::GPUVideoMemoryUsageStats vram_stats; |
140 manager->UpdateVideoMemoryUsageStats(vram_stats); | 139 manager->UpdateVideoMemoryUsageStats(vram_stats); |
141 | 140 |
142 base::RunLoop run_loop; | 141 base::RunLoop run_loop; |
143 run_loop.RunUntilIdle(); | 142 run_loop.RunUntilIdle(); |
144 EXPECT_TRUE(observer.video_memory_usage_stats_updated()); | 143 EXPECT_TRUE(observer.video_memory_usage_stats_updated()); |
145 | 144 |
146 delete manager; | 145 delete manager; |
147 } | 146 } |
148 | 147 |
OLD | NEW |