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/omaha_request_action.h b/omaha_request_action.h
index 948bcc7..8749546 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -150,6 +150,8 @@
// Returns true if this is an Event request, false if it's an UpdateCheck.
bool IsEvent() const { return event_.get() != NULL; }
+ void set_should_skip(bool should_skip) { should_skip_ = should_skip; }
+
private:
// If this is an update check request, initializes
// |ping_active_days_| and |ping_roll_call_days_| to values that may
@@ -181,6 +183,9 @@
int ping_active_days_;
int ping_roll_call_days_;
+ // If true, this action should be a noop.
+ bool should_skip_;
+
DISALLOW_COPY_AND_ASSIGN(OmahaRequestAction);
};