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

Side by Side Diff: remoting/protocol/connection_to_client_unittest.cc

Issue 4726003: Implement InputStub in the host side for chromoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "remoting/base/mock_objects.h" 6 #include "remoting/base/mock_objects.h"
7 #include "remoting/protocol/fake_session.h" 7 #include "remoting/protocol/fake_session.h"
8 #include "remoting/protocol/connection_to_client.h" 8 #include "remoting/protocol/connection_to_client.h"
9 #include "remoting/protocol/mock_objects.h" 9 #include "remoting/protocol/mock_objects.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 11
12 using ::testing::_; 12 using ::testing::_;
13 using ::testing::NotNull; 13 using ::testing::NotNull;
14 using ::testing::StrictMock; 14 using ::testing::StrictMock;
15 15
16 namespace remoting { 16 namespace remoting {
17 namespace protocol { 17 namespace protocol {
18 18
19 class ConnectionToClientTest : public testing::Test { 19 class ConnectionToClientTest : public testing::Test {
20 public: 20 public:
21 ConnectionToClientTest() { 21 ConnectionToClientTest() {
22 } 22 }
23 23
24 protected: 24 protected:
25 virtual void SetUp() { 25 virtual void SetUp() {
26 session_ = new protocol::FakeSession(); 26 session_ = new protocol::FakeSession();
27 session_->set_message_loop(&message_loop_); 27 session_->set_message_loop(&message_loop_);
28 28
29 // Allocate a ClientConnection object with the mock objects. 29 // Allocate a ClientConnection object with the mock objects.
30 viewer_ = new ConnectionToClient(&message_loop_, &handler_); 30 viewer_ = new ConnectionToClient(&message_loop_, &handler_,
31 &host_stub_, &input_stub_);
31 viewer_->Init(session_); 32 viewer_->Init(session_);
32 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); 33 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get()));
33 session_->state_change_callback()->Run( 34 session_->state_change_callback()->Run(
34 protocol::Session::CONNECTED); 35 protocol::Session::CONNECTED);
35 message_loop_.RunAllPending(); 36 message_loop_.RunAllPending();
36 } 37 }
37 38
38 MessageLoop message_loop_; 39 MessageLoop message_loop_;
39 MockConnectionToClientEventHandler handler_; 40 MockConnectionToClientEventHandler handler_;
41 MockHostStub host_stub_;
42 MockInputStub input_stub_;
40 scoped_refptr<ConnectionToClient> viewer_; 43 scoped_refptr<ConnectionToClient> viewer_;
41 44
42 scoped_refptr<protocol::FakeSession> session_; 45 scoped_refptr<protocol::FakeSession> session_;
43 46
44 private: 47 private:
45 DISALLOW_COPY_AND_ASSIGN(ConnectionToClientTest); 48 DISALLOW_COPY_AND_ASSIGN(ConnectionToClientTest);
46 }; 49 };
47 50
48 TEST_F(ConnectionToClientTest, SendUpdateStream) { 51 TEST_F(ConnectionToClientTest, SendUpdateStream) {
49 // Then send the actual data. 52 // Then send the actual data.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 viewer_->SendVideoPacket(packet); 84 viewer_->SendVideoPacket(packet);
82 viewer_->Disconnect(); 85 viewer_->Disconnect();
83 message_loop_.RunAllPending(); 86 message_loop_.RunAllPending();
84 87
85 // Verify that nothing has been written. 88 // Verify that nothing has been written.
86 EXPECT_EQ(session_->video_channel()->written_data().size(), 0u); 89 EXPECT_EQ(session_->video_channel()->written_data().size(), 0u);
87 } 90 }
88 91
89 } // namespace protocol 92 } // namespace protocol
90 } // namespace remoting 93 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698