AU: Update status to DOWNLOADING only after receiving some bytes from server.
This ensures that users don't see an update download notification until
after a download has successfully started.
Also, added some DownloadActionDelegate unit tests.
BUG=5822
TEST=unit tests, gmerged to device, made sure updates happened and
notifications received
Change-Id: I96912dcd98a53e9bd7eecc63dab704f959a06441
Review URL: http://codereview.chromium.org/3131022
diff --git a/update_attempter.h b/update_attempter.h
index 1993321..0f5d605 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -87,7 +87,8 @@
// UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise.
bool RebootIfNeeded();
- // DownloadActionDelegate method
+ // DownloadActionDelegate methods
+ void SetDownloadStatus(bool active);
void BytesReceived(uint64_t bytes_received, uint64_t total);
private:
@@ -152,6 +153,10 @@
// The process priority management timeout source.
GSource* manage_priority_source_;
+ // Set to true if an update download is active (and BytesReceived
+ // will be called), set to false otherwise.
+ bool download_active_;
+
// For status:
UpdateStatus status_;
double download_progress_;