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

Side by Side Diff: remoting/protocol/protocol_mock_objects.h

Issue 1460593005: Make protocol::ConnectionToClient an abstract interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "remoting/protocol/session_manager.h" 25 #include "remoting/protocol/session_manager.h"
26 #include "remoting/protocol/transport.h" 26 #include "remoting/protocol/transport.h"
27 #include "remoting/protocol/video_stub.h" 27 #include "remoting/protocol/video_stub.h"
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 29
30 namespace remoting { 30 namespace remoting {
31 namespace protocol { 31 namespace protocol {
32 32
33 class MockConnectionToClient : public ConnectionToClient { 33 class MockConnectionToClient : public ConnectionToClient {
34 public: 34 public:
35 MockConnectionToClient(Session* session, HostStub* host_stub); 35 MockConnectionToClient(scoped_ptr<Session> session, HostStub* host_stub);
36 ~MockConnectionToClient() override; 36 ~MockConnectionToClient() override;
37 37
38 void SetEventHandler(EventHandler* event_handler) override {
39 event_handler_ = event_handler;
40 }
41
38 MOCK_METHOD1(Init, void(Session* session)); 42 MOCK_METHOD1(Init, void(Session* session));
39 MOCK_METHOD0(video_stub, VideoStub*()); 43 MOCK_METHOD0(video_stub, VideoStub*());
44 MOCK_METHOD0(audio_stub, AudioStub*());
40 MOCK_METHOD0(client_stub, ClientStub*()); 45 MOCK_METHOD0(client_stub, ClientStub*());
41 MOCK_METHOD0(session, Session*());
42 MOCK_METHOD1(Disconnect, void(ErrorCode error)); 46 MOCK_METHOD1(Disconnect, void(ErrorCode error));
43 47
48 Session* session() override { return session_.get(); }
49 void OnInputEventReceived(int64_t timestamp) override {}
50
44 void set_clipboard_stub(ClipboardStub* clipboard_stub) override { 51 void set_clipboard_stub(ClipboardStub* clipboard_stub) override {
45 clipboard_stub_ = clipboard_stub; 52 clipboard_stub_ = clipboard_stub;
46 } 53 }
47 void set_host_stub(HostStub* host_stub) override { host_stub_ = host_stub; } 54 void set_host_stub(HostStub* host_stub) override { host_stub_ = host_stub; }
48 void set_input_stub(InputStub* input_stub) override { 55 void set_input_stub(InputStub* input_stub) override {
49 input_stub_ = input_stub; 56 input_stub_ = input_stub;
50 } 57 }
51 58
52 void set_video_feedback_stub( 59 void set_video_feedback_stub(
53 VideoFeedbackStub* video_feedback_stub) override { 60 VideoFeedbackStub* video_feedback_stub) override {
54 video_feedback_stub_ = video_feedback_stub; 61 video_feedback_stub_ = video_feedback_stub;
55 } 62 }
56 63
64 EventHandler* event_handler() { return event_handler_; }
57 ClipboardStub* clipboard_stub() { return clipboard_stub_; } 65 ClipboardStub* clipboard_stub() { return clipboard_stub_; }
58 HostStub* host_stub() { return host_stub_; } 66 HostStub* host_stub() { return host_stub_; }
59 InputStub* input_stub() { return input_stub_; } 67 InputStub* input_stub() { return input_stub_; }
60 VideoFeedbackStub* video_feedback_stub() { return video_feedback_stub_; } 68 VideoFeedbackStub* video_feedback_stub() { return video_feedback_stub_; }
61 69
62 private: 70 private:
63 ClipboardStub* clipboard_stub_; 71 scoped_ptr<Session> session_;
64 HostStub* host_stub_; 72 EventHandler* event_handler_ = nullptr;
65 InputStub* input_stub_; 73
66 VideoFeedbackStub* video_feedback_stub_; 74 ClipboardStub* clipboard_stub_ = nullptr;
75 HostStub* host_stub_ = nullptr;
76 InputStub* input_stub_ = nullptr;
77 VideoFeedbackStub* video_feedback_stub_ = nullptr;
67 78
68 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClient); 79 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClient);
69 }; 80 };
70 81
71 class MockConnectionToClientEventHandler 82 class MockConnectionToClientEventHandler
72 : public ConnectionToClient::EventHandler { 83 : public ConnectionToClient::EventHandler {
73 public: 84 public:
74 MockConnectionToClientEventHandler(); 85 MockConnectionToClientEventHandler();
75 ~MockConnectionToClientEventHandler() override; 86 ~MockConnectionToClientEventHandler() override;
76 87
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // Runs tasks synchronously instead of posting them to |task_runner|. 287 // Runs tasks synchronously instead of posting them to |task_runner|.
277 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 288 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
278 const tracked_objects::Location& from_here, 289 const tracked_objects::Location& from_here,
279 const base::Closure& task) override; 290 const base::Closure& task) override;
280 }; 291 };
281 292
282 } // namespace protocol 293 } // namespace protocol
283 } // namespace remoting 294 } // namespace remoting
284 295
285 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 296 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698