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_unittest.cc b/omaha_request_action_unittest.cc
index ece5a7d..409e947 100755
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -283,6 +283,32 @@
   EXPECT_FALSE(processor.IsRunning());
 }
 
+TEST(OmahaRequestActionTest, SkipTest) {
+  const string http_response("invalid xml>");
+
+  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
+
+  NiceMock<PrefsMock> prefs;
+  MockHttpFetcher* fetcher = new MockHttpFetcher(http_response.data(),
+                                                 http_response.size(),
+                                                 NULL);
+  fetcher->set_never_use(true);
+  OmahaRequestAction action(&prefs, kDefaultTestParams,
+                            new OmahaEvent(OmahaEvent::kTypeUpdateComplete),
+                            fetcher);  // Passes fetcher ownership
+  action.set_should_skip(true);
+  OmahaRequestActionTestProcessorDelegate delegate;
+  delegate.loop_ = loop;
+  ActionProcessor processor;
+  processor.set_delegate(&delegate);
+  processor.EnqueueAction(&action);
+
+  g_timeout_add(0, &StartProcessorInRunLoop, &processor);
+  g_main_loop_run(loop);
+  g_main_loop_unref(loop);
+  EXPECT_FALSE(processor.IsRunning());
+}
+
 TEST(OmahaRequestActionTest, InvalidXmlTest) {
   OmahaResponse response;
   ASSERT_FALSE(