AU: OmahaRequestAction: allow to be skipped.
This CL changes OmahaRequestAction to take a request to skip its
action when it's run. This will be useful in a future CL, where we'll
want to schedule an OmahaRequestAction to run, but then in some cases
prevent it from actually doing so.
This also changes MockHttpFetcher to be able, if properly configured,
to fail it it's used. This is used in the test to make sure that a
skipped OmahaRequestAction does no HTTP traffic.
BUG=chromium-os:13813
TEST=unittests
Review URL: http://codereview.chromium.org/6677146
Change-Id: Ic3e4099d221c4d7d0bca65b1a0064c33dca4edb5
diff --git a/mock_http_fetcher.cc b/mock_http_fetcher.cc
index 1a88b94..5452d5d 100644
--- a/mock_http_fetcher.cc
+++ b/mock_http_fetcher.cc
@@ -3,10 +3,14 @@
// found in the LICENSE file.
#include "update_engine/mock_http_fetcher.h"
-#include <algorithm>
-#include "base/logging.h"
-// This is a mac implementation of HttpFetcher which is useful for testing.
+#include <algorithm>
+
+#include <base/logging.h>
+#include <gtest/gtest.h>
+
+
+// This is a mock implementation of HttpFetcher which is useful for testing.
using std::min;
@@ -17,6 +21,7 @@
}
void MockHttpFetcher::BeginTransfer(const std::string& url) {
+ EXPECT_FALSE(never_use_);
if (fail_transfer_ || data_.empty()) {
// No data to send, just notify of completion..
SignalTransferComplete();