| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 unique_id, base::TimeTicks::Now() - issued_time, upload_url))); | 240 unique_id, base::TimeTicks::Now() - issued_time, upload_url))); |
| 241 EXPECT_EQ(unique_id, job->unique_id()); | 241 EXPECT_EQ(unique_id, job->unique_id()); |
| 242 EXPECT_EQ(RemoteCommandJob::NOT_STARTED, job->status()); | 242 EXPECT_EQ(RemoteCommandJob::NOT_STARTED, job->status()); |
| 243 } | 243 } |
| 244 | 244 |
| 245 std::string DeviceCommandScreenshotTest::CreatePayloadFromResultCode( | 245 std::string DeviceCommandScreenshotTest::CreatePayloadFromResultCode( |
| 246 DeviceCommandScreenshotJob::ResultCode result_code) { | 246 DeviceCommandScreenshotJob::ResultCode result_code) { |
| 247 std::string payload; | 247 std::string payload; |
| 248 base::DictionaryValue root_dict; | 248 base::DictionaryValue root_dict; |
| 249 if (result_code != DeviceCommandScreenshotJob::SUCCESS) | 249 if (result_code != DeviceCommandScreenshotJob::SUCCESS) |
| 250 root_dict.Set(kResultFieldName, new base::FundamentalValue(result_code)); | 250 root_dict.Set(kResultFieldName, new base::Value(result_code)); |
| 251 base::JSONWriter::Write(root_dict, &payload); | 251 base::JSONWriter::Write(root_dict, &payload); |
| 252 return payload; | 252 return payload; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void DeviceCommandScreenshotTest::VerifyResults( | 255 void DeviceCommandScreenshotTest::VerifyResults( |
| 256 RemoteCommandJob* job, | 256 RemoteCommandJob* job, |
| 257 RemoteCommandJob::Status expected_status, | 257 RemoteCommandJob::Status expected_status, |
| 258 std::string expected_payload) { | 258 std::string expected_payload) { |
| 259 EXPECT_EQ(expected_status, job->status()); | 259 EXPECT_EQ(expected_status, job->status()); |
| 260 if (job->status() == RemoteCommandJob::SUCCEEDED) { | 260 if (job->status() == RemoteCommandJob::SUCCEEDED) { |
| (...skipping 48 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 |