Index: chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc |
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc |
index 49f97a8bbda6bc1442bdd9efaa97f9ba8f2ef80d..248956622e7761b64f4f398d9ec107de738835dc 100644 |
--- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc |
+++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" |
#include "base/bind.h" |
+#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/message_loop/message_loop.h" |
#include "chrome/browser/browser_process.h" |
@@ -14,6 +15,7 @@ |
#include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
#include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" |
#include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" |
+#include "chrome/common/chrome_switches.h" |
#include "google_apis/gaia/gaia_urls.h" |
#include "net/http/http_status_code.h" |
@@ -28,6 +30,11 @@ const int kLockRetryIntervalMs = 500; |
// Maximum time to retry InstallAttrs initialization before we give up. |
const int kLockRetryTimeoutMs = 10 * 60 * 1000; // 10 minutes. |
+// Testing token used when the enrollment-skip-robot-auth is set to skip talking |
+// to GAIA for an actual token. This is needed to be able to run against the |
+// testing DMServer implementations. |
+const char kTestingRobotToken[] = "test-token"; |
+ |
} // namespace |
EnrollmentHandlerChromeOS::EnrollmentHandlerChromeOS( |
@@ -187,6 +194,16 @@ void EnrollmentHandlerChromeOS::PolicyValidated( |
username_ = validator->policy_data()->username(); |
device_id_ = validator->policy_data()->device_id(); |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnrollmentSkipRobotAuth)) { |
+ // For test purposes we allow enrollment to succeed without proper robot |
+ // account and use the provided value as a token. |
+ refresh_token_ = kTestingRobotToken; |
+ enrollment_step_ = STEP_LOCK_DEVICE, |
+ StartLockDevice(username_, device_mode_, device_id_); |
+ return; |
+ } |
+ |
enrollment_step_ = STEP_ROBOT_AUTH_FETCH; |
client_->FetchRobotAuthCodes(auth_token_); |
} else { |