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

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

Issue 6250198: More out-of-lining of test code, along with a bunch of GMOCK objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix the gyp files this time Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MOCK_OBJECTS_H_ 5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
6 #define REMOTING_PROTOCOL_MOCK_OBJECTS_H_ 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
7 7
8 #include "remoting/proto/internal.pb.h" 8 #include "remoting/proto/internal.pb.h"
9 #include "remoting/protocol/client_stub.h" 9 #include "remoting/protocol/client_stub.h"
10 #include "remoting/protocol/connection_to_client.h" 10 #include "remoting/protocol/connection_to_client.h"
11 #include "remoting/protocol/host_stub.h" 11 #include "remoting/protocol/host_stub.h"
12 #include "remoting/protocol/input_stub.h" 12 #include "remoting/protocol/input_stub.h"
13 #include "remoting/protocol/session.h" 13 #include "remoting/protocol/session.h"
14 #include "remoting/protocol/video_stub.h" 14 #include "remoting/protocol/video_stub.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 16
17 namespace remoting { 17 namespace remoting {
18 namespace protocol { 18 namespace protocol {
19 19
20 class ChromotocolConnection; 20 class ChromotocolConnection;
21 21
22 class MockConnectionToClient : public ConnectionToClient { 22 class MockConnectionToClient : public ConnectionToClient {
23 public: 23 public:
24 MockConnectionToClient() {} 24 MockConnectionToClient();
25 virtual ~MockConnectionToClient();
25 26
26 MOCK_METHOD1(Init, void(Session* session)); 27 MOCK_METHOD1(Init, void(Session* session));
27 MOCK_METHOD0(video_stub, VideoStub*()); 28 MOCK_METHOD0(video_stub, VideoStub*());
28 MOCK_METHOD0(client_stub, ClientStub*()); 29 MOCK_METHOD0(client_stub, ClientStub*());
29 MOCK_METHOD0(session, Session*()); 30 MOCK_METHOD0(session, Session*());
30 MOCK_METHOD0(Disconnect, void()); 31 MOCK_METHOD0(Disconnect, void());
31 32
32 private: 33 private:
33 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClient); 34 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClient);
34 }; 35 };
35 36
36 class MockConnectionToClientEventHandler : 37 class MockConnectionToClientEventHandler :
37 public ConnectionToClient::EventHandler { 38 public ConnectionToClient::EventHandler {
38 public: 39 public:
39 MockConnectionToClientEventHandler() {} 40 MockConnectionToClientEventHandler();
41 virtual ~MockConnectionToClientEventHandler();
40 42
41 MOCK_METHOD1(OnConnectionOpened, void(ConnectionToClient* connection)); 43 MOCK_METHOD1(OnConnectionOpened, void(ConnectionToClient* connection));
42 MOCK_METHOD1(OnConnectionClosed, void(ConnectionToClient* connection)); 44 MOCK_METHOD1(OnConnectionClosed, void(ConnectionToClient* connection));
43 MOCK_METHOD1(OnConnectionFailed, void(ConnectionToClient* connection)); 45 MOCK_METHOD1(OnConnectionFailed, void(ConnectionToClient* connection));
44 46
45 private: 47 private:
46 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClientEventHandler); 48 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClientEventHandler);
47 }; 49 };
48 50
49 class MockInputStub : public InputStub { 51 class MockInputStub : public InputStub {
50 public: 52 public:
51 MockInputStub() {} 53 MockInputStub();
54 virtual ~MockInputStub();
52 55
53 MOCK_METHOD2(InjectKeyEvent, void(const KeyEvent* event, Task* done)); 56 MOCK_METHOD2(InjectKeyEvent, void(const KeyEvent* event, Task* done));
54 MOCK_METHOD2(InjectMouseEvent, void(const MouseEvent* event, Task* done)); 57 MOCK_METHOD2(InjectMouseEvent, void(const MouseEvent* event, Task* done));
55 58
56 private: 59 private:
57 DISALLOW_COPY_AND_ASSIGN(MockInputStub); 60 DISALLOW_COPY_AND_ASSIGN(MockInputStub);
58 }; 61 };
59 62
60 class MockHostStub : public HostStub { 63 class MockHostStub : public HostStub {
61 public: 64 public:
62 MockHostStub() {} 65 MockHostStub();
66 ~MockHostStub();
63 67
64 MOCK_METHOD2(SuggestResolution, void(const SuggestResolutionRequest* msg, 68 MOCK_METHOD2(SuggestResolution, void(const SuggestResolutionRequest* msg,
65 Task* done)); 69 Task* done));
66 MOCK_METHOD2(BeginSessionRequest, 70 MOCK_METHOD2(BeginSessionRequest,
67 void(const LocalLoginCredentials* credentials, Task* done)); 71 void(const LocalLoginCredentials* credentials, Task* done));
68 72
69 private: 73 private:
70 DISALLOW_COPY_AND_ASSIGN(MockHostStub); 74 DISALLOW_COPY_AND_ASSIGN(MockHostStub);
71 }; 75 };
72 76
73 class MockClientStub : public ClientStub { 77 class MockClientStub : public ClientStub {
74 public: 78 public:
75 MockClientStub() {} 79 MockClientStub();
80 virtual ~MockClientStub();
76 81
77 MOCK_METHOD2(NotifyResolution, void(const NotifyResolutionRequest* msg, 82 MOCK_METHOD2(NotifyResolution, void(const NotifyResolutionRequest* msg,
78 Task* done)); 83 Task* done));
79 MOCK_METHOD2(BeginSessionResponse, void(const LocalLoginStatus* msg, 84 MOCK_METHOD2(BeginSessionResponse, void(const LocalLoginStatus* msg,
80 Task* done)); 85 Task* done));
81 86
82 private: 87 private:
83 DISALLOW_COPY_AND_ASSIGN(MockClientStub); 88 DISALLOW_COPY_AND_ASSIGN(MockClientStub);
84 }; 89 };
85 90
86 class MockVideoStub : public VideoStub { 91 class MockVideoStub : public VideoStub {
87 public: 92 public:
88 MockVideoStub() {} 93 MockVideoStub();
94 virtual ~MockVideoStub();
89 95
90 MOCK_METHOD2(ProcessVideoPacket, void(const VideoPacket* video_packet, 96 MOCK_METHOD2(ProcessVideoPacket, void(const VideoPacket* video_packet,
91 Task* done)); 97 Task* done));
92 MOCK_METHOD0(GetPendingPackets, int()); 98 MOCK_METHOD0(GetPendingPackets, int());
93 99
94 private: 100 private:
95 DISALLOW_COPY_AND_ASSIGN(MockVideoStub); 101 DISALLOW_COPY_AND_ASSIGN(MockVideoStub);
96 }; 102 };
97 103
98 class MockSession : public Session { 104 class MockSession : public Session {
99 public: 105 public:
100 MockSession() {} 106 MockSession();
107 virtual ~MockSession();
101 108
102 MOCK_METHOD1(SetStateChangeCallback, void(StateChangeCallback* callback)); 109 MOCK_METHOD1(SetStateChangeCallback, void(StateChangeCallback* callback));
103 MOCK_METHOD0(control_channel, net::Socket*()); 110 MOCK_METHOD0(control_channel, net::Socket*());
104 MOCK_METHOD0(event_channel, net::Socket*()); 111 MOCK_METHOD0(event_channel, net::Socket*());
105 MOCK_METHOD0(video_channel, net::Socket*()); 112 MOCK_METHOD0(video_channel, net::Socket*());
106 MOCK_METHOD0(video_rtp_channel, net::Socket*()); 113 MOCK_METHOD0(video_rtp_channel, net::Socket*());
107 MOCK_METHOD0(video_rtcp_channel, net::Socket*()); 114 MOCK_METHOD0(video_rtcp_channel, net::Socket*());
108 MOCK_METHOD0(jid, const std::string&()); 115 MOCK_METHOD0(jid, const std::string&());
109 MOCK_METHOD0(message_loop, MessageLoop*()); 116 MOCK_METHOD0(message_loop, MessageLoop*());
110 MOCK_METHOD0(candidate_config, const CandidateSessionConfig*()); 117 MOCK_METHOD0(candidate_config, const CandidateSessionConfig*());
111 MOCK_METHOD0(config, const SessionConfig*()); 118 MOCK_METHOD0(config, const SessionConfig*());
112 MOCK_METHOD1(set_config, void(const SessionConfig* config)); 119 MOCK_METHOD1(set_config, void(const SessionConfig* config));
113 MOCK_METHOD0(initiator_token, const std::string&()); 120 MOCK_METHOD0(initiator_token, const std::string&());
114 MOCK_METHOD1(set_initiator_token, void(const std::string& initiator_token)); 121 MOCK_METHOD1(set_initiator_token, void(const std::string& initiator_token));
115 MOCK_METHOD0(receiver_token, const std::string&()); 122 MOCK_METHOD0(receiver_token, const std::string&());
116 MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token)); 123 MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token));
117 MOCK_METHOD1(Close, void(Task* closed_task)); 124 MOCK_METHOD1(Close, void(Task* closed_task));
118 125
119 private: 126 private:
120 DISALLOW_COPY_AND_ASSIGN(MockSession); 127 DISALLOW_COPY_AND_ASSIGN(MockSession);
121 }; 128 };
122 129
123 } // namespace protocol 130 } // namespace protocol
124 } // namespace remoting 131 } // namespace remoting
125 132
126 #endif // REMOTING_PROTOCOL_MOCK_OBJECTS_H_ 133 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698