Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/policy/remote_commands/testing_remote_commands_server.h

Issue 879233003: Initial RemoteCommandService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remote-commands
Patch Set: WIP Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_REMOTE_COMMANDS_TESTING_REMOTE_COMMANDS_SERVER_H_
6 #define CHROME_BROWSER_POLICY_REMOTE_COMMANDS_TESTING_REMOTE_COMMANDS_SERVER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/synchronization/lock.h"
15 #include "components/policy/core/common/remote_commands/remote_command_job.h"
16 #include "policy/proto/device_management_backend.pb.h"
17
18 namespace base {
19 class Clock;
20 class SingleThreadTaskRunner;
21 } // namespace base
22
23 namespace policy {
24
25 class TestingRemoteCommandsServer {
bartfab (slow) 2015/02/12 14:29:19 Without any documentation, it is hard to understan
binjin 2015/02/16 22:46:23 Acknowledged.
26 public:
27 TestingRemoteCommandsServer();
28 virtual ~TestingRemoteCommandsServer();
29
30 // XXX
31 void IssueCommand(enterprise_management::RemoteCommand_Type type,
32 const std::string& payload);
33
34 // XXX
35 void SetClockForTesting(scoped_ptr<base::Clock> clock);
bartfab (slow) 2015/02/12 14:29:19 No need for the "ForTesting" prefix. This is testi
binjin 2015/02/16 22:46:23 Done.
36
37 // XXX
38 size_t GetUnreportedCommandCount() const;
bartfab (slow) 2015/02/12 14:29:19 Nit: "Unreported" is not clear to me. This seems t
binjin 2015/02/16 22:46:23 Done.
39
40 // XXX
41 void FetchCommandsFromIO(
42 RemoteCommandJob::UniqueIDType last_command_id,
43 const std::vector<enterprise_management::RemoteCommandResult>&
44 previous_job_results,
45 std::vector<enterprise_management::RemoteCommand>* fetched_commands);
bartfab (slow) 2015/02/12 14:29:19 Why not have |std::vector<enterprise_management::R
binjin 2015/02/16 22:46:23 Done.
46
47 protected:
48 // XXX
49 virtual void JobResultReported(
50 const enterprise_management::RemoteCommandResult& job_result) const {}
bartfab (slow) 2015/02/12 14:29:19 Nit: Never inline virtual methods. The style guide
binjin 2015/02/16 22:46:23 Done.
51
52 private:
53 std::vector<enterprise_management::RemoteCommand> commands_;
54 RemoteCommandJob::UniqueIDType last_acknowledged_id_;
bartfab (slow) 2015/02/12 14:29:19 Nit: s/id/unique_id/ for consistency.
binjin 2015/02/16 22:46:23 Done.
55 RemoteCommandJob::UniqueIDType last_generated_unique_id_;
bartfab (slow) 2015/02/12 14:29:19 Nit: Document that this test server generates stri
binjin 2015/02/16 22:46:23 Done.
56
57 scoped_ptr<base::Clock> clock_;
58 base::Lock lock_;
bartfab (slow) 2015/02/12 14:29:19 Locks are avoided in Chrome code whenever possible
binjin 2015/02/16 22:46:23 I will keep the lock as we discussed offline.
59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
bartfab (slow) 2015/02/12 14:29:19 Nit 1: base::SequencedTaskRunner or even base::Tas
binjin 2015/02/16 22:46:23 SingleThreadTaskRunner is required single I need t
60
61 DISALLOW_COPY_AND_ASSIGN(TestingRemoteCommandsServer);
62 };
63
64 } // namespace policy
65
66 #endif // CHROME_BROWSER_POLICY_REMOTE_COMMANDS_TESTING_REMOTE_COMMANDS_SERVER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698