| 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 fe9b64466c3eb3d49bb041a9638ccd8157d787cc..245d053adff476c38228e62a4f25fa689e3f77ce 100644
|
| --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
|
| +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/chrome_notification_types.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"
|
| @@ -434,4 +435,53 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, LaunchEphemeralApp) {
|
| ASSERT_TRUE(RunInstallTest("webstore_launch_app.html", "app.crx"));
|
| }
|
|
|
| +class BundleWebstorePrivateApiTest
|
| + : public ExtensionWebstorePrivateApiTest {
|
| + public:
|
| + void SetUpInProcessBrowserTestFixture() override {
|
| + ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture();
|
| +
|
| + test_data_dir_ = test_data_dir_.AppendASCII("webstore_private/bundle");
|
| +
|
| + // The test server needs to have already started, so setup the switch here
|
| + // rather than in SetUpCommandLine.
|
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| + switches::kAppsGalleryDownloadURL,
|
| + GetTestServerURL("bundle/%s.crx").spec());
|
| + }
|
| +};
|
| +
|
| +// Tests successfully installing a bundle of 2 apps and 2 extensions.
|
| +IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundle) {
|
| + extensions::BundleInstaller::SetAutoApproveForTesting(true);
|
| + ASSERT_TRUE(RunPageTest(GetTestServerURL("install_bundle.html").spec()));
|
| +}
|
| +
|
| +// Tests that bundles can be installed from incognito windows.
|
| +IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundleIncognito) {
|
| + extensions::BundleInstaller::SetAutoApproveForTesting(true);
|
| +
|
| + ASSERT_TRUE(RunPageTest(GetTestServerURL("install_bundle.html").spec(),
|
| + ExtensionApiTest::kFlagUseIncognito));
|
| +}
|
| +
|
| +// Tests the user canceling the bundle install prompt.
|
| +IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, 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 (1 succeeds, 1 fails due to an invalid
|
| +// CRX, 1 fails due to the manifests not matching, and 1 fails due to a missing
|
| +// crx file).
|
| +IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundleInvalid) {
|
| + extensions::BundleInstaller::SetAutoApproveForTesting(true);
|
| +
|
| + ASSERT_TRUE(
|
| + RunPageTest(GetTestServerURL("install_bundle_invalid.html").spec()));
|
| +}
|
| +
|
| } // namespace extensions
|
|
|