If the Omaha URL is 'autest', point to the hardcoded test server.

This will be used by the 'autest' crosh command to initiate an update check to
the test server.

If the test server URL changes, only update_engine's dbus_service.cc needs to be
updated.

BUG=chromium-os:14567
TEST=unit tests, tested on device

Change-Id: I3ba543125b29b4378f9f3fb0dba7aa510a67ef28

Review URL: http://codereview.chromium.org/6901068
diff --git a/dbus_service.cc b/dbus_service.cc
index 5a1a105..a9727f8 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2011 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.
 
@@ -14,6 +14,10 @@
 
 using std::string;
 
+static const char kAUTestURLRequest[] = "autest";
+static const char kAUTestURL[] =
+    "https://omaha.corp.google.com:8082/service/update2";
+
 G_DEFINE_TYPE(UpdateEngineService, update_engine_service, G_TYPE_OBJECT)
 
 static void update_engine_service_finalize(GObject* object) {
@@ -59,7 +63,8 @@
   string update_app_version;
   string update_omaha_url;
   // Only non-official (e.g., dev and test) builds can override the current
-  // version and update server URL over D-Bus.
+  // version and update server URL over D-Bus. However, pointing to the
+  // hardcoded test update server URL is always allowed.
   if (!chromeos_update_engine::utils::IsOfficialBuild()) {
     if (app_version) {
       update_app_version = app_version;
@@ -68,6 +73,9 @@
       update_omaha_url = omaha_url;
     }
   }
+  if (omaha_url && strcmp(omaha_url, kAUTestURLRequest) == 0) {
+    update_omaha_url = kAUTestURL;
+  }
   LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" "
             << "omaha_url=\"" << update_omaha_url << "\"";
   self->update_attempter_->CheckForUpdate(update_app_version, update_omaha_url);