Index: chrome/browser/extensions/extension_webstore_private_apitest.cc |
=================================================================== |
--- chrome/browser/extensions/extension_webstore_private_apitest.cc (revision 112998) |
+++ chrome/browser/extensions/extension_webstore_private_apitest.cc (working copy) |
@@ -17,10 +17,13 @@ |
#include "chrome/browser/ui/browser.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/test/base/test_launcher_utils.h" |
#include "chrome/test/base/ui_test_utils.h" |
+#include "content/browser/gpu/gpu_blacklist.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
#include "net/base/mock_host_resolver.h" |
+#include "ui/gfx/gl/gl_switches.h" |
namespace { |
@@ -86,6 +89,13 @@ |
ExtensionApiTest::SetUpCommandLine(command_line); |
command_line->AppendSwitchASCII(switches::kAppsGalleryURL, |
"http://www.example.com"); |
+ |
+ // In linux, we need to launch GPU process to decide if WebGL is allowed. |
+ // Run it on top of osmesa to avoid bot driver issues. |
+#if defined(OS_LINUX) |
+ test_launcher_utils::OverrideGLImplementation( |
+ command_line, gfx::kGLImplementationOSMesaName); |
+#endif |
} |
void SetUpInProcessBrowserTestFixture() OVERRIDE { |
@@ -229,3 +239,41 @@ |
WebstorePrivateApi::SetTrustTestIDsForTesting(true); |
ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec())); |
} |
+ |
+// Tests getWebGLStatus function when webgl is allowed. |
Mihai Parparita -not on Chrome
2011/12/06 02:58:11
Nit: Capitalize WebGL (applies below too).
Zhenyao Mo
2011/12/06 20:00:15
Done.
|
+IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, |
+ GetWebGLStatusAllowed) { |
+ ASSERT_TRUE( |
+ RunPageTest(GetTestServerURL("get_webgl_status_allowed.html").spec())); |
Mihai Parparita -not on Chrome
2011/12/06 02:58:11
For testing single function behavior, rather than
Zhenyao Mo
2011/12/06 20:00:15
I tried, but it didn't work because RunFunctionAnd
Zhenyao Mo
2011/12/06 20:19:57
Never mind. It's a bug in my own code. I switche
|
+} |
+ |
+// Tests getWebGLStatus function when webgl is blacklisted. |
+IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, |
+ GetWebGLStatusBlocked) { |
+ const std::string json_blacklist = |
+ "{\n" |
+ " \"name\": \"gpu blacklist\",\n" |
+ " \"version\": \"1.0\",\n" |
+ " \"entries\": [\n" |
+ " {\n" |
+ " \"id\": 1,\n" |
+ " \"blacklist\": [\n" |
+ " \"webgl\"\n" |
+ " ]\n" |
+ " }\n" |
+ " ]\n" |
+ "}"; |
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("1.0")); |
+ GpuBlacklist* blacklist = new GpuBlacklist("1.0"); |
+ |
+ ASSERT_TRUE(blacklist->LoadGpuBlacklist( |
+ json_blacklist, GpuBlacklist::kAllOs)); |
+ GpuDataManager::GetInstance()->SetGpuBlacklist(blacklist); |
+ GpuFeatureFlags flags = GpuDataManager::GetInstance()->GetGpuFeatureFlags(); |
+ EXPECT_EQ( |
+ flags.flags(), static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl)); |
+ |
+ ASSERT_TRUE( |
+ RunPageTest(GetTestServerURL("get_webgl_status_blocked.html").spec())); |
+} |
+ |