Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <cstdint> | 8 #include <cstdint> |
| 9 #include <deque> | |
| 9 #include <map> | 10 #include <map> |
| 10 #include <memory> | 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 19 #include "remoting/proto/internal.pb.h" | 20 #include "remoting/proto/internal.pb.h" |
| 20 #include "remoting/proto/video.pb.h" | 21 #include "remoting/proto/video.pb.h" |
| 21 #include "remoting/protocol/authenticator.h" | 22 #include "remoting/protocol/authenticator.h" |
| 22 #include "remoting/protocol/channel_authenticator.h" | 23 #include "remoting/protocol/channel_authenticator.h" |
| 23 #include "remoting/protocol/client_stub.h" | 24 #include "remoting/protocol/client_stub.h" |
| 24 #include "remoting/protocol/clipboard_stub.h" | 25 #include "remoting/protocol/clipboard_stub.h" |
| 25 #include "remoting/protocol/connection_to_client.h" | 26 #include "remoting/protocol/connection_to_client.h" |
| 26 #include "remoting/protocol/host_stub.h" | 27 #include "remoting/protocol/host_stub.h" |
| 27 #include "remoting/protocol/input_stub.h" | 28 #include "remoting/protocol/input_stub.h" |
| 29 #include "remoting/protocol/jingle_messages.h" | |
| 28 #include "remoting/protocol/pairing_registry.h" | 30 #include "remoting/protocol/pairing_registry.h" |
| 29 #include "remoting/protocol/session.h" | 31 #include "remoting/protocol/session.h" |
| 30 #include "remoting/protocol/session_manager.h" | 32 #include "remoting/protocol/session_manager.h" |
| 31 #include "remoting/protocol/transport.h" | 33 #include "remoting/protocol/transport.h" |
| 32 #include "remoting/protocol/video_stub.h" | 34 #include "remoting/protocol/video_stub.h" |
| 33 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
| 34 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" | 36 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
| 35 | 37 |
| 36 namespace remoting { | 38 namespace remoting { |
| 37 | 39 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 public: | 198 public: |
| 197 MockSession(); | 199 MockSession(); |
| 198 ~MockSession() override; | 200 ~MockSession() override; |
| 199 | 201 |
| 200 MOCK_METHOD1(SetEventHandler, void(Session::EventHandler* event_handler)); | 202 MOCK_METHOD1(SetEventHandler, void(Session::EventHandler* event_handler)); |
| 201 MOCK_METHOD0(error, ErrorCode()); | 203 MOCK_METHOD0(error, ErrorCode()); |
| 202 MOCK_METHOD1(SetTransport, void(Transport*)); | 204 MOCK_METHOD1(SetTransport, void(Transport*)); |
| 203 MOCK_METHOD0(jid, const std::string&()); | 205 MOCK_METHOD0(jid, const std::string&()); |
| 204 MOCK_METHOD0(config, const SessionConfig&()); | 206 MOCK_METHOD0(config, const SessionConfig&()); |
| 205 MOCK_METHOD1(Close, void(ErrorCode error)); | 207 MOCK_METHOD1(Close, void(ErrorCode error)); |
| 206 MOCK_METHOD1(AddPlugin, void(SessionPlugin* plugin)); | 208 |
| 209 // Sends |attachments_| to the |plugin|->OnIncomingMessage(). | |
| 210 void AddPlugin(SessionPlugin* plugin) override; | |
| 211 | |
| 212 // Adds an |attachment| to |round|, which will be sent to plugins added by | |
| 213 // AddPlugin() function. | |
| 214 void SetAttachment(size_t round, | |
|
Sergey Ulanov
2017/01/07 01:23:09
It's better to avoid mixing non-GMock code into Mo
Hzj_jie
2017/01/08 23:48:49
Done.
| |
| 215 std::unique_ptr<buzz::XmlElement> attachment); | |
| 207 | 216 |
| 208 private: | 217 private: |
| 218 std::deque<JingleMessage> attachments_; | |
| 209 DISALLOW_COPY_AND_ASSIGN(MockSession); | 219 DISALLOW_COPY_AND_ASSIGN(MockSession); |
| 210 }; | 220 }; |
| 211 | 221 |
| 212 class MockSessionManager : public SessionManager { | 222 class MockSessionManager : public SessionManager { |
| 213 public: | 223 public: |
| 214 MockSessionManager(); | 224 MockSessionManager(); |
| 215 ~MockSessionManager() override; | 225 ~MockSessionManager() override; |
| 216 | 226 |
| 217 MOCK_METHOD1(AcceptIncoming, void(const IncomingSessionCallback&)); | 227 MOCK_METHOD1(AcceptIncoming, void(const IncomingSessionCallback&)); |
| 218 void set_protocol_config( | 228 void set_protocol_config( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 // Runs tasks synchronously instead of posting them to |task_runner|. | 276 // Runs tasks synchronously instead of posting them to |task_runner|. |
| 267 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 277 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 268 const tracked_objects::Location& from_here, | 278 const tracked_objects::Location& from_here, |
| 269 const base::Closure& task) override; | 279 const base::Closure& task) override; |
| 270 }; | 280 }; |
| 271 | 281 |
| 272 } // namespace protocol | 282 } // namespace protocol |
| 273 } // namespace remoting | 283 } // namespace remoting |
| 274 | 284 |
| 275 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 285 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
| OLD | NEW |