UpdateEngine-side changes to allow updates over 3G based on device policy.
Some enterprise chromebooks have only 3G and hence they need the ability
to update over 3G if the enterprise policy allows that. This CL adds
the support in update_engine to enable that.
BUG=chromium-os:31099
TEST=Tested E2E on 3G, added unit tests and did regression testing.
CQ-DEPEND=I1a55a392f3dc0f12d917eb45dcf0456b57735514
Change-Id: I121bda35e54fa6c35e002a76db198d13b72b650e
Reviewed-on: https://gerrit.chromium.org/gerrit/25470
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/mock_http_fetcher.h b/mock_http_fetcher.h
index 31171f1..d3cc75a 100644
--- a/mock_http_fetcher.h
+++ b/mock_http_fetcher.h
@@ -11,6 +11,8 @@
#include <glib.h>
#include "update_engine/http_fetcher.h"
+#include "update_engine/mock_connection_manager.h"
+#include "update_engine/mock_system_state.h"
// This is a mock implementation of HttpFetcher which is useful for testing.
// All data must be passed into the ctor. When started, MockHttpFetcher will
@@ -31,13 +33,15 @@
MockHttpFetcher(const char* data,
size_t size,
ProxyResolver* proxy_resolver)
- : HttpFetcher(proxy_resolver),
+ : HttpFetcher(proxy_resolver, &mock_system_state_),
sent_size_(0),
timeout_source_(NULL),
timout_tag_(0),
paused_(false),
fail_transfer_(false),
- never_use_(false) {
+ never_use_(false),
+ mock_connection_manager_(&mock_system_state_) {
+ mock_system_state_.SetConnectionManager(&mock_connection_manager_);
data_.insert(data_.end(), data, data + size);
}
@@ -124,6 +128,9 @@
// Set to true if BeginTransfer should EXPECT fail.
bool never_use_;
+ MockSystemState mock_system_state_;
+ MockConnectionManager mock_connection_manager_;
+
DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher);
};