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 "components/policy/core/common/remote_commands/remote_commands_queue.h" | 5 #include "components/policy/core/common/remote_commands/remote_commands_queue.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const RemoteCommandJob::UniqueIDType kUniqueID2 = 987654321; | 29 const RemoteCommandJob::UniqueIDType kUniqueID2 = 987654321; |
30 const char kPayload[] = "_PAYLOAD_FOR_TESTING_"; | 30 const char kPayload[] = "_PAYLOAD_FOR_TESTING_"; |
31 const char kPayload2[] = "_PAYLOAD_FOR_TESTING2_"; | 31 const char kPayload2[] = "_PAYLOAD_FOR_TESTING2_"; |
32 | 32 |
33 em::RemoteCommand GenerateCommandProto(RemoteCommandJob::UniqueIDType unique_id, | 33 em::RemoteCommand GenerateCommandProto(RemoteCommandJob::UniqueIDType unique_id, |
34 base::TimeDelta age_of_command, | 34 base::TimeDelta age_of_command, |
35 const std::string& payload) { | 35 const std::string& payload) { |
36 em::RemoteCommand command_proto; | 36 em::RemoteCommand command_proto; |
37 command_proto.set_type( | 37 command_proto.set_type( |
38 enterprise_management::RemoteCommand_Type_COMMAND_ECHO_TEST); | 38 enterprise_management::RemoteCommand_Type_COMMAND_ECHO_TEST); |
39 command_proto.set_unique_id(unique_id); | 39 command_proto.set_command_id(unique_id); |
40 command_proto.set_age_of_command(age_of_command.InMilliseconds()); | 40 command_proto.set_age_of_command(age_of_command.InMilliseconds()); |
41 if (!payload.empty()) | 41 if (!payload.empty()) |
42 command_proto.set_payload(payload); | 42 command_proto.set_payload(payload); |
43 return command_proto; | 43 return command_proto; |
44 } | 44 } |
45 | 45 |
46 // Mock class for RemoteCommandsQueue::Observer. | 46 // Mock class for RemoteCommandsQueue::Observer. |
47 class MockRemoteCommandsQueueObserver : public RemoteCommandsQueue::Observer { | 47 class MockRemoteCommandsQueueObserver : public RemoteCommandsQueue::Observer { |
48 public: | 48 public: |
49 MockRemoteCommandsQueueObserver() {} | 49 MockRemoteCommandsQueueObserver() {} |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 Property(&RemoteCommandJob::status, RemoteCommandJob::SUCCEEDED), | 325 Property(&RemoteCommandJob::status, RemoteCommandJob::SUCCEEDED), |
326 Property(&RemoteCommandJob::GetResultPayload, | 326 Property(&RemoteCommandJob::GetResultPayload, |
327 Pointee(StrEq(kPayload2)))))); | 327 Pointee(StrEq(kPayload2)))))); |
328 task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(5)); | 328 task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(5)); |
329 Mock::VerifyAndClearExpectations(&observer_); | 329 Mock::VerifyAndClearExpectations(&observer_); |
330 | 330 |
331 task_runner_->FastForwardUntilNoTasksRemain(); | 331 task_runner_->FastForwardUntilNoTasksRemain(); |
332 } | 332 } |
333 | 333 |
334 } // namespace policy | 334 } // namespace policy |
OLD | NEW |