diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 21:25:42 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 21:25:42 +0000 |
commit | 1e72daa1a67e0e1105e6e31a949e2628ab88eb34 (patch) | |
tree | a3ac2d965c14d6608ba76e8d9b4ccefdce7a3842 /remoting/protocol | |
parent | 519b5bf5aeed0f38179fb9b3271c8c3539f47cdc (diff) | |
download | chromium_src-1e72daa1a67e0e1105e6e31a949e2628ab88eb34.zip chromium_src-1e72daa1a67e0e1105e6e31a949e2628ab88eb34.tar.gz chromium_src-1e72daa1a67e0e1105e6e31a949e2628ab88eb34.tar.bz2 |
Resubmit "Fix crashes in ChromotingHost"
Simplified the test to run on the main message loop. Also fixed a possible memory
leak caught by valgrind.
BUG=70903
TEST=None
Review URL: http://codereview.chromium.org/6245016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73023 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r-- | remoting/protocol/connection_to_client.h | 10 | ||||
-rw-r--r-- | remoting/protocol/mock_objects.h | 31 |
2 files changed, 35 insertions, 6 deletions
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index 749ef5c..b7aa052 100644 --- a/remoting/protocol/connection_to_client.h +++ b/remoting/protocol/connection_to_client.h @@ -55,10 +55,10 @@ class ConnectionToClient : virtual ~ConnectionToClient(); - virtual void Init(protocol::Session* session); + virtual void Init(Session* session); // Returns the connection in use. - virtual protocol::Session* session(); + virtual Session* session(); // Disconnect the client connection. This method is allowed to be called // more than once and calls after the first one will be ignored. @@ -78,15 +78,15 @@ class ConnectionToClient : private: // Callback for protocol Session. - void OnSessionStateChange(protocol::Session::State state); + void OnSessionStateChange(Session::State state); // Process a libjingle state change event on the |loop_|. - void StateChangeTask(protocol::Session::State state); + void StateChangeTask(Session::State state); void OnClosed(); // The libjingle channel used to send and receive data from the remote client. - scoped_refptr<protocol::Session> session_; + scoped_refptr<Session> session_; scoped_ptr<VideoWriter> video_writer_; diff --git a/remoting/protocol/mock_objects.h b/remoting/protocol/mock_objects.h index 045a414..99826c2 100644 --- a/remoting/protocol/mock_objects.h +++ b/remoting/protocol/mock_objects.h @@ -6,9 +6,11 @@ #define REMOTING_PROTOCOL_MOCK_OBJECTS_H_ #include "remoting/proto/internal.pb.h" +#include "remoting/protocol/client_stub.h" #include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/host_stub.h" #include "remoting/protocol/input_stub.h" +#include "remoting/protocol/session.h" #include "remoting/protocol/video_stub.h" #include "testing/gmock/include/gmock/gmock.h" @@ -21,8 +23,10 @@ class MockConnectionToClient : public ConnectionToClient { public: MockConnectionToClient() {} - MOCK_METHOD1(Init, void(ChromotocolConnection* connection)); + MOCK_METHOD1(Init, void(Session* session)); MOCK_METHOD0(video_stub, VideoStub*()); + MOCK_METHOD0(client_stub, ClientStub*()); + MOCK_METHOD0(session, Session*()); MOCK_METHOD0(Disconnect, void()); private: @@ -78,6 +82,31 @@ class MockVideoStub : public VideoStub { DISALLOW_COPY_AND_ASSIGN(MockVideoStub); }; +class MockSession : public Session { + public: + MockSession() {} + + MOCK_METHOD1(SetStateChangeCallback, void(StateChangeCallback* callback)); + MOCK_METHOD0(control_channel, net::Socket*()); + MOCK_METHOD0(event_channel, net::Socket*()); + MOCK_METHOD0(video_channel, net::Socket*()); + MOCK_METHOD0(video_rtp_channel, net::Socket*()); + MOCK_METHOD0(video_rtcp_channel, net::Socket*()); + MOCK_METHOD0(jid, const std::string&()); + MOCK_METHOD0(message_loop, MessageLoop*()); + MOCK_METHOD0(candidate_config, const CandidateSessionConfig*()); + MOCK_METHOD0(config, const SessionConfig*()); + MOCK_METHOD1(set_config, void(const SessionConfig* config)); + MOCK_METHOD0(initiator_token, const std::string&()); + MOCK_METHOD1(set_initiator_token, void(const std::string& initiator_token)); + MOCK_METHOD0(receiver_token, const std::string&()); + MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token)); + MOCK_METHOD1(Close, void(Task* closed_task)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockSession); +}; + } // namespace protocol } // namespace remoting |