AU: Start an UpdateAttempter unit test suite.
This increases the UpdateAttmpter line coverage to almost 40%. More is needed
but this is a good starting point / checkpoint. Also some UpdateCheckScheduler
unit test cleanup.
BUG=6243
TEST=unit tests, gmerge on device
Change-Id: I39c80de3f18095c4a28cb36ab868bed6d7073824
Review URL: http://codereview.chromium.org/3259011
diff --git a/update_attempter.cc b/update_attempter.cc
index 3614cad..694e774 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -87,7 +87,8 @@
UpdateAttempter::UpdateAttempter(PrefsInterface* prefs,
MetricsLibraryInterface* metrics_lib)
- : dbus_service_(NULL),
+ : processor_(new ActionProcessor()),
+ dbus_service_(NULL),
prefs_(prefs),
metrics_lib_(metrics_lib),
update_check_scheduler_(NULL),
@@ -124,8 +125,8 @@
LOG(ERROR) << "Unable to initialize Omaha request device params.";
return;
}
- CHECK(!processor_.IsRunning());
- processor_.set_delegate(this);
+ CHECK(!processor_->IsRunning());
+ processor_->set_delegate(this);
// Actions:
shared_ptr<OmahaRequestAction> update_check_action(
@@ -186,7 +187,7 @@
// Enqueue the actions
for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin();
it != actions_.end(); ++it) {
- processor_.EnqueueAction(it->get());
+ processor_->EnqueueAction(it->get());
}
// Bond them together. We have to use the leaf-types when calling
@@ -207,7 +208,7 @@
postinstall_runner_action_postcommit.get());
SetStatusAndNotify(UPDATE_STATUS_CHECKING_FOR_UPDATE);
- processor_.StartProcessing();
+ processor_->StartProcessing();
}
void UpdateAttempter::CheckForUpdate(const std::string& app_version,
@@ -426,9 +427,9 @@
error_event_.release(), // Pass ownership.
new LibcurlHttpFetcher));
actions_.push_back(shared_ptr<AbstractAction>(error_event_action));
- processor_.EnqueueAction(error_event_action.get());
+ processor_->EnqueueAction(error_event_action.get());
SetStatusAndNotify(UPDATE_STATUS_REPORTING_ERROR_EVENT);
- processor_.StartProcessing();
+ processor_->StartProcessing();
return true;
}