Commit 0ebbd204 authored by Denis Kuznetsov's avatar Denis Kuznetsov Committed by Commit Bot

[CRD for Kiosk] Add remote command unit tests.

Bug: 864455
Change-Id: Ia71d2bc2360b3db4100643e62210401c9b6c7a2b
Reviewed-on: https://chromium-review.googlesource.com/1148451
Commit-Queue: Denis Kuznetsov <antrim@chromium.org>
Reviewed-by: default avatarPavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578602}
parent 74d2b2a7
...@@ -2148,6 +2148,7 @@ source_set("unit_tests") { ...@@ -2148,6 +2148,7 @@ source_set("unit_tests") {
"policy/pre_signin_policy_fetcher_unittest.cc", "policy/pre_signin_policy_fetcher_unittest.cc",
"policy/remote_commands/device_command_screenshot_job_unittest.cc", "policy/remote_commands/device_command_screenshot_job_unittest.cc",
"policy/remote_commands/device_command_set_volume_job_unittest.cc", "policy/remote_commands/device_command_set_volume_job_unittest.cc",
"policy/remote_commands/device_command_start_crd_session_unittest.cc",
"policy/remote_commands/device_command_wipe_users_job_unittest.cc", "policy/remote_commands/device_command_wipe_users_job_unittest.cc",
"policy/remote_commands/user_command_arc_job_unittest.cc", "policy/remote_commands/user_command_arc_job_unittest.cc",
"policy/secondary_google_account_signin_policy_handler_unittest.cc", "policy/secondary_google_account_signin_policy_handler_unittest.cc",
......
...@@ -42,7 +42,7 @@ const char kResultMessageFieldName[] = "message"; ...@@ -42,7 +42,7 @@ const char kResultMessageFieldName[] = "message";
// Period in seconds since last user activity, if job finished with // Period in seconds since last user activity, if job finished with
// FAILURE_NOT_IDLE result code. // FAILURE_NOT_IDLE result code.
const char kLastActivityFieldName[] = "lastActivitySec"; const char kResultLastActivityFieldName[] = "lastActivitySec";
} // namespace } // namespace
...@@ -82,7 +82,7 @@ DeviceCommandStartCRDSessionJob::ResultPayload::ResultPayload( ...@@ -82,7 +82,7 @@ DeviceCommandStartCRDSessionJob::ResultPayload::ResultPayload(
if (auth_code) if (auth_code)
value.SetKey(kResultAuthCodeFieldName, base::Value(auth_code.value())); value.SetKey(kResultAuthCodeFieldName, base::Value(auth_code.value()));
if (time_delta) { if (time_delta) {
value.SetKey(kLastActivityFieldName, value.SetKey(kResultLastActivityFieldName,
base::Value(static_cast<int>(time_delta.value().InSeconds()))); base::Value(static_cast<int>(time_delta.value().InSeconds())));
} }
base::JSONWriter::Write(value, &payload_); base::JSONWriter::Write(value, &payload_);
......
...@@ -31,10 +31,16 @@ class DeviceCommandStartCRDSessionJob : public RemoteCommandJob { ...@@ -31,10 +31,16 @@ class DeviceCommandStartCRDSessionJob : public RemoteCommandJob {
FAILURE_NOT_A_KIOSK = 2, FAILURE_NOT_A_KIOSK = 2,
// Failed as device is currently in use and no interruptUser flag is set. // Failed as device is currently in use and no interruptUser flag is set.
FAILURE_NOT_IDLE = 2, FAILURE_NOT_IDLE = 3,
// TODO(antrim): Work in progress // Failed as we could not get OAuth token for whatever reason.
FAILURE_NOT_IMPLEMENTED_YET = 3, FAILURE_NO_OAUTH_TOKEN = 4,
// Failed as we could not get ICE configuration for whatever reason.
FAILURE_NO_ICE_CONFIG = 5,
// Failure during attempt to start CRD host and obtain CRD token.
FAILURE_CRD_HOST_ERROR = 6,
}; };
using OAuthTokenCallback = base::OnceCallback<void(const std::string&)>; using OAuthTokenCallback = base::OnceCallback<void(const std::string&)>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment