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

Unified Diff: chrome/browser/extensions/extension_webstore_private_apitest.cc

Issue 8430033: Adds a webstorePrivate method for silently installing extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mihai Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_webstore_private_apitest.cc
diff --git a/chrome/browser/extensions/extension_webstore_private_apitest.cc b/chrome/browser/extensions/extension_webstore_private_apitest.cc
index d7fbf65a7050d69733c5cb82cea3d79e1cc93996..18d49e4ccc7b9d5899ba484716be64722f1cae41 100644
--- a/chrome/browser/extensions/extension_webstore_private_apitest.cc
+++ b/chrome/browser/extensions/extension_webstore_private_apitest.cc
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <vector>
+
+#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/stringprintf.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_install_dialog.h"
@@ -125,6 +129,47 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
}
};
+class ExtensionWebstorePrivateBundleTest
+ : public ExtensionWebstorePrivateApiTest {
+ public:
+ 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());
+
+ PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg");
+ PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk");
+ PackCRX("mpneghmdnmaolkljkipbhaienajcflfe");
+ }
+
+ void TearDownInProcessBrowserTestFixture() OVERRIDE {
+ ExtensionWebstorePrivateApiTest::TearDownInProcessBrowserTestFixture();
+ for (size_t i = 0; i < test_crx_.size(); ++i)
+ ASSERT_TRUE(file_util::Delete(test_crx_[i], false));
+ }
+
+ private:
+ void PackCRX(const std::string& id) {
+ FilePath data_path = test_data_dir_.AppendASCII("webstore_private/bundle");
+ FilePath dir_path = data_path.AppendASCII(id);
+ FilePath pem_path = data_path.AppendASCII(id + ".pem");
+ FilePath crx_path = data_path.AppendASCII(id + ".crx");
+ FilePath destination = PackExtensionWithOptions(
+ dir_path, crx_path, pem_path, FilePath());
+
+ ASSERT_FALSE(destination.empty());
+ ASSERT_EQ(destination, crx_path);
+
+ test_crx_.push_back(destination);
+ }
+
+ std::vector<FilePath> test_crx_;
+};
+
// Test cases where the user accepts the install confirmation dialog.
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallAccepted) {
ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx"));
@@ -178,3 +223,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
IconUrl) {
ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx"));
}
+
+// Tests using silentlyInstall to install extensions.
+IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) {
+ WebstorePrivateApi::SetTrustTestIDsForTesting(true);
+ ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec()));
+}
« no previous file with comments | « chrome/browser/extensions/extension_webstore_private_api.cc ('k') | chrome/browser/extensions/webstore_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698