| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh
ot_job.h" | 5 #include "chrome/browser/chromeos/policy/remote_commands/device_command_screensh
ot_job.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // String constant identifying the upload url field in the command payload. | 42 // String constant identifying the upload url field in the command payload. |
| 43 const char* const kUploadUrlFieldName = "fileUploadUrl"; | 43 const char* const kUploadUrlFieldName = "fileUploadUrl"; |
| 44 | 44 |
| 45 em::RemoteCommand GenerateScreenshotCommandProto( | 45 em::RemoteCommand GenerateScreenshotCommandProto( |
| 46 RemoteCommandJob::UniqueIDType unique_id, | 46 RemoteCommandJob::UniqueIDType unique_id, |
| 47 base::TimeDelta age_of_command, | 47 base::TimeDelta age_of_command, |
| 48 const std::string upload_url) { | 48 const std::string upload_url) { |
| 49 em::RemoteCommand command_proto; | 49 em::RemoteCommand command_proto; |
| 50 command_proto.set_type( | 50 command_proto.set_type( |
| 51 enterprise_management::RemoteCommand_Type_DEVICE_SCREENSHOT); | 51 enterprise_management::RemoteCommand_Type_DEVICE_SCREENSHOT); |
| 52 command_proto.set_unique_id(unique_id); | 52 command_proto.set_command_id(unique_id); |
| 53 command_proto.set_age_of_command(age_of_command.InMilliseconds()); | 53 command_proto.set_age_of_command(age_of_command.InMilliseconds()); |
| 54 std::string payload; | 54 std::string payload; |
| 55 base::DictionaryValue root_dict; | 55 base::DictionaryValue root_dict; |
| 56 root_dict.SetString(kUploadUrlFieldName, upload_url); | 56 root_dict.SetString(kUploadUrlFieldName, upload_url); |
| 57 base::JSONWriter::Write(root_dict, &payload); | 57 base::JSONWriter::Write(root_dict, &payload); |
| 58 command_proto.set_payload(payload); | 58 command_proto.set_payload(payload); |
| 59 return command_proto; | 59 return command_proto; |
| 60 } | 60 } |
| 61 | 61 |
| 62 class MockUploadJob : public policy::UploadJob { | 62 class MockUploadJob : public policy::UploadJob { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 base::Bind(&DeviceCommandScreenshotTest::VerifyResults, | 309 base::Bind(&DeviceCommandScreenshotTest::VerifyResults, |
| 310 base::Unretained(this), base::Unretained(job.get()), | 310 base::Unretained(this), base::Unretained(job.get()), |
| 311 RemoteCommandJob::FAILED, | 311 RemoteCommandJob::FAILED, |
| 312 CreatePayloadFromResultCode( | 312 CreatePayloadFromResultCode( |
| 313 DeviceCommandScreenshotJob::FAILURE_AUTHENTICATION))); | 313 DeviceCommandScreenshotJob::FAILURE_AUTHENTICATION))); |
| 314 EXPECT_TRUE(success); | 314 EXPECT_TRUE(success); |
| 315 run_loop_.Run(); | 315 run_loop_.Run(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace policy | 318 } // namespace policy |
| OLD | NEW |