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

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

Issue 8476018: Move ConnectionToClient::EventHandler from ChromotingHost to ClientSession (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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) 2011 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "remoting/base/base_mock_objects.h" 8 #include "remoting/base/base_mock_objects.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/protocol/fake_session.h" 10 #include "remoting/protocol/fake_session.h"
(...skipping 13 matching lines...) Expand all
24 ConnectionToClientTest() { 24 ConnectionToClientTest() {
25 } 25 }
26 26
27 protected: 27 protected:
28 virtual void SetUp() { 28 virtual void SetUp() {
29 session_ = new protocol::FakeSession(); 29 session_ = new protocol::FakeSession();
30 session_->set_message_loop(&message_loop_); 30 session_->set_message_loop(&message_loop_);
31 31
32 // Allocate a ClientConnection object with the mock objects. 32 // Allocate a ClientConnection object with the mock objects.
33 viewer_ = new ConnectionToClient( 33 viewer_ = new ConnectionToClient(
34 base::MessageLoopProxy::current(), &handler_); 34 base::MessageLoopProxy::current(), session_);
35 viewer_->set_host_stub(&host_stub_); 35 viewer_->set_host_stub(&host_stub_);
36 viewer_->set_input_stub(&input_stub_); 36 viewer_->set_input_stub(&input_stub_);
37 viewer_->Init(session_); 37 viewer_->SetEventHandler(&handler_);
38 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); 38 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get()));
39 session_->state_change_callback().Run( 39 session_->state_change_callback().Run(
40 protocol::Session::CONNECTED); 40 protocol::Session::CONNECTED);
41 session_->state_change_callback().Run( 41 session_->state_change_callback().Run(
42 protocol::Session::CONNECTED_CHANNELS); 42 protocol::Session::CONNECTED_CHANNELS);
43 message_loop_.RunAllPending(); 43 message_loop_.RunAllPending();
44 } 44 }
45 45
46 MessageLoop message_loop_; 46 MessageLoop message_loop_;
47 MockConnectionToClientEventHandler handler_; 47 MockConnectionToClientEventHandler handler_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Test that we can close client connection more than once. 104 // Test that we can close client connection more than once.
105 TEST_F(ConnectionToClientTest, Close) { 105 TEST_F(ConnectionToClientTest, Close) {
106 viewer_->Disconnect(); 106 viewer_->Disconnect();
107 message_loop_.RunAllPending(); 107 message_loop_.RunAllPending();
108 viewer_->Disconnect(); 108 viewer_->Disconnect();
109 message_loop_.RunAllPending(); 109 message_loop_.RunAllPending();
110 } 110 }
111 111
112 } // namespace protocol 112 } // namespace protocol
113 } // namespace remoting 113 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698