AU: move 'userinitiated' flag to the right place in an update check

The said flag, introduced in a recent change, should be an attribute of
the <updatecheck> node, now fixed. Also changed a couple of unit tests
to reflect this.

BUG=chromium-os:26594
TEST=Flag now appears in the right place

Change-Id: I4f024797da34376364d358631d1a606be8be639e
Reviewed-on: https://gerrit.chromium.org/gerrit/41628
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index c1eb795..2943ad8 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -128,8 +128,10 @@
       body += StringPrintf(
           "        <updatecheck"
           " targetversionprefix=\"%s\""
+          " userinitiated=\"%s\""
           "></updatecheck>\n",
-          XmlEncode(params.target_version_prefix).c_str());
+          XmlEncode(params.target_version_prefix).c_str(),
+          (params.interactive ? "true" : "false"));
 
       // If this is the first update check after a reboot following a previous
       // update, generate an event containing the previous version number. If
@@ -178,9 +180,7 @@
       XmlEncode(params.app_track) + "\" board=\"" +
       XmlEncode(params.os_board) + "\" hardware_class=\"" +
       XmlEncode(params.hardware_class) + "\" delta_okay=\"" +
-      (params.delta_okay ? "true" : "false") +
-      "\" userinitiated=\"" + (params.interactive ? "true" : "false") +
-      "\">\n" + body +
+      (params.delta_okay ? "true" : "false") + "\">\n" + body +
       "    </app>\n"
       "</request>\n";
 }
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 276f189..42b2134 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -918,6 +918,7 @@
       "        <ping active=\"1\" a=\"-1\" r=\"-1\"></ping>\n"
       "        <updatecheck"
       " targetversionprefix=\"\""
+      " userinitiated=\"false\""
       "></updatecheck>\n"),
       string::npos);
   EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""),
@@ -948,6 +949,7 @@
       "        <ping active=\"1\" a=\"-1\" r=\"-1\"></ping>\n"
       "        <updatecheck"
       " targetversionprefix=\"\""
+      " userinitiated=\"false\""
       "></updatecheck>\n"),
       string::npos);
   EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""),