diff --git a/SConstruct b/SConstruct
index 196df2a..df29f86 100644
--- a/SConstruct
+++ b/SConstruct
@@ -209,6 +209,7 @@
                    libcurl_http_fetcher.cc
                    marshal.glibmarshal.c
                    omaha_hash_calculator.cc
+                   omaha_request_action.cc
                    omaha_request_prep_action.cc
                    omaha_response_handler_action.cc
                    postinstall_runner_action.cc
@@ -219,7 +220,6 @@
                    tarjan.cc
                    topological_sort.cc
                    update_attempter.cc
-                   update_check_action.cc
                    update_metadata.pb.cc
                    utils.cc""")
 main = ['main.cc']
@@ -242,6 +242,7 @@
                             http_fetcher_unittest.cc
                             mock_http_fetcher.cc
                             omaha_hash_calculator_unittest.cc
+                            omaha_request_action_unittest.cc
                             omaha_request_prep_action_unittest.cc
                             omaha_response_handler_action_unittest.cc
                             postinstall_runner_action_unittest.cc
@@ -252,7 +253,6 @@
                             tarjan_unittest.cc
                             test_utils.cc
                             topological_sort_unittest.cc
-                            update_check_action_unittest.cc
                             utils_unittest.cc
                             zip_unittest.cc""")
 unittest_main = ['testrunner.cc']
diff --git a/integration_unittest.cc b/integration_unittest.cc
index 13102da..7b7a35b 100644
--- a/integration_unittest.cc
+++ b/integration_unittest.cc
@@ -11,12 +11,12 @@
 #include "update_engine/install_action.h"
 #include "update_engine/libcurl_http_fetcher.h"
 #include "update_engine/mock_http_fetcher.h"
+#include "update_engine/omaha_request_action.h"
 #include "update_engine/omaha_request_prep_action.h"
 #include "update_engine/omaha_response_handler_action.h"
 #include "update_engine/postinstall_runner_action.h"
 #include "update_engine/set_bootable_flag_action.h"
 #include "update_engine/test_utils.h"
-#include "update_engine/update_check_action.h"
 #include "update_engine/utils.h"
 
 // The tests here integrate many Action objects together. This test that
@@ -105,7 +105,7 @@
 
   // Actions:
   OmahaRequestPrepAction request_prep_action(false);
-  UpdateCheckAction update_check_action(new LibcurlHttpFetcher);
+  OmahaRequestAction update_check_action(new LibcurlHttpFetcher);
   OmahaResponseHandlerAction response_handler_action;
   DownloadAction download_action(new LibcurlHttpFetcher);
   InstallAction install_action;
diff --git a/update_check_action.cc b/omaha_request_action.cc
similarity index 83%
rename from update_check_action.cc
rename to omaha_request_action.cc
index fa8d697..3c203e2 100644
--- a/update_check_action.cc
+++ b/omaha_request_action.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "update_engine/update_check_action.h"
+#include "update_engine/omaha_request_action.h"
 #include <inttypes.h>
 #include <sstream>
 
@@ -18,11 +18,11 @@
 
 namespace chromeos_update_engine {
 
-const char* const UpdateCheckParams::kAppId(
+const char* const OmahaRequestParams::kAppId(
     "{87efface-864d-49a5-9bb3-4b050a7c227a}");
-const char* const UpdateCheckParams::kOsPlatform("Chrome OS");
-const char* const UpdateCheckParams::kOsVersion("Indy");
-const char* const UpdateCheckParams::kUpdateUrl(
+const char* const OmahaRequestParams::kOsPlatform("Chrome OS");
+const char* const OmahaRequestParams::kOsVersion("Indy");
+const char* const OmahaRequestParams::kUpdateUrl(
     "https://tools.google.com/service/update2");
 
 namespace {
@@ -59,14 +59,14 @@
   }
 };
 
-// Returns a properly formatted omaha request for an update check
-string FormatRequest(const UpdateCheckParams& params) {
+// Returns a properly formatted omaha request for a request to Omaha.
+string FormatRequest(const OmahaRequestParams& params) {
   return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-      "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" "
-      "version=\"" + XmlEncode(kGupdateVersion) + "\" "
-      "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" "
-      "protocol=\"2.0\" "
-      "machineid=\"") + XmlEncode(params.machine_id) + "\" ismachine=\"1\" "
+                "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" "
+                "version=\"" + XmlEncode(kGupdateVersion) + "\" "
+                "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" "
+                "protocol=\"2.0\" "
+                "machineid=\"") + XmlEncode(params.machine_id) + "\" ismachine=\"1\" "
       "userid=\"" + XmlEncode(params.user_id) + "\">\n"
       "    <o:os version=\"" + XmlEncode(params.os_version) + "\" platform=\"" +
       XmlEncode(params.os_platform) + "\" sp=\"" +
@@ -86,25 +86,25 @@
 // Encodes XML entities in a given string with libxml2. input must be
 // UTF-8 formatted. Output will be UTF-8 formatted.
 string XmlEncode(const string& input) {
-//  // TODO(adlr): if allocating a new xmlDoc each time is taking up too much
-//  // cpu, considering creating one and caching it.
-//  scoped_ptr_malloc<xmlDoc, ScopedPtrXmlDocFree> xml_doc(
-//      xmlNewDoc(ConstXMLStr("1.0")));
-//  if (!xml_doc.get()) {
-//    LOG(ERROR) << "Unable to create xmlDoc";
-//    return "";
-//  }
+  //  // TODO(adlr): if allocating a new xmlDoc each time is taking up too much
+  //  // cpu, considering creating one and caching it.
+  //  scoped_ptr_malloc<xmlDoc, ScopedPtrXmlDocFree> xml_doc(
+  //      xmlNewDoc(ConstXMLStr("1.0")));
+  //  if (!xml_doc.get()) {
+  //    LOG(ERROR) << "Unable to create xmlDoc";
+  //    return "";
+  //  }
   scoped_ptr_malloc<xmlChar, ScopedPtrXmlFree> str(
       xmlEncodeEntitiesReentrant(NULL, ConstXMLStr(input.c_str())));
   return string(reinterpret_cast<const char *>(str.get()));
 }
 
-UpdateCheckAction::UpdateCheckAction(HttpFetcher* http_fetcher)
+OmahaRequestAction::OmahaRequestAction(HttpFetcher* http_fetcher)
     : http_fetcher_(http_fetcher) {}
 
-UpdateCheckAction::~UpdateCheckAction() {}
+OmahaRequestAction::~OmahaRequestAction() {}
 
-void UpdateCheckAction::PerformAction() {
+void OmahaRequestAction::PerformAction() {
   CHECK(HasInputObject());
   params_ = GetInputObject();
   http_fetcher_->set_delegate(this);
@@ -115,15 +115,15 @@
   http_fetcher_->BeginTransfer(params_.update_url);
 }
 
-void UpdateCheckAction::TerminateProcessing() {
+void OmahaRequestAction::TerminateProcessing() {
   http_fetcher_->TerminateTransfer();
 }
 
 // We just store the response in the buffer. Once we've received all bytes,
 // we'll look in the buffer and decide what to do.
-void UpdateCheckAction::ReceivedBytes(HttpFetcher *fetcher,
-                                   const char* bytes,
-                                   int length) {
+void OmahaRequestAction::ReceivedBytes(HttpFetcher *fetcher,
+                                       const char* bytes,
+                                       int length) {
   response_buffer_.reserve(response_buffer_.size() + length);
   response_buffer_.insert(response_buffer_.end(), bytes, bytes + length);
 }
@@ -192,8 +192,8 @@
 // If the transfer was successful, this uses libxml2 to parse the response
 // and fill in the appropriate fields of the output object. Also, notifies
 // the processor that we're done.
-void UpdateCheckAction::TransferComplete(HttpFetcher *fetcher,
-                                         bool successful) {
+void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
+                                          bool successful) {
   ScopedActionCompleter completer(processor_, this);
   LOG(INFO) << "Update check response: " << string(response_buffer_.begin(),
                                                    response_buffer_.end());
@@ -240,7 +240,7 @@
   }
 
   const string status(XmlGetProperty(updatecheck_node, "status"));
-  UpdateCheckResponse output_object;
+  OmahaResponse output_object;
   if (status == "noupdate") {
     LOG(INFO) << "No update.";
     output_object.update_exists = false;
diff --git a/update_check_action.h b/omaha_request_action.h
similarity index 62%
rename from update_check_action.h
rename to omaha_request_action.h
index 4e759bd..f8dddc8 100644
--- a/update_check_action.h
+++ b/omaha_request_action.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -17,8 +17,8 @@
 #include "update_engine/action.h"
 #include "update_engine/http_fetcher.h"
 
-// The Update Check action makes an update check request to Omaha and
-// can output the response on the output ActionPipe.
+// The Omaha Request action makes a request to Omaha and can output
+// the response on the output ActionPipe.
 
 namespace chromeos_update_engine {
 
@@ -26,22 +26,22 @@
 // UTF-8 formatted. Output will be UTF-8 formatted.
 std::string XmlEncode(const std::string& input);
 
-// This struct encapsulates the data Omaha gets for the update check.
+// This struct encapsulates the data Omaha gets for the request.
 // These strings in this struct should not be XML escaped.
-struct UpdateCheckParams {
-  UpdateCheckParams()
+struct OmahaRequestParams {
+  OmahaRequestParams()
       : os_platform(kOsPlatform), os_version(kOsVersion), app_id(kAppId) {}
-  UpdateCheckParams(const std::string& in_machine_id,
-                    const std::string& in_user_id,
-                    const std::string& in_os_platform,
-                    const std::string& in_os_version,
-                    const std::string& in_os_sp,
-                    const std::string& in_os_board,
-                    const std::string& in_app_id,
-                    const std::string& in_app_version,
-                    const std::string& in_app_lang,
-                    const std::string& in_app_track,
-                    const std::string& in_update_url)
+  OmahaRequestParams(const std::string& in_machine_id,
+                     const std::string& in_user_id,
+                     const std::string& in_os_platform,
+                     const std::string& in_os_version,
+                     const std::string& in_os_sp,
+                     const std::string& in_os_board,
+                     const std::string& in_app_id,
+                     const std::string& in_app_version,
+                     const std::string& in_app_lang,
+                     const std::string& in_app_track,
+                     const std::string& in_update_url)
       : machine_id(in_machine_id),
         user_id(in_user_id),
         os_platform(in_os_platform),
@@ -64,7 +64,7 @@
   std::string app_version;
   std::string app_lang;
   std::string app_track;
-  
+
   std::string update_url;
 
   // Suggested defaults
@@ -74,10 +74,10 @@
   static const char* const kUpdateUrl;
 };
 
-// This struct encapsulates the data Omaha returns for the update check.
+// This struct encapsulates the data Omaha's response for the request.
 // These strings in this struct are not XML escaped.
-struct UpdateCheckResponse {
-  UpdateCheckResponse()
+struct OmahaResponse {
+  OmahaResponse()
       : update_exists(false), size(0), needs_admin(false), prompt(false) {}
   // True iff there is an update to be downloaded.
   bool update_exists;
@@ -93,36 +93,36 @@
 };
 COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit);
 
-class UpdateCheckAction;
+class OmahaRequestAction;
 class NoneType;
 
 template<>
-class ActionTraits<UpdateCheckAction> {
+class ActionTraits<OmahaRequestAction> {
  public:
   // Takes parameters on the input pipe
-  typedef UpdateCheckParams InputObjectType;
+  typedef OmahaRequestParams InputObjectType;
   // On success, puts the output path on output
-  typedef UpdateCheckResponse OutputObjectType;
+  typedef OmahaResponse OutputObjectType;
 };
 
-class UpdateCheckAction : public Action<UpdateCheckAction>,
-                          public HttpFetcherDelegate {
+class OmahaRequestAction : public Action<OmahaRequestAction>,
+                           public HttpFetcherDelegate {
  public:
   // The ctor takes in all the parameters that will be used for
   // making the request to Omaha. For some of them we have constants
   // that should be used.
   // Takes ownership of the passed in HttpFetcher. Useful for testing.
   // A good calling pattern is:
-  // UpdateCheckAction(..., new WhateverHttpFetcher);
-  UpdateCheckAction(HttpFetcher* http_fetcher);
-  virtual ~UpdateCheckAction();
-  typedef ActionTraits<UpdateCheckAction>::InputObjectType InputObjectType;
-  typedef ActionTraits<UpdateCheckAction>::OutputObjectType OutputObjectType;
+  // OmahaRequestAction(..., new WhateverHttpFetcher);
+  OmahaRequestAction(HttpFetcher* http_fetcher);
+  virtual ~OmahaRequestAction();
+  typedef ActionTraits<OmahaRequestAction>::InputObjectType InputObjectType;
+  typedef ActionTraits<OmahaRequestAction>::OutputObjectType OutputObjectType;
   void PerformAction();
   void TerminateProcessing();
 
   // Debugging/logging
-  static std::string StaticType() { return "UpdateCheckAction"; }
+  static std::string StaticType() { return "OmahaRequestAction"; }
   std::string Type() const { return StaticType(); }
 
   // Delegate methods (see http_fetcher.h)
@@ -132,7 +132,7 @@
 
  private:
   // These are data that are passed in the request to the Omaha server
-  UpdateCheckParams params_;
+  OmahaRequestParams params_;
 
   // pointer to the HttpFetcher that does the http work
   scoped_ptr<HttpFetcher> http_fetcher_;
@@ -140,9 +140,9 @@
   // Stores the response from the omaha server
   std::vector<char> response_buffer_;
 
-  DISALLOW_COPY_AND_ASSIGN(UpdateCheckAction);
+  DISALLOW_COPY_AND_ASSIGN(OmahaRequestAction);
 };
 
 }  // namespace chromeos_update_engine
 
-#endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__
+#endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
new file mode 100644
index 0000000..778f408
--- /dev/null
+++ b/omaha_request_action_unittest.cc
@@ -0,0 +1,538 @@
+// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <string>
+#include <vector>
+#include <glib.h>
+#include <gtest/gtest.h>
+#include "update_engine/action_pipe.h"
+#include "update_engine/mock_http_fetcher.h"
+#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/omaha_request_action.h"
+#include "update_engine/test_utils.h"
+
+using std::string;
+using std::vector;
+
+namespace chromeos_update_engine {
+
+class OmahaRequestActionTest : public ::testing::Test { };
+
+namespace {
+string GetNoUpdateResponse(const string& app_id) {
+  return string(
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
+      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
+      "appid=\"") + app_id + "\" status=\"ok\"><ping "
+      "status=\"ok\"/><updatecheck status=\"noupdate\"/></app></gupdate>";
+}
+
+string GetUpdateResponse(const string& app_id,
+                         const string& display_version,
+                         const string& more_info_url,
+                         const string& prompt,
+                         const string& codebase,
+                         const string& hash,
+                         const string& needsadmin,
+                         const string& size) {
+  return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
+                "xmlns=\"http://www.google.com/update2/response\" "
+                "protocol=\"2.0\"><app "
+                "appid=\"") + app_id + "\" status=\"ok\"><ping "
+      "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" "
+      "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" "
+      "codebase=\"" + codebase + "\" "
+      "hash=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" "
+      "size=\"" + size + "\" status=\"ok\"/></app></gupdate>";
+}
+
+class OmahaRequestActionTestProcessorDelegate : public ActionProcessorDelegate {
+ public:
+  OmahaRequestActionTestProcessorDelegate()
+      : loop_(NULL),
+        expected_success_(true) {}
+  virtual ~OmahaRequestActionTestProcessorDelegate() {
+  }
+  virtual void ProcessingDone(const ActionProcessor* processor, bool success) {
+    ASSERT_TRUE(loop_);
+    g_main_loop_quit(loop_);
+  }
+
+  virtual void ActionCompleted(ActionProcessor* processor,
+                               AbstractAction* action,
+                               bool success) {
+    // make sure actions always succeed
+    if (action->Type() == OmahaRequestAction::StaticType())
+      EXPECT_EQ(expected_success_, success);
+    else
+      EXPECT_TRUE(success);
+  }
+  GMainLoop *loop_;
+  bool expected_success_;
+};
+
+gboolean StartProcessorInRunLoop(gpointer data) {
+  ActionProcessor *processor = reinterpret_cast<ActionProcessor*>(data);
+  processor->StartProcessing();
+  return FALSE;
+}
+
+}  // namespace {}
+
+class OutputObjectCollectorAction;
+
+template<>
+class ActionTraits<OutputObjectCollectorAction> {
+ public:
+  // Does not take an object for input
+  typedef OmahaResponse InputObjectType;
+  // On success, puts the output path on output
+  typedef NoneType OutputObjectType;
+};
+
+class OutputObjectCollectorAction : public Action<OutputObjectCollectorAction> {
+ public:
+  OutputObjectCollectorAction() : has_input_object_(false) {}
+  void PerformAction() {
+    // copy input object
+    has_input_object_ = HasInputObject();
+    if (has_input_object_)
+      omaha_response_ = GetInputObject();
+    processor_->ActionComplete(this, true);
+  }
+  // Should never be called
+  void TerminateProcessing() {
+    CHECK(false);
+  }
+  // Debugging/logging
+  static std::string StaticType() {
+    return "OutputObjectCollectorAction";
+  }
+  std::string Type() const { return StaticType(); }
+  bool has_input_object_;
+  OmahaResponse omaha_response_;
+};
+
+// returns true iff an output response was obtained from the
+// OmahaRequestAction. out_response may be NULL.
+// out_post_data may be null; if non-null, the post-data received by the
+// mock HttpFetcher is returned.
+bool TestOmahaRequestAction(const OmahaRequestParams& params,
+                            const string& http_response,
+                            bool expected_success,
+                            OmahaResponse* out_response,
+                            vector<char> *out_post_data) {
+  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
+  MockHttpFetcher *fetcher = new MockHttpFetcher(http_response.data(),
+                                                 http_response.size());
+  ObjectFeederAction<OmahaRequestParams> feeder_action;
+  OmahaRequestAction action(fetcher);  // takes ownership of fetcher
+  OmahaRequestActionTestProcessorDelegate delegate;
+  delegate.loop_ = loop;
+  delegate.expected_success_ = expected_success;
+  ActionProcessor processor;
+  feeder_action.set_obj(params);
+  processor.set_delegate(&delegate);
+  processor.EnqueueAction(&feeder_action);
+  processor.EnqueueAction(&action);
+
+  OutputObjectCollectorAction collector_action;
+
+  BondActions(&feeder_action, &action);
+  BondActions(&action, &collector_action);
+  processor.EnqueueAction(&collector_action);
+
+  g_timeout_add(0, &StartProcessorInRunLoop, &processor);
+  g_main_loop_run(loop);
+  g_main_loop_unref(loop);
+  if (collector_action.has_input_object_ && out_response)
+    *out_response = collector_action.omaha_response_;
+  if (out_post_data)
+    *out_post_data = fetcher->post_data();
+  return collector_action.has_input_object_;
+}
+
+TEST(OmahaRequestActionTest, NoUpdateTest) {
+  OmahaRequestParams params("",  // machine_id
+                            "",  // user_id
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "",  // os_sp
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest",
+                            "");  // url
+  OmahaResponse response;
+  ASSERT_TRUE(
+      TestOmahaRequestAction(params,
+                             GetNoUpdateResponse(OmahaRequestParams::kAppId),
+                             true,
+                             &response,
+                             NULL));
+  EXPECT_FALSE(response.update_exists);
+}
+
+TEST(OmahaRequestActionTest, ValidUpdateTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "arm-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "");  // url
+  OmahaResponse response;
+  ASSERT_TRUE(
+      TestOmahaRequestAction(params,
+                             GetUpdateResponse(OmahaRequestParams::kAppId,
+                                               "1.2.3.4",  // version
+                                               "http://more/info",
+                                               "true",  // prompt
+                                               "http://code/base",  // dl url
+                                               "HASH1234=",  // checksum
+                                               "false",  // needs admin
+                                               "123"),  // size
+                             true,
+                             &response,
+                             NULL));
+  EXPECT_TRUE(response.update_exists);
+  EXPECT_EQ("1.2.3.4", response.display_version);
+  EXPECT_EQ("http://code/base", response.codebase);
+  EXPECT_EQ("http://more/info", response.more_info_url);
+  EXPECT_EQ("HASH1234=", response.hash);
+  EXPECT_EQ(123, response.size);
+  EXPECT_FALSE(response.needs_admin);
+  EXPECT_TRUE(response.prompt);
+}
+
+TEST(OmahaRequestActionTest, NoOutputPipeTest) {
+  OmahaRequestParams params("",  // machine_id
+                            "",  // usr_id
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "",  // os_sp
+                            "",  // os_board
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest",
+                            "");  // url
+  const string http_response(GetNoUpdateResponse(OmahaRequestParams::kAppId));
+
+  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
+
+  ObjectFeederAction<OmahaRequestParams> feeder_action;
+  feeder_action.set_obj(params);
+  OmahaRequestAction action(new MockHttpFetcher(http_response.data(),
+                                                http_response.size()));
+  OmahaRequestActionTestProcessorDelegate delegate;
+  delegate.loop_ = loop;
+  ActionProcessor processor;
+  processor.set_delegate(&delegate);
+  processor.EnqueueAction(&feeder_action);
+  processor.EnqueueAction(&action);
+  BondActions(&feeder_action, &action);
+
+  g_timeout_add(0, &StartProcessorInRunLoop, &processor);
+  g_main_loop_run(loop);
+  g_main_loop_unref(loop);
+  EXPECT_FALSE(processor.IsRunning());
+}
+
+TEST(OmahaRequestActionTest, InvalidXmlTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_FALSE(
+      TestOmahaRequestAction(params,
+                             "invalid xml>",
+                             false,
+                             &response,
+                             NULL));
+  EXPECT_FALSE(response.update_exists);
+}
+
+TEST(OmahaRequestActionTest, MissingStatusTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_FALSE(TestOmahaRequestAction(
+      params,
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
+      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
+      "appid=\"foo\" status=\"ok\"><ping "
+      "status=\"ok\"/><updatecheck/></app></gupdate>",
+      false,
+      &response,
+      NULL));
+  EXPECT_FALSE(response.update_exists);
+}
+
+TEST(OmahaRequestActionTest, InvalidStatusTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_FALSE(TestOmahaRequestAction(
+      params,
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
+      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
+      "appid=\"foo\" status=\"ok\"><ping "
+      "status=\"ok\"/><updatecheck status=\"foo\"/></app></gupdate>",
+      false,
+      &response,
+      NULL));
+  EXPECT_FALSE(response.update_exists);
+}
+
+TEST(OmahaRequestActionTest, MissingNodesetTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_FALSE(TestOmahaRequestAction(
+      params,
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
+      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
+      "appid=\"foo\" status=\"ok\"><ping "
+      "status=\"ok\"/></app></gupdate>",
+      false,
+      &response,
+      NULL));
+  EXPECT_FALSE(response.update_exists);
+}
+
+TEST(OmahaRequestActionTest, MissingFieldTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_TRUE(TestOmahaRequestAction(params,
+                                     string("<?xml version=\"1.0\" "
+                                            "encoding=\"UTF-8\"?><gupdate "
+                                            "xmlns=\"http://www.google.com/"
+                                            "update2/response\" "
+                                            "protocol=\"2.0\"><app appid=\"") +
+                                     OmahaRequestParams::kAppId
+                                     + "\" status=\"ok\"><ping "
+                                     "status=\"ok\"/><updatecheck "
+                                     "DisplayVersion=\"1.2.3.4\" "
+                                     "Prompt=\"false\" "
+                                     "codebase=\"http://code/base\" "
+                                     "hash=\"HASH1234=\" needsadmin=\"true\" "
+                                     "size=\"123\" "
+                                     "status=\"ok\"/></app></gupdate>",
+                                     true,
+                                     &response,
+                                     NULL));
+  EXPECT_TRUE(response.update_exists);
+  EXPECT_EQ("1.2.3.4", response.display_version);
+  EXPECT_EQ("http://code/base", response.codebase);
+  EXPECT_EQ("", response.more_info_url);
+  EXPECT_EQ("HASH1234=", response.hash);
+  EXPECT_EQ(123, response.size);
+  EXPECT_TRUE(response.needs_admin);
+  EXPECT_FALSE(response.prompt);
+}
+
+namespace {
+class TerminateEarlyTestProcessorDelegate : public ActionProcessorDelegate {
+ public:
+  void ProcessingStopped(const ActionProcessor* processor) {
+    ASSERT_TRUE(loop_);
+    g_main_loop_quit(loop_);
+  }
+  GMainLoop *loop_;
+};
+
+gboolean TerminateTransferTestStarter(gpointer data) {
+  ActionProcessor *processor = reinterpret_cast<ActionProcessor*>(data);
+  processor->StartProcessing();
+  CHECK(processor->IsRunning());
+  processor->StopProcessing();
+  return FALSE;
+}
+}  // namespace {}
+
+TEST(OmahaRequestActionTest, TerminateTransferTest) {
+  OmahaRequestParams params("",  // machine_id
+                            "",  // usr_id
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "",  // os_sp
+                            "",  // os_board
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest",
+                            "http://url");
+  string http_response("doesn't matter");
+  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
+
+  ObjectFeederAction<OmahaRequestParams> feeder_action;
+  feeder_action.set_obj(params);
+  OmahaRequestAction action(new MockHttpFetcher(http_response.data(),
+                                                http_response.size()));
+  TerminateEarlyTestProcessorDelegate delegate;
+  delegate.loop_ = loop;
+  ActionProcessor processor;
+  processor.set_delegate(&delegate);
+  processor.EnqueueAction(&feeder_action);
+  processor.EnqueueAction(&action);
+  BondActions(&feeder_action, &action);
+
+  g_timeout_add(0, &TerminateTransferTestStarter, &processor);
+  g_main_loop_run(loop);
+  g_main_loop_unref(loop);
+}
+
+TEST(OmahaRequestActionTest, XmlEncodeTest) {
+  EXPECT_EQ("ab", XmlEncode("ab"));
+  EXPECT_EQ("a&lt;b", XmlEncode("a<b"));
+  EXPECT_EQ("foo-&#x3A9;", XmlEncode("foo-\xce\xa9"));
+  EXPECT_EQ("&lt;&amp;&gt;", XmlEncode("<&>"));
+  EXPECT_EQ("&amp;lt;&amp;amp;&amp;gt;", XmlEncode("&lt;&amp;&gt;"));
+
+  vector<char> post_data;
+
+  // Make sure XML Encode is being called on the params
+  OmahaRequestParams params("testthemachine<id",
+                            "testtheuser_id&lt;",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "testtheservice_pack>",
+                            "x86 generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_FALSE(
+      TestOmahaRequestAction(params,
+                             "invalid xml>",
+                             false,
+                             &response,
+                             &post_data));
+  // convert post_data to string
+  string post_str(&post_data[0], post_data.size());
+  EXPECT_NE(post_str.find("testthemachine&lt;id"), string::npos);
+  EXPECT_EQ(post_str.find("testthemachine<id"), string::npos);
+  EXPECT_NE(post_str.find("testtheuser_id&amp;lt;"), string::npos);
+  EXPECT_EQ(post_str.find("testtheuser_id&lt;"), string::npos);
+  EXPECT_NE(post_str.find("testtheservice_pack&gt;"), string::npos);
+  EXPECT_EQ(post_str.find("testtheservice_pack>"), string::npos);
+  EXPECT_NE(post_str.find("x86 generic"), string::npos);
+}
+
+TEST(OmahaRequestActionTest, XmlDecodeTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "x86-generic",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_TRUE(
+      TestOmahaRequestAction(params,
+                             GetUpdateResponse(OmahaRequestParams::kAppId,
+                                               "1.2.3.4",  // version
+                                               "testthe&lt;url",  // more info
+                                               "true",  // prompt
+                                               "testthe&amp;code",  // dl url
+                                               "HASH1234=", // checksum
+                                               "false",  // needs admin
+                                               "123"),  // size
+                             true,
+                             &response,
+                             NULL));
+
+  EXPECT_EQ(response.more_info_url, "testthe<url");
+  EXPECT_EQ(response.codebase, "testthe&code");
+}
+
+TEST(OmahaRequestActionTest, ParseIntTest) {
+  OmahaRequestParams params("machine_id",
+                            "user_id",
+                            OmahaRequestParams::kOsPlatform,
+                            OmahaRequestParams::kOsVersion,
+                            "service_pack",
+                            "the_board",
+                            OmahaRequestParams::kAppId,
+                            "0.1.0.0",
+                            "en-US",
+                            "unittest_track",
+                            "http://url");
+  OmahaResponse response;
+  ASSERT_TRUE(
+      TestOmahaRequestAction(params,
+                             GetUpdateResponse(OmahaRequestParams::kAppId,
+                                               "1.2.3.4",  // version
+                                               "theurl",  // more info
+                                               "true",  // prompt
+                                               "thecodebase",  // dl url
+                                               "HASH1234=", // checksum
+                                               "false",  // needs admin
+                                               // overflows int32:
+                                               "123123123123123"),  // size
+                             true,
+                             &response,
+                             NULL));
+
+  EXPECT_EQ(response.size, 123123123123123ll);
+}
+
+}  // namespace chromeos_update_engine
diff --git a/omaha_request_prep_action.cc b/omaha_request_prep_action.cc
index 7163119..365c463 100644
--- a/omaha_request_prep_action.cc
+++ b/omaha_request_prep_action.cc
@@ -35,16 +35,16 @@
   const string sp(version + "_" + GetMachineType());
   const string track(GetLsbValue("CHROMEOS_RELEASE_TRACK", ""));
   const string update_url(GetLsbValue("CHROMEOS_AUSERVER",
-                                      UpdateCheckParams::kUpdateUrl));
+                                      OmahaRequestParams::kUpdateUrl));
   const string board(GetLsbValue("CHROMEOS_RELEASE_BOARD", ""));
 
-  UpdateCheckParams out(machine_id,  // machine_id
+  OmahaRequestParams out(machine_id,  // machine_id
                         machine_id,  // user_id (use machine_id)
-                        UpdateCheckParams::kOsPlatform,
-                        UpdateCheckParams::kOsVersion,
+                        OmahaRequestParams::kOsPlatform,
+                        OmahaRequestParams::kOsVersion,
                         sp,  // e.g. 0.2.3.3_i686
                         board,  // e.g. x86-generic
-                        UpdateCheckParams::kAppId,
+                        OmahaRequestParams::kAppId,
                         version,  // app version (from lsb-release)
                         "en-US",  // lang
                         track,  // track
@@ -73,12 +73,12 @@
 bool OmahaRequestPrepAction::GetMachineId(std::string* out_id) const {
   // See if we have an existing Machine ID
   const string omaha_id_path = root_ + OmahaIdPath();
-  
+
   if (utils::ReadFileToString(omaha_id_path, out_id) &&
       out_id->size() == kGuidStringLength) {
     return true;
   }
-  
+
   // Create a new ID
   int rand_fd = open("/dev/urandom", O_RDONLY, 0);
   TEST_AND_RETURN_FALSE_ERRNO(rand_fd >= 0);
@@ -107,7 +107,7 @@
     string file_data;
     if (!utils::ReadFileToString(root_ + files[i], &file_data))
       continue;
-    
+
     map<string, string> data = simple_key_value_store::ParseString(file_data);
     if (utils::MapContainsKey(data, key))
       return data[key];
diff --git a/omaha_request_prep_action.h b/omaha_request_prep_action.h
index d6030f5..794cfb7 100644
--- a/omaha_request_prep_action.h
+++ b/omaha_request_prep_action.h
@@ -7,7 +7,7 @@
 
 #include <string>
 #include "update_engine/action.h"
-#include "update_engine/update_check_action.h"
+#include "update_engine/omaha_request_action.h"
 
 // This gathers local system information and prepares info used by the
 // update check action.
@@ -21,7 +21,7 @@
 class ActionTraits<OmahaRequestPrepAction> {
  public:
   typedef NoneType InputObjectType;
-  typedef UpdateCheckParams OutputObjectType;
+  typedef OmahaRequestParams OutputObjectType;
 };
 
 class OmahaRequestPrepAction : public Action<OmahaRequestPrepAction> {
diff --git a/omaha_request_prep_action_unittest.cc b/omaha_request_prep_action_unittest.cc
index 1397c4d..0813964 100644
--- a/omaha_request_prep_action_unittest.cc
+++ b/omaha_request_prep_action_unittest.cc
@@ -18,7 +18,7 @@
  public:
   // Return true iff the OmahaResponseHandlerAction succeeded.
   // if out is non-NULL, it's set w/ the response from the action.
-  bool DoTest(bool force_full_update, UpdateCheckParams* out);
+  bool DoTest(bool force_full_update, OmahaRequestParams* out);
   static const string kTestDir;
 };
 
@@ -43,14 +43,14 @@
 };
 
 bool OmahaRequestPrepActionTest::DoTest(bool force_full_update,
-                                        UpdateCheckParams* out) {
+                                        OmahaRequestParams* out) {
   ActionProcessor processor;
   OmahaRequestPrepActionProcessorDelegate delegate;
   processor.set_delegate(&delegate);
 
   OmahaRequestPrepAction request_prep_action(force_full_update);
   request_prep_action.set_root(string("./") + kTestDir);
-  ObjectCollectorAction<UpdateCheckParams> collector_action;
+  ObjectCollectorAction<OmahaRequestParams> collector_action;
   BondActions(&request_prep_action, &collector_action);
   processor.EnqueueAction(&request_prep_action);
   processor.EnqueueAction(&collector_action);
@@ -69,7 +69,7 @@
       ((c >= 'a') && (c <= 'f')) ||
       ((c >= 'A') && (c <= 'F'));
 }
-  
+
 // Returns true iff str is formatted as a GUID. Example GUID:
 // "{2251FFAD-DBAB-4E53-8B3A-18F98BB4EB80}"
 bool IsValidGuid(const string& str) {
@@ -115,7 +115,7 @@
         "CHROMEOS_RELEASE_FOO=bar\n"
         "CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
         "CHROMEOS_RELEASE_TRACK=footrack"));
-    UpdateCheckParams out;
+    OmahaRequestParams out;
     EXPECT_TRUE(DoTest(false, &out));
     EXPECT_TRUE(IsValidGuid(out.machine_id)) << "id: " << out.machine_id;
     // for now we're just using the machine id here
@@ -141,7 +141,7 @@
         "CHROMEOS_RELEASE_FOO=bar\n"
         "CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
         "CHROMEOS_RELEASE_TRXCK=footrack"));
-    UpdateCheckParams out;
+    OmahaRequestParams out;
     EXPECT_TRUE(DoTest(false, &out));
     EXPECT_TRUE(IsValidGuid(out.machine_id));
     // for now we're just using the machine id here
@@ -166,7 +166,7 @@
         "CHROMEOS_RELEASE_FOO=CHROMEOS_RELEASE_VERSION=1.2.3.4\n"
         "CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
         "CHROMEOS_RELEASE_TRXCK=footrack"));
-    UpdateCheckParams out;
+    OmahaRequestParams out;
     EXPECT_TRUE(DoTest(false, &out));
     EXPECT_TRUE(IsValidGuid(out.machine_id)) << out.machine_id;
     // for now we're just using the machine id here
@@ -190,7 +190,7 @@
       "CHROMEOS_RELEASE_FOO=CHROMEOS_RELEASE_VERSION=1.2.3.4\n"
       "CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
       "CHROMEOS_RELEASE_TRXCK=footrack"));
-  UpdateCheckParams out1;
+  OmahaRequestParams out1;
   EXPECT_TRUE(DoTest(false, &out1));
   string machine_id;
   EXPECT_TRUE(utils::ReadFileToString(
@@ -198,7 +198,7 @@
       utils::kStatefulPartition + "/etc/omaha_id",
       &machine_id));
   EXPECT_EQ(machine_id, out1.machine_id);
-  UpdateCheckParams out2;
+  OmahaRequestParams out2;
   EXPECT_TRUE(DoTest(false, &out2));
   EXPECT_EQ(machine_id, out2.machine_id);
   EXPECT_EQ(0, System(string("rm -rf ") + kTestDir));
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index 486f19b..319c825 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -20,7 +20,7 @@
 void OmahaResponseHandlerAction::PerformAction() {
   CHECK(HasInputObject());
   ScopedActionCompleter completer(processor_, this);
-  const UpdateCheckResponse& response = GetInputObject();
+  const OmahaResponse& response = GetInputObject();
   if (!response.update_exists) {
     got_no_update_response_ = true;
     LOG(INFO) << "There are no updates. Aborting.";
@@ -42,7 +42,7 @@
     SetOutputObject(install_plan_);
   LOG(INFO) << "Using this install plan:";
   install_plan_.Dump();
-  
+
   completer.set_success(true);
 }
 
diff --git a/omaha_response_handler_action.h b/omaha_response_handler_action.h
index e79e32b..b5feabd 100644
--- a/omaha_response_handler_action.h
+++ b/omaha_response_handler_action.h
@@ -8,7 +8,7 @@
 #include <string>
 #include "update_engine/action.h"
 #include "update_engine/install_plan.h"
-#include "update_engine/update_check_action.h"
+#include "update_engine/omaha_request_action.h"
 
 // This class reads in an Omaha response and converts what it sees into
 // an install plan which is passed out.
@@ -20,7 +20,7 @@
 template<>
 class ActionTraits<OmahaResponseHandlerAction> {
  public:
-  typedef UpdateCheckResponse InputObjectType;
+  typedef OmahaResponse InputObjectType;
   typedef InstallPlan OutputObjectType;
 };
 
@@ -41,7 +41,7 @@
   void set_boot_device(const std::string& boot_device) {
     boot_device_ = boot_device;
   }
-  
+
   bool GotNoUpdateResponse() const { return got_no_update_response_; }
   const InstallPlan& install_plan() const { return install_plan_; }
 
@@ -59,10 +59,10 @@
 
   // set to non-empty in unit tests
   std::string boot_device_;
-  
+
   // The install plan, if we have an update.
   InstallPlan install_plan_;
-  
+
   // True only if we got a response and the response said no updates
   bool got_no_update_response_;
 
diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc
index b396a9c..489d5e7 100644
--- a/omaha_response_handler_action_unittest.cc
+++ b/omaha_response_handler_action_unittest.cc
@@ -16,7 +16,7 @@
  public:
   // Return true iff the OmahaResponseHandlerAction succeeded.
   // If out is non-NULL, it's set w/ the response from the action.
-  bool DoTest(const UpdateCheckResponse& in,
+  bool DoTest(const OmahaResponse& in,
               const string& boot_dev,
               InstallPlan* out);
 };
@@ -51,14 +51,14 @@
     "-the_update_a.b.c.d_DELTA_.tgz";
 }  // namespace {}
 
-bool OmahaResponseHandlerActionTest::DoTest(const UpdateCheckResponse& in,
+bool OmahaResponseHandlerActionTest::DoTest(const OmahaResponse& in,
                                             const string& boot_dev,
                                             InstallPlan* out) {
   ActionProcessor processor;
   OmahaResponseHandlerActionProcessorDelegate delegate;
   processor.set_delegate(&delegate);
 
-  ObjectFeederAction<UpdateCheckResponse> feeder_action;
+  ObjectFeederAction<OmahaResponse> feeder_action;
   feeder_action.set_obj(in);
   OmahaResponseHandlerAction response_handler_action;
   response_handler_action.set_boot_device(boot_dev);
@@ -79,7 +79,7 @@
 
 TEST_F(OmahaResponseHandlerActionTest, SimpleTest) {
   {
-    UpdateCheckResponse in;
+    OmahaResponse in;
     in.update_exists = true;
     in.display_version = "a.b.c.d";
     in.codebase = "http://foo/the_update_a.b.c.d.tgz";
@@ -96,7 +96,7 @@
     EXPECT_EQ("/dev/sda5", install_plan.install_path);
   }
   {
-    UpdateCheckResponse in;
+    OmahaResponse in;
     in.update_exists = true;
     in.display_version = "a.b.c.d";
     in.codebase = "http://foo/the_update_a.b.c.d.tgz";
@@ -113,7 +113,7 @@
     EXPECT_EQ("/dev/sda3", install_plan.install_path);
   }
   {
-    UpdateCheckResponse in;
+    OmahaResponse in;
     in.update_exists = true;
     in.display_version = "a.b.c.d";
     in.codebase = kLongName;
@@ -132,7 +132,7 @@
 }
 
 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) {
-  UpdateCheckResponse in;
+  OmahaResponse in;
   in.update_exists = false;
   InstallPlan install_plan;
   EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan));
diff --git a/update_attempter.cc b/update_attempter.cc
index ec0e1f5..a8a3207 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -18,11 +18,11 @@
 #include "update_engine/download_action.h"
 #include "update_engine/filesystem_copier_action.h"
 #include "update_engine/libcurl_http_fetcher.h"
+#include "update_engine/omaha_request_action.h"
 #include "update_engine/omaha_request_prep_action.h"
 #include "update_engine/omaha_response_handler_action.h"
 #include "update_engine/postinstall_runner_action.h"
 #include "update_engine/set_bootable_flag_action.h"
-#include "update_engine/update_check_action.h"
 
 using std::tr1::shared_ptr;
 using std::string;
@@ -102,8 +102,8 @@
   // Actions:
   shared_ptr<OmahaRequestPrepAction> request_prep_action(
       new OmahaRequestPrepAction(force_full_update));
-  shared_ptr<UpdateCheckAction> update_check_action(
-      new UpdateCheckAction(new LibcurlHttpFetcher));
+  shared_ptr<OmahaRequestAction> update_check_action(
+      new OmahaRequestAction(new LibcurlHttpFetcher));
   shared_ptr<OmahaResponseHandlerAction> response_handler_action(
       new OmahaResponseHandlerAction);
   shared_ptr<FilesystemCopierAction> filesystem_copier_action(
@@ -118,7 +118,7 @@
       new SetBootableFlagAction);
   shared_ptr<PostinstallRunnerAction> postinstall_runner_action_postcommit(
       new PostinstallRunnerAction(false));
-  
+
   download_action->set_delegate(this);
   response_handler_action_ = response_handler_action;
 
@@ -134,7 +134,7 @@
   actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action));
   actions_.push_back(shared_ptr<AbstractAction>(
       postinstall_runner_action_postcommit));
-  
+
   // Enqueue the actions
   for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin();
        it != actions_.end(); ++it) {
@@ -209,7 +209,7 @@
   // Find out which action completed.
   if (type == OmahaResponseHandlerAction::StaticType()) {
     SetStatusAndNotify(UPDATE_STATUS_DOWNLOADING);
-    OmahaResponseHandlerAction* omaha_response_handler_action = 
+    OmahaResponseHandlerAction* omaha_response_handler_action =
         dynamic_cast<OmahaResponseHandlerAction*>(action);
     CHECK(omaha_response_handler_action);
     const InstallPlan& plan = omaha_response_handler_action->install_plan();
diff --git a/update_check_action_unittest.cc b/update_check_action_unittest.cc
deleted file mode 100644
index e2e7410..0000000
--- a/update_check_action_unittest.cc
+++ /dev/null
@@ -1,538 +0,0 @@
-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <string>
-#include <vector>
-#include <glib.h>
-#include <gtest/gtest.h>
-#include "update_engine/action_pipe.h"
-#include "update_engine/update_check_action.h"
-#include "update_engine/mock_http_fetcher.h"
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/test_utils.h"
-
-using std::string;
-using std::vector;
-
-namespace chromeos_update_engine {
-
-class UpdateCheckActionTest : public ::testing::Test { };
-
-namespace {
-string GetNoUpdateResponse(const string& app_id) {
-  return string(
-      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
-      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
-      "appid=\"") + app_id + "\" status=\"ok\"><ping "
-      "status=\"ok\"/><updatecheck status=\"noupdate\"/></app></gupdate>";
-}
-
-string GetUpdateResponse(const string& app_id,
-                         const string& display_version,
-                         const string& more_info_url,
-                         const string& prompt,
-                         const string& codebase,
-                         const string& hash,
-                         const string& needsadmin,
-                         const string& size) {
-  return string("<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
-                "xmlns=\"http://www.google.com/update2/response\" "
-                "protocol=\"2.0\"><app "
-                "appid=\"") + app_id + "\" status=\"ok\"><ping "
-      "status=\"ok\"/><updatecheck DisplayVersion=\"" + display_version + "\" "
-      "MoreInfo=\"" + more_info_url + "\" Prompt=\"" + prompt + "\" "
-      "codebase=\"" + codebase + "\" "
-      "hash=\"" + hash + "\" needsadmin=\"" + needsadmin + "\" "
-      "size=\"" + size + "\" status=\"ok\"/></app></gupdate>";
-}
-
-class UpdateCheckActionTestProcessorDelegate : public ActionProcessorDelegate {
- public:
-  UpdateCheckActionTestProcessorDelegate()
-      : loop_(NULL),
-        expected_success_(true) {}
-  virtual ~UpdateCheckActionTestProcessorDelegate() {
-  }
-  virtual void ProcessingDone(const ActionProcessor* processor, bool success) {
-    ASSERT_TRUE(loop_);
-    g_main_loop_quit(loop_);
-  }
-
-  virtual void ActionCompleted(ActionProcessor* processor,
-                               AbstractAction* action,
-                               bool success) {
-    // make sure actions always succeed
-    if (action->Type() == UpdateCheckAction::StaticType())
-      EXPECT_EQ(expected_success_, success);
-    else
-      EXPECT_TRUE(success);
-  }
-  GMainLoop *loop_;
-  bool expected_success_;
-};
-
-gboolean StartProcessorInRunLoop(gpointer data) {
-  ActionProcessor *processor = reinterpret_cast<ActionProcessor*>(data);
-  processor->StartProcessing();
-  return FALSE;
-}
-
-}  // namespace {}
-
-class OutputObjectCollectorAction;
-
-template<>
-class ActionTraits<OutputObjectCollectorAction> {
- public:
-  // Does not take an object for input
-  typedef UpdateCheckResponse InputObjectType;
-  // On success, puts the output path on output
-  typedef NoneType OutputObjectType;
-};
-
-class OutputObjectCollectorAction : public Action<OutputObjectCollectorAction> {
- public:
-  OutputObjectCollectorAction() : has_input_object_(false) {}
-  void PerformAction() {
-    // copy input object
-    has_input_object_ = HasInputObject();
-    if (has_input_object_)
-      update_check_response_ = GetInputObject();
-    processor_->ActionComplete(this, true);
-  }
-  // Should never be called
-  void TerminateProcessing() {
-    CHECK(false);
-  }
-  // Debugging/logging
-  static std::string StaticType() {
-    return "OutputObjectCollectorAction";
-  }
-  std::string Type() const { return StaticType(); }
-  bool has_input_object_;
-  UpdateCheckResponse update_check_response_;
-};
-
-// returns true iff an output response was obtained from the
-// UpdateCheckAction. out_response may be NULL.
-// out_post_data may be null; if non-null, the post-data received by the
-// mock HttpFetcher is returned.
-bool TestUpdateCheckAction(const UpdateCheckParams& params,
-                           const string& http_response,
-                           bool expected_success,
-                           UpdateCheckResponse* out_response,
-                           vector<char> *out_post_data) {
-  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
-  MockHttpFetcher *fetcher = new MockHttpFetcher(http_response.data(),
-                                                 http_response.size());
-  ObjectFeederAction<UpdateCheckParams> feeder_action;
-  UpdateCheckAction action(fetcher);  // takes ownership of fetcher
-  UpdateCheckActionTestProcessorDelegate delegate;
-  delegate.loop_ = loop;
-  delegate.expected_success_ = expected_success;
-  ActionProcessor processor;
-  feeder_action.set_obj(params);
-  processor.set_delegate(&delegate);
-  processor.EnqueueAction(&feeder_action);
-  processor.EnqueueAction(&action);
-
-  OutputObjectCollectorAction collector_action;
-
-  BondActions(&feeder_action, &action);
-  BondActions(&action, &collector_action);
-  processor.EnqueueAction(&collector_action);
-
-  g_timeout_add(0, &StartProcessorInRunLoop, &processor);
-  g_main_loop_run(loop);
-  g_main_loop_unref(loop);
-  if (collector_action.has_input_object_ && out_response)
-    *out_response = collector_action.update_check_response_;
-  if (out_post_data)
-    *out_post_data = fetcher->post_data();
-  return collector_action.has_input_object_;
-}
-
-TEST(UpdateCheckActionTest, NoUpdateTest) {
-  UpdateCheckParams params("",  // machine_id
-                           "",  // user_id
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "",  // os_sp
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest",
-                           "");  // url
-  UpdateCheckResponse response;
-  ASSERT_TRUE(
-      TestUpdateCheckAction(params,
-                            GetNoUpdateResponse(UpdateCheckParams::kAppId),
-                            true,
-                            &response,
-                            NULL));
-  EXPECT_FALSE(response.update_exists);
-}
-
-TEST(UpdateCheckActionTest, ValidUpdateTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "arm-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "");  // url
-  UpdateCheckResponse response;
-  ASSERT_TRUE(
-      TestUpdateCheckAction(params,
-                            GetUpdateResponse(UpdateCheckParams::kAppId,
-                                              "1.2.3.4",  // version
-                                              "http://more/info",
-                                              "true",  // prompt
-                                              "http://code/base",  // dl url
-                                              "HASH1234=",  // checksum
-                                              "false",  // needs admin
-                                              "123"),  // size
-                            true,
-                            &response,
-                            NULL));
-  EXPECT_TRUE(response.update_exists);
-  EXPECT_EQ("1.2.3.4", response.display_version);
-  EXPECT_EQ("http://code/base", response.codebase);
-  EXPECT_EQ("http://more/info", response.more_info_url);
-  EXPECT_EQ("HASH1234=", response.hash);
-  EXPECT_EQ(123, response.size);
-  EXPECT_FALSE(response.needs_admin);
-  EXPECT_TRUE(response.prompt);
-}
-
-TEST(UpdateCheckActionTest, NoOutputPipeTest) {
-  UpdateCheckParams params("",  // machine_id
-                           "",  // usr_id
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "",  // os_sp
-                           "",  // os_board
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest",
-                           "");  // url
-  const string http_response(GetNoUpdateResponse(UpdateCheckParams::kAppId));
-
-  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
-
-  ObjectFeederAction<UpdateCheckParams> feeder_action;
-  feeder_action.set_obj(params);
-  UpdateCheckAction action(new MockHttpFetcher(http_response.data(),
-                                               http_response.size()));
-  UpdateCheckActionTestProcessorDelegate delegate;
-  delegate.loop_ = loop;
-  ActionProcessor processor;
-  processor.set_delegate(&delegate);
-  processor.EnqueueAction(&feeder_action);
-  processor.EnqueueAction(&action);
-  BondActions(&feeder_action, &action);
-
-  g_timeout_add(0, &StartProcessorInRunLoop, &processor);
-  g_main_loop_run(loop);
-  g_main_loop_unref(loop);
-  EXPECT_FALSE(processor.IsRunning());
-}
-
-TEST(UpdateCheckActionTest, InvalidXmlTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_FALSE(
-      TestUpdateCheckAction(params,
-                            "invalid xml>",
-                            false,
-                            &response,
-                            NULL));
-  EXPECT_FALSE(response.update_exists);
-}
-
-TEST(UpdateCheckActionTest, MissingStatusTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_FALSE(TestUpdateCheckAction(
-      params,
-      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
-      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
-      "appid=\"foo\" status=\"ok\"><ping "
-      "status=\"ok\"/><updatecheck/></app></gupdate>",
-      false,
-      &response,
-      NULL));
-  EXPECT_FALSE(response.update_exists);
-}
-
-TEST(UpdateCheckActionTest, InvalidStatusTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_FALSE(TestUpdateCheckAction(
-      params,
-      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
-      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
-      "appid=\"foo\" status=\"ok\"><ping "
-      "status=\"ok\"/><updatecheck status=\"foo\"/></app></gupdate>",
-      false,
-      &response,
-      NULL));
-  EXPECT_FALSE(response.update_exists);
-}
-
-TEST(UpdateCheckActionTest, MissingNodesetTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_FALSE(TestUpdateCheckAction(
-      params,
-      "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gupdate "
-      "xmlns=\"http://www.google.com/update2/response\" protocol=\"2.0\"><app "
-      "appid=\"foo\" status=\"ok\"><ping "
-      "status=\"ok\"/></app></gupdate>",
-      false,
-      &response,
-      NULL));
-  EXPECT_FALSE(response.update_exists);
-}
-
-TEST(UpdateCheckActionTest, MissingFieldTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_TRUE(TestUpdateCheckAction(params,
-                                    string("<?xml version=\"1.0\" "
-                                           "encoding=\"UTF-8\"?><gupdate "
-                                           "xmlns=\"http://www.google.com/"
-                                           "update2/response\" "
-                                           "protocol=\"2.0\"><app  appid=\"") +
-                                    UpdateCheckParams::kAppId
-                                    + "\" status=\"ok\"><ping "
-                                    "status=\"ok\"/><updatecheck "
-                                    "DisplayVersion=\"1.2.3.4\" "
-                                    "Prompt=\"false\" "
-                                    "codebase=\"http://code/base\" "
-                                    "hash=\"HASH1234=\" needsadmin=\"true\" "
-                                    "size=\"123\" "
-                                    "status=\"ok\"/></app></gupdate>",
-                                    true,
-                                    &response,
-                                    NULL));
-  EXPECT_TRUE(response.update_exists);
-  EXPECT_EQ("1.2.3.4", response.display_version);
-  EXPECT_EQ("http://code/base", response.codebase);
-  EXPECT_EQ("", response.more_info_url);
-  EXPECT_EQ("HASH1234=", response.hash);
-  EXPECT_EQ(123, response.size);
-  EXPECT_TRUE(response.needs_admin);
-  EXPECT_FALSE(response.prompt);
-}
-
-namespace {
-class TerminateEarlyTestProcessorDelegate : public ActionProcessorDelegate {
- public:
-  void ProcessingStopped(const ActionProcessor* processor) {
-    ASSERT_TRUE(loop_);
-    g_main_loop_quit(loop_);
-  }
-  GMainLoop *loop_;
-};
-
-gboolean TerminateTransferTestStarter(gpointer data) {
-  ActionProcessor *processor = reinterpret_cast<ActionProcessor*>(data);
-  processor->StartProcessing();
-  CHECK(processor->IsRunning());
-  processor->StopProcessing();
-  return FALSE;
-}
-}  // namespace {}
-
-TEST(UpdateCheckActionTest, TerminateTransferTest) {
-  UpdateCheckParams params("",  // machine_id
-                           "",  // usr_id
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "",  // os_sp
-                           "",  // os_board
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest",
-                           "http://url");
-  string http_response("doesn't matter");
-  GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE);
-
-  ObjectFeederAction<UpdateCheckParams> feeder_action;
-  feeder_action.set_obj(params);
-  UpdateCheckAction action(new MockHttpFetcher(http_response.data(),
-                                               http_response.size()));
-  TerminateEarlyTestProcessorDelegate delegate;
-  delegate.loop_ = loop;
-  ActionProcessor processor;
-  processor.set_delegate(&delegate);
-  processor.EnqueueAction(&feeder_action);
-  processor.EnqueueAction(&action);
-  BondActions(&feeder_action, &action);
-
-  g_timeout_add(0, &TerminateTransferTestStarter, &processor);
-  g_main_loop_run(loop);
-  g_main_loop_unref(loop);
-}
-
-TEST(UpdateCheckActionTest, XmlEncodeTest) {
-  EXPECT_EQ("ab", XmlEncode("ab"));
-  EXPECT_EQ("a&lt;b", XmlEncode("a<b"));
-  EXPECT_EQ("foo-&#x3A9;", XmlEncode("foo-\xce\xa9"));
-  EXPECT_EQ("&lt;&amp;&gt;", XmlEncode("<&>"));
-  EXPECT_EQ("&amp;lt;&amp;amp;&amp;gt;", XmlEncode("&lt;&amp;&gt;"));
-
-  vector<char> post_data;
-
-  // Make sure XML Encode is being called on the params
-  UpdateCheckParams params("testthemachine<id",
-                           "testtheuser_id&lt;",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "testtheservice_pack>",
-                           "x86 generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_FALSE(
-      TestUpdateCheckAction(params,
-                            "invalid xml>",
-                            false,
-                            &response,
-                            &post_data));
-  // convert post_data to string
-  string post_str(&post_data[0], post_data.size());
-  EXPECT_NE(post_str.find("testthemachine&lt;id"), string::npos);
-  EXPECT_EQ(post_str.find("testthemachine<id"), string::npos);
-  EXPECT_NE(post_str.find("testtheuser_id&amp;lt;"), string::npos);
-  EXPECT_EQ(post_str.find("testtheuser_id&lt;"), string::npos);
-  EXPECT_NE(post_str.find("testtheservice_pack&gt;"), string::npos);
-  EXPECT_EQ(post_str.find("testtheservice_pack>"), string::npos);
-  EXPECT_NE(post_str.find("x86 generic"), string::npos);
-}
-
-TEST(UpdateCheckActionTest, XmlDecodeTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "x86-generic",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_TRUE(
-      TestUpdateCheckAction(params,
-                            GetUpdateResponse(UpdateCheckParams::kAppId,
-                                              "1.2.3.4",  // version
-                                              "testthe&lt;url",  // more info
-                                              "true",  // prompt
-                                              "testthe&amp;codebase",  // dl url
-                                              "HASH1234=", // checksum
-                                              "false",  // needs admin
-                                              "123"),  // size
-                            true,
-                            &response,
-                            NULL));
-
-  EXPECT_EQ(response.more_info_url, "testthe<url");
-  EXPECT_EQ(response.codebase, "testthe&codebase");
-}
-
-TEST(UpdateCheckActionTest, ParseIntTest) {
-  UpdateCheckParams params("machine_id",
-                           "user_id",
-                           UpdateCheckParams::kOsPlatform,
-                           UpdateCheckParams::kOsVersion,
-                           "service_pack",
-                           "the_board",
-                           UpdateCheckParams::kAppId,
-                           "0.1.0.0",
-                           "en-US",
-                           "unittest_track",
-                           "http://url");
-  UpdateCheckResponse response;
-  ASSERT_TRUE(
-      TestUpdateCheckAction(params,
-                            GetUpdateResponse(UpdateCheckParams::kAppId,
-                                              "1.2.3.4",  // version
-                                              "theurl",  // more info
-                                              "true",  // prompt
-                                              "thecodebase",  // dl url
-                                              "HASH1234=", // checksum
-                                              "false",  // needs admin
-                                              // overflows int32:
-                                              "123123123123123"),  // size
-                            true,
-                            &response,
-                            NULL));
-
-  EXPECT_EQ(response.size, 123123123123123ll);
-}
-
-}  // namespace chromeos_update_engine
