Index: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc |
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc |
index 702d4a9f193607c73ca42ec1bb78d75256a5a0ff..feb7ba9a46a1d92faaf545223ca3d743e4e86ad5 100644 |
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc |
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc |
@@ -9,7 +9,6 @@ |
#include "base/stringprintf.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
-#include "chrome/browser/extensions/bundle_installer.h" |
#include "chrome/browser/extensions/extension_apitest.h" |
#include "chrome/browser/extensions/extension_function_test_utils.h" |
#include "chrome/browser/extensions/extension_install_prompt.h" |
@@ -154,107 +153,6 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { |
base::ScopedTempDir tmp_; |
}; |
-class ExtensionWebstorePrivateBundleTest |
- : public ExtensionWebstorePrivateApiTest { |
- public: |
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
- ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); |
- |
- // The test server needs to have already started, so setup the switch here |
- // rather than in SetUpCommandLine. |
- CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
- switches::kAppsGalleryDownloadURL, |
- GetTestServerURL("bundle/%s.crx").spec()); |
- } |
- |
- virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
- ExtensionWebstorePrivateApiTest::TearDownInProcessBrowserTestFixture(); |
- for (size_t i = 0; i < test_crx_.size(); ++i) |
- ASSERT_TRUE(file_util::Delete(test_crx_[i], false)); |
- } |
- |
- protected: |
- // Packs the |manifest| file into a CRX using |id|'s PEM key. |
- void PackCRX(const std::string& id, const std::string& manifest) { |
- // Move the extension to a temporary directory. |
- base::ScopedTempDir tmp; |
- ASSERT_TRUE(tmp.CreateUniqueTempDir()); |
- ASSERT_TRUE(file_util::CreateDirectory(tmp.path())); |
- |
- base::FilePath tmp_manifest = tmp.path().AppendASCII("manifest.json"); |
- base::FilePath data_path = |
- test_data_dir_.AppendASCII("webstore_private/bundle"); |
- base::FilePath manifest_path = data_path.AppendASCII(manifest); |
- |
- ASSERT_TRUE(file_util::PathExists(manifest_path)); |
- ASSERT_TRUE(file_util::CopyFile(manifest_path, tmp_manifest)); |
- |
- PackCRX(id, tmp.path()); |
- } |
- |
- // Packs the extension at |ext_path| using |id|'s PEM key. |
- void PackCRX(const std::string& id, const base::FilePath& ext_path) { |
- base::FilePath data_path = |
- tmp_.path().AppendASCII("webstore_private/bundle"); |
- base::FilePath pem_path = data_path.AppendASCII(id + ".pem"); |
- base::FilePath crx_path = data_path.AppendASCII(id + ".crx"); |
- base::FilePath destination = PackExtensionWithOptions( |
- ext_path, crx_path, pem_path, base::FilePath()); |
- |
- ASSERT_FALSE(destination.empty()); |
- ASSERT_EQ(destination, crx_path); |
- |
- test_crx_.push_back(destination); |
- } |
- |
- // Creates an invalid CRX. |
- void PackInvalidCRX(const std::string& id) { |
- base::FilePath contents = test_data_dir_ |
- .AppendASCII("webstore_private") |
- .AppendASCII("install_bundle_invalid.html"); |
- base::FilePath crx_path = test_data_dir_ |
- .AppendASCII("webstore_private/bundle") |
- .AppendASCII(id + ".crx"); |
- |
- ASSERT_TRUE(file_util::CopyFile(contents, crx_path)); |
- |
- test_crx_.push_back(crx_path); |
- } |
- |
- private: |
- std::vector<base::FilePath> test_crx_; |
-}; |
- |
-class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { |
- public: |
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
- // 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_MACOSX) |
- CHECK(test_launcher_utils::OverrideGLImplementation( |
- command_line, gfx::kGLImplementationOSMesaName)) << |
- "kUseGL must not be set multiple times!"; |
-#endif |
- } |
- |
- protected: |
- void RunTest(bool webgl_allowed) { |
- static const char kEmptyArgs[] = "[]"; |
- static const char kWebGLStatusAllowed[] = "webgl_allowed"; |
- static const char kWebGLStatusBlocked[] = "webgl_blocked"; |
- scoped_refptr<GetWebGLStatusFunction> function = |
- new GetWebGLStatusFunction(); |
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
- function.get(), kEmptyArgs, browser())); |
- ASSERT_TRUE(result); |
- EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); |
- std::string webgl_status; |
- EXPECT_TRUE(result->GetAsString(&webgl_status)); |
- EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, |
- webgl_status.c_str()); |
- } |
-}; |
- |
// Test cases for webstore origin frame blocking. |
// TODO(mkwst): Disabled until new X-Frame-Options behavior rolls into |
// Chromium, see crbug.com/226018. |
@@ -398,76 +296,35 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, EmptyCrx) { |
ASSERT_TRUE(RunInstallTest("empty.html", "empty.crx")); |
} |
-// Tests successfully installing a bundle of 2 apps and 2 extensions. |
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, InstallBundle) { |
- extensions::BundleInstaller::SetAutoApproveForTesting(true); |
- |
- PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json"); |
- PackCRX("pkapffpjmiilhlhbibjhamlmdhfneidj", "extension2.json"); |
- PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app1.json"); |
- PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "app2.json"); |
- |
- ASSERT_TRUE(RunPageTest(GetTestServerURL("install_bundle.html").spec())); |
-} |
- |
-#if defined(OS_WIN) |
-// Acting flakey in Windows. http://crbug.com/160219 |
-#define MAYBE_InstallBundleIncognito DISABLED_InstallBundleIncognito |
-#else |
-#define MAYBE_InstallBundleIncognito InstallBundleIncognito |
+class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { |
+ public: |
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
+ // 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_MACOSX) |
+ CHECK(test_launcher_utils::OverrideGLImplementation( |
+ command_line, gfx::kGLImplementationOSMesaName)) << |
+ "kUseGL must not be set multiple times!"; |
#endif |
+ } |
-// Tests that bundles can be installed from incognito windows. |
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, |
- MAYBE_InstallBundleIncognito) { |
- extensions::BundleInstaller::SetAutoApproveForTesting(true); |
- |
- PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json"); |
- PackCRX("pkapffpjmiilhlhbibjhamlmdhfneidj", "extension2.json"); |
- PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app1.json"); |
- PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "app2.json"); |
- |
- ASSERT_TRUE(RunPageTest(GetTestServerURL("install_bundle.html").spec(), |
- ExtensionApiTest::kFlagUseIncognito)); |
-} |
- |
-// Tests the user canceling the bundle install prompt. |
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, |
- InstallBundleCancel) { |
- // We don't need to create the CRX files since we are aborting the install. |
- extensions::BundleInstaller::SetAutoApproveForTesting(false); |
- ASSERT_TRUE(RunPageTest(GetTestServerURL( |
- "install_bundle_cancel.html").spec())); |
-} |
- |
-// Tests partially installing a bundle (2 succeed, 1 fails due to an invalid |
-// CRX, and 1 fails due to the manifests not matching). |
-#if defined(OS_WIN) |
-// Times out on Windows. http://crbug.com/238805 |
-#define MAYBE_InstallBundleInvalid DISABLED_InstallBundleInvalid |
-#else |
-#define MAYBE_InstallBundleInvalid InstallBundleInvalid |
-#endif |
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, |
- MAYBE_InstallBundleInvalid) { |
- extensions::BundleInstaller::SetAutoApproveForTesting(true); |
- |
- PackInvalidCRX("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
- PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json"); |
- PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app1.json"); |
- |
- ASSERT_TRUE(RunPageTest(GetTestServerURL( |
- "install_bundle_invalid.html").spec())); |
- |
- ASSERT_TRUE(service()->GetExtensionById( |
- "begfmnajjkbjdgmffnjaojchoncnmngg", false)); |
- ASSERT_FALSE(service()->GetExtensionById( |
- "pkapffpjmiilhlhbibjhamlmdhfneidj", true)); |
- ASSERT_FALSE(service()->GetExtensionById( |
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", true)); |
- ASSERT_FALSE(service()->GetExtensionById( |
- "bmfoocgfinpmkmlbjhcbofejhkhlbchk", true)); |
-} |
+ protected: |
+ void RunTest(bool webgl_allowed) { |
+ static const char kEmptyArgs[] = "[]"; |
+ static const char kWebGLStatusAllowed[] = "webgl_allowed"; |
+ static const char kWebGLStatusBlocked[] = "webgl_blocked"; |
+ scoped_refptr<GetWebGLStatusFunction> function = |
+ new GetWebGLStatusFunction(); |
+ scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
+ function.get(), kEmptyArgs, browser())); |
+ ASSERT_TRUE(result); |
+ EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); |
+ std::string webgl_status; |
+ EXPECT_TRUE(result->GetAsString(&webgl_status)); |
+ EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, |
+ webgl_status.c_str()); |
+ } |
+}; |
// Tests getWebGLStatus function when WebGL is allowed. |
IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Allowed) { |