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

Side by Side Diff: chrome/browser/extensions/requirements_checker_browsertest.cc

Issue 239083006: Change ACCELERATED_COMPOSITING blacklist to GPU_COMPOSITING. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blacklistaccel: tests Created 6 years, 8 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
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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 expected_errors.push_back(l10n_util::GetStringUTF8( 111 expected_errors.push_back(l10n_util::GetStringUTF8(
112 IDS_EXTENSION_WINDOW_SHAPE_NOT_SUPPORTED)); 112 IDS_EXTENSION_WINDOW_SHAPE_NOT_SUPPORTED));
113 #endif // !defined(USE_AURA) 113 #endif // !defined(USE_AURA)
114 114
115 checker_.Check(extension, base::Bind( 115 checker_.Check(extension, base::Bind(
116 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, 116 &RequirementsCheckerBrowserTest::ValidateRequirementErrors,
117 base::Unretained(this), expected_errors)); 117 base::Unretained(this), expected_errors));
118 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 118 content::BrowserThread::GetBlockingPool()->FlushForTesting();
119 } 119 }
120 120
121 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, DisallowCSS3D) {
122 scoped_refptr<const Extension> extension(
123 LoadExtensionFromDirName("require_3d"));
124 ASSERT_TRUE(extension.get());
125
126 // Blacklist css3d
127 std::vector<std::string> blacklisted_features;
128 blacklisted_features.push_back("accelerated_compositing");
129 BlackListGPUFeatures(blacklisted_features);
130 content::BrowserThread::GetBlockingPool()->FlushForTesting();
131
132 std::vector<std::string> expected_errors;
133 expected_errors.push_back(l10n_util::GetStringUTF8(
134 IDS_EXTENSION_CSS3D_NOT_SUPPORTED));
135
136 checker_.Check(extension, base::Bind(
137 &RequirementsCheckerBrowserTest::ValidateRequirementErrors,
138 base::Unretained(this), expected_errors));
139 content::BrowserThread::GetBlockingPool()->FlushForTesting();
140 }
141
142 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, DisallowWebGL) { 121 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, DisallowWebGL) {
143 scoped_refptr<const Extension> extension( 122 scoped_refptr<const Extension> extension(
144 LoadExtensionFromDirName("require_3d")); 123 LoadExtensionFromDirName("require_3d"));
145 ASSERT_TRUE(extension.get()); 124 ASSERT_TRUE(extension.get());
146 125
147 // Backlist webgl 126 // Backlist webgl
148 std::vector<std::string> blacklisted_features; 127 std::vector<std::string> blacklisted_features;
149 blacklisted_features.push_back("webgl"); 128 blacklisted_features.push_back("webgl");
150 BlackListGPUFeatures(blacklisted_features); 129 BlackListGPUFeatures(blacklisted_features);
151 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 130 content::BrowserThread::GetBlockingPool()->FlushForTesting();
152 131
153 std::vector<std::string> expected_errors; 132 std::vector<std::string> expected_errors;
154 expected_errors.push_back(l10n_util::GetStringUTF8( 133 expected_errors.push_back(l10n_util::GetStringUTF8(
155 IDS_EXTENSION_WEBGL_NOT_SUPPORTED)); 134 IDS_EXTENSION_WEBGL_NOT_SUPPORTED));
156 135
157 checker_.Check(extension, base::Bind( 136 checker_.Check(extension, base::Bind(
158 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, 137 &RequirementsCheckerBrowserTest::ValidateRequirementErrors,
159 base::Unretained(this), expected_errors)); 138 base::Unretained(this), expected_errors));
160 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 139 content::BrowserThread::GetBlockingPool()->FlushForTesting();
161 } 140 }
162 141
163 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, DisallowGPUFeatures) {
164 scoped_refptr<const Extension> extension(
165 LoadExtensionFromDirName("require_3d"));
166 ASSERT_TRUE(extension.get());
167
168 // Backlist both webgl and css3d
169 std::vector<std::string> blacklisted_features;
170 blacklisted_features.push_back("webgl");
171 blacklisted_features.push_back("accelerated_compositing");
172 BlackListGPUFeatures(blacklisted_features);
173 content::BrowserThread::GetBlockingPool()->FlushForTesting();
174
175 std::vector<std::string> expected_errors;
176 expected_errors.push_back(l10n_util::GetStringUTF8(
177 IDS_EXTENSION_WEBGL_NOT_SUPPORTED));
178 expected_errors.push_back(l10n_util::GetStringUTF8(
179 IDS_EXTENSION_CSS3D_NOT_SUPPORTED));
180
181 checker_.Check(extension, base::Bind(
182 &RequirementsCheckerBrowserTest::ValidateRequirementErrors,
183 base::Unretained(this), expected_errors));
184 content::BrowserThread::GetBlockingPool()->FlushForTesting();
185 }
186
187 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, Check3DExtension) { 142 IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, Check3DExtension) {
188 scoped_refptr<const Extension> extension( 143 scoped_refptr<const Extension> extension(
189 LoadExtensionFromDirName("require_3d")); 144 LoadExtensionFromDirName("require_3d"));
190 ASSERT_TRUE(extension.get()); 145 ASSERT_TRUE(extension.get());
191 146
192 std::vector<std::string> expected_errors; 147 std::vector<std::string> expected_errors;
193 148
194 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { 149 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) {
195 expected_errors.push_back(l10n_util::GetStringUTF8( 150 expected_errors.push_back(l10n_util::GetStringUTF8(
196 IDS_EXTENSION_WEBGL_NOT_SUPPORTED)); 151 IDS_EXTENSION_WEBGL_NOT_SUPPORTED));
197 expected_errors.push_back(l10n_util::GetStringUTF8(
198 IDS_EXTENSION_CSS3D_NOT_SUPPORTED));
199 } 152 }
200 153
201 checker_.Check(extension, base::Bind( 154 checker_.Check(extension, base::Bind(
202 &RequirementsCheckerBrowserTest::ValidateRequirementErrors, 155 &RequirementsCheckerBrowserTest::ValidateRequirementErrors,
203 base::Unretained(this), expected_errors)); 156 base::Unretained(this), expected_errors));
204 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 157 content::BrowserThread::GetBlockingPool()->FlushForTesting();
205 } 158 }
206 159
207 } // namespace extensions 160 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698