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

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

Issue 160311: Pull CrxInstaller out of ExtensionsService. (Closed)
Patch Set: Fix leak of SandboxedExtensionUnpacker Created 11 years, 5 months 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
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | chrome/browser/extensions/extensions_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_updater_unittest.cc
diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc
index ebe73fbf35f3a3acc192673198ef1824fb29c96b..6a41434efb5f5bcd1c617ed062b6e63a036665f2 100644
--- a/chrome/browser/extensions/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/extension_updater_unittest.cc
@@ -94,9 +94,7 @@ class MockService : public ExtensionUpdateService {
}
virtual void UpdateExtension(const std::string& id,
- const FilePath& extension_path,
- bool alert_on_error,
- ExtensionInstallCallback* callback) {
+ const FilePath& extension_path) {
EXPECT_TRUE(false);
}
@@ -160,33 +158,10 @@ class ServiceForManifestTests : public MockService {
class ServiceForDownloadTests : public MockService {
public:
- explicit ServiceForDownloadTests() : callback_(NULL) {}
- virtual ~ServiceForDownloadTests() {
- // expect that cleanup happened via FireInstallCallback
- EXPECT_EQ(NULL, callback_);
- EXPECT_TRUE(install_path_.empty());
- }
-
virtual void UpdateExtension(const std::string& id,
- const FilePath& extension_path,
- bool alert_on_error,
- ExtensionInstallCallback* callback) {
- // Since this mock only has support for one oustanding update, ensure
- // that the callback doesn't need to be run.
- EXPECT_TRUE(install_path_.empty());
- EXPECT_EQ(NULL, callback_);
-
+ const FilePath& extension_path) {
extension_id_ = id;
install_path_ = extension_path;
- callback_ = callback;
- }
-
- void FireInstallCallback() {
- EXPECT_TRUE(callback_ != NULL);
- callback_->Run(install_path_, static_cast<Extension*>(NULL));
- delete callback_;
- callback_ = NULL;
- install_path_ = FilePath();
}
const std::string& extension_id() { return extension_id_; }
@@ -195,7 +170,6 @@ class ServiceForDownloadTests : public MockService {
private:
std::string extension_id_;
FilePath install_path_;
- ExtensionInstallCallback* callback_;
};
static const int kUpdateFrequencySecs = 15;
@@ -416,13 +390,6 @@ class ExtensionUpdaterTest : public testing::Test {
EXPECT_TRUE(file_util::ReadFileToString(tmpfile_path, &file_contents));
EXPECT_TRUE(extension_data == file_contents);
- service.FireInstallCallback();
-
- message_loop.RunAllPending();
-
- // Make sure the temp file is cleaned up
- EXPECT_FALSE(file_util::PathExists(tmpfile_path));
-
URLFetcher::set_factory(NULL);
}
@@ -454,17 +421,11 @@ class ExtensionUpdaterTest : public testing::Test {
extension_data1);
message_loop.RunAllPending();
- // Expect that the service was asked to do an install with the right data,
- // and fire the callback indicating the install finished.
+ // Expect that the service was asked to do an install with the right data.
FilePath tmpfile_path = service.install_path();
EXPECT_FALSE(tmpfile_path.empty());
EXPECT_EQ(id1, service.extension_id());
- service.FireInstallCallback();
-
- // Make sure the tempfile got cleaned up.
message_loop.RunAllPending();
- EXPECT_FALSE(tmpfile_path.empty());
- EXPECT_FALSE(file_util::PathExists(tmpfile_path));
// Make sure the second fetch finished and asked the service to do an
// update.
@@ -483,8 +444,6 @@ class ExtensionUpdaterTest : public testing::Test {
EXPECT_TRUE(file_util::ReadFileToString(service.install_path(),
&file_contents));
EXPECT_TRUE(extension_data2 == file_contents);
- service.FireInstallCallback();
- message_loop.RunAllPending();
}
};
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | chrome/browser/extensions/extensions_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698