| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 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_.reset(new ConnectionToClient(session_)); | 33 viewer_.reset(new ConnectionToClient(session_)); |
| 34 viewer_->set_host_stub(&host_stub_); | 34 viewer_->set_host_stub(&host_stub_); |
| 35 viewer_->set_input_stub(&input_stub_); | 35 viewer_->set_input_stub(&input_stub_); |
| 36 viewer_->SetEventHandler(&handler_); | 36 viewer_->SetEventHandler(&handler_); |
| 37 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); | 37 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); |
| 38 session_->state_change_callback().Run( | 38 session_->state_change_callback().Run( |
| 39 protocol::Session::CONNECTED); | 39 protocol::Session::CONNECTED); |
| 40 session_->state_change_callback().Run( | |
| 41 protocol::Session::CONNECTED_CHANNELS); | |
| 42 message_loop_.RunAllPending(); | 40 message_loop_.RunAllPending(); |
| 43 } | 41 } |
| 44 | 42 |
| 45 virtual void TearDown() OVERRIDE { | 43 virtual void TearDown() OVERRIDE { |
| 46 viewer_.reset(); | 44 viewer_.reset(); |
| 47 message_loop_.RunAllPending(); | 45 message_loop_.RunAllPending(); |
| 48 } | 46 } |
| 49 | 47 |
| 50 MessageLoop message_loop_; | 48 MessageLoop message_loop_; |
| 51 MockConnectionToClientEventHandler handler_; | 49 MockConnectionToClientEventHandler handler_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 session_->state_change_callback().Run(protocol::Session::CLOSED); | 98 session_->state_change_callback().Run(protocol::Session::CLOSED); |
| 101 message_loop_.RunAllPending(); | 99 message_loop_.RunAllPending(); |
| 102 | 100 |
| 103 EXPECT_CALL(handler_, OnConnectionFailed(viewer_.get())); | 101 EXPECT_CALL(handler_, OnConnectionFailed(viewer_.get())); |
| 104 session_->state_change_callback().Run(protocol::Session::FAILED); | 102 session_->state_change_callback().Run(protocol::Session::FAILED); |
| 105 message_loop_.RunAllPending(); | 103 message_loop_.RunAllPending(); |
| 106 } | 104 } |
| 107 | 105 |
| 108 } // namespace protocol | 106 } // namespace protocol |
| 109 } // namespace remoting | 107 } // namespace remoting |
| OLD | NEW |