AU/unittest: fix to OmahaResponseHandlerAction unit tests

The said class uses a fixed named file for communicating data (in this
case, a deadline marker) to Chrome, which causes unit tests to fail when
run in parallel. This change makes this file parametric for testing
purposes, allowing the tests to be run in parallel.

Note that we only override the file name for tests that actually examine
the file. For other invocations there may still be race conditions when
writing to the marker file, but they should not affect the outcome of
the tests.

BUG=chromium:236465
TEST=Tests successful

Change-Id: Ieb2a3ef1b4d9c5d5d2e06cf8e281eb832b2a9ff8
Reviewed-on: https://gerrit.chromium.org/gerrit/62825
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/omaha_response_handler_action.h b/omaha_response_handler_action.h
index 82e99bf..db72c91 100644
--- a/omaha_response_handler_action.h
+++ b/omaha_response_handler_action.h
@@ -32,7 +32,8 @@
  public:
   static const char kDeadlineFile[];
 
-  OmahaResponseHandlerAction(SystemState* system_state);
+  explicit OmahaResponseHandlerAction(SystemState* system_state);
+
   typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType
       InputObjectType;
   typedef ActionTraits<OmahaResponseHandlerAction>::OutputObjectType
@@ -57,8 +58,6 @@
   void set_key_path(const std::string& path) { key_path_ = path; }
 
  private:
-  FRIEND_TEST(UpdateAttempterTest, CreatePendingErrorEventResumedTest);
-
   // Returns true if payload hash checks are mandatory based on the state
   // of the system and the contents of the Omaha response. False otherwise.
   bool AreHashChecksMandatory(const OmahaResponse& response);
@@ -78,6 +77,17 @@
   // Public key path to use for payload verification.
   std::string key_path_;
 
+  // File used for communication deadline to Chrome.
+  const std::string deadline_file_;
+
+  // Special ctor + friend declarations for testing purposes.
+  OmahaResponseHandlerAction(SystemState* system_state,
+                             const std::string& deadline_file);
+
+  friend class OmahaResponseHandlerActionTest;
+
+  FRIEND_TEST(UpdateAttempterTest, CreatePendingErrorEventResumedTest);
+
   DISALLOW_COPY_AND_ASSIGN(OmahaResponseHandlerAction);
 };