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

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

Issue 8772031: Add a JS API for detecting WebGL availability. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/extensions/extension_install_dialog.h" 11 #include "chrome/browser/extensions/extension_install_dialog.h"
12 #include "chrome/browser/extensions/extension_install_ui.h" 12 #include "chrome/browser/extensions/extension_install_ui.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_webstore_private_api.h" 14 #include "chrome/browser/extensions/extension_webstore_private_api.h"
15 #include "chrome/browser/extensions/webstore_installer.h" 15 #include "chrome/browser/extensions/webstore_installer.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/browser/gpu/gpu_blacklist.h"
21 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
23 #include "net/base/mock_host_resolver.h" 24 #include "net/base/mock_host_resolver.h"
24 25
25 namespace { 26 namespace {
26 27
27 class WebstoreInstallListener : public WebstoreInstaller::Delegate { 28 class WebstoreInstallListener : public WebstoreInstaller::Delegate {
28 public: 29 public:
29 WebstoreInstallListener() 30 WebstoreInstallListener()
30 : received_failure_(false), received_success_(false), waiting_(false) {} 31 : received_failure_(false), received_success_(false), waiting_(false) {}
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 223 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
223 IconUrl) { 224 IconUrl) {
224 ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx")); 225 ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx"));
225 } 226 }
226 227
227 // Tests using silentlyInstall to install extensions. 228 // Tests using silentlyInstall to install extensions.
228 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { 229 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) {
229 WebstorePrivateApi::SetTrustTestIDsForTesting(true); 230 WebstorePrivateApi::SetTrustTestIDsForTesting(true);
230 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec())); 231 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec()));
231 } 232 }
233
234 // Tests getWebGLStatus function when webgl is allowed.
235 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest,
236 GetWebGLStatusAllowed) {
237 ASSERT_TRUE(
238 RunPageTest(GetTestServerURL("get_webgl_status_allowed.html").spec()));
239 }
240
241 // Tests getWebGLStatus function when webgl is blacklisted.
242 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest,
243 GetWebGLStatusBlocked) {
244 const std::string json_blacklist =
245 "{\n"
246 " \"name\": \"gpu blacklist\",\n"
247 " \"version\": \"1.0\",\n"
248 " \"entries\": [\n"
249 " {\n"
250 " \"id\": 1,\n"
251 " \"blacklist\": [\n"
252 " \"webgl\"\n"
253 " ]\n"
254 " }\n"
255 " ]\n"
256 "}";
257 scoped_ptr<Version> os_version(Version::GetVersionFromString("1.0"));
258 GpuBlacklist* blacklist = new GpuBlacklist("1.0");
259
260 ASSERT_TRUE(blacklist->LoadGpuBlacklist(
261 json_blacklist, GpuBlacklist::kAllOs));
262 GpuDataManager::GetInstance()->SetBuiltInGpuBlacklist(blacklist);
263 GpuFeatureFlags flags = GpuDataManager::GetInstance()->GetGpuFeatureFlags();
264 EXPECT_EQ(
265 flags.flags(), static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
266
267 ASSERT_TRUE(
268 RunPageTest(GetTestServerURL("get_webgl_status_blocked.html").spec()));
269 }
270
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698