| 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::AUTHENTICATED); |
| 40 message_loop_.RunAllPending(); | 42 message_loop_.RunAllPending(); |
| 41 } | 43 } |
| 42 | 44 |
| 43 virtual void TearDown() OVERRIDE { | 45 virtual void TearDown() OVERRIDE { |
| 44 viewer_.reset(); | 46 viewer_.reset(); |
| 45 message_loop_.RunAllPending(); | 47 message_loop_.RunAllPending(); |
| 46 } | 48 } |
| 47 | 49 |
| 48 MessageLoop message_loop_; | 50 MessageLoop message_loop_; |
| 49 MockConnectionToClientEventHandler handler_; | 51 MockConnectionToClientEventHandler handler_; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 102 |
| 101 EXPECT_CALL(handler_, OnConnectionFailed( | 103 EXPECT_CALL(handler_, OnConnectionFailed( |
| 102 viewer_.get(), Session::SESSION_REJECTED)); | 104 viewer_.get(), Session::SESSION_REJECTED)); |
| 103 session_->set_error(Session::SESSION_REJECTED); | 105 session_->set_error(Session::SESSION_REJECTED); |
| 104 session_->state_change_callback().Run(protocol::Session::FAILED); | 106 session_->state_change_callback().Run(protocol::Session::FAILED); |
| 105 message_loop_.RunAllPending(); | 107 message_loop_.RunAllPending(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 } // namespace protocol | 110 } // namespace protocol |
| 109 } // namespace remoting | 111 } // namespace remoting |
| OLD | NEW |