| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "remoting/protocol/fake_connection_to_host.h" | 8 #include "remoting/protocol/fake_connection_to_host.h" |
| 9 #include "remoting/test/connection_setup_info.h" | 9 #include "remoting/test/connection_setup_info.h" |
| 10 #include "remoting/test/test_chromoting_client.h" | 10 #include "remoting/test/test_chromoting_client.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 protocol::AuthenticationMethod::ThirdParty()); | 84 protocol::AuthenticationMethod::ThirdParty()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void TestChromotingClientTest::TearDown() { | 87 void TestChromotingClientTest::TearDown() { |
| 88 test_chromoting_client_->RemoveRemoteConnectionObserver(this); | 88 test_chromoting_client_->RemoveRemoteConnectionObserver(this); |
| 89 fake_connection_to_host_ = nullptr; | 89 fake_connection_to_host_ = nullptr; |
| 90 | 90 |
| 91 // The chromoting instance must be destroyed before the message loop. | 91 // The chromoting instance must be destroyed before the message loop. |
| 92 test_chromoting_client_.reset(); | 92 test_chromoting_client_.reset(); |
| 93 | 93 |
| 94 // The LibjingleTransportFactory destroys the PortAllocator via a DeleteSoon | 94 // The IceTransportFactory destroys the PortAllocator via a DeleteSoon |
| 95 // operation. If we do not allow the message loop to run here, we run the | 95 // operation. If we do not allow the message loop to run here, we run the |
| 96 // risk of the DeleteSoon task being dropped and incurring a memory leak. | 96 // risk of the DeleteSoon task being dropped and incurring a memory leak. |
| 97 message_loop_.RunUntilIdle(); | 97 message_loop_.RunUntilIdle(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void TestChromotingClientTest::ConnectionStateChanged( | 100 void TestChromotingClientTest::ConnectionStateChanged( |
| 101 protocol::ConnectionToHost::State state, | 101 protocol::ConnectionToHost::State state, |
| 102 protocol::ErrorCode error_code) { | 102 protocol::ErrorCode error_code) { |
| 103 connection_state_ = state; | 103 connection_state_ = state; |
| 104 error_code_ = error_code; | 104 error_code_ = error_code; |
| 105 | 105 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Close the connection via the TestChromotingClient and verify the error | 203 // Close the connection via the TestChromotingClient and verify the error |
| 204 // state is persisted. | 204 // state is persisted. |
| 205 test_chromoting_client_->EndConnection(); | 205 test_chromoting_client_->EndConnection(); |
| 206 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); | 206 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); |
| 207 EXPECT_EQ(protocol::ErrorCode::UNKNOWN_ERROR, error_code_); | 207 EXPECT_EQ(protocol::ErrorCode::UNKNOWN_ERROR, error_code_); |
| 208 EXPECT_FALSE(is_connected_to_host_); | 208 EXPECT_FALSE(is_connected_to_host_); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace test | 211 } // namespace test |
| 212 } // namespace remoting | 212 } // namespace remoting |
| OLD | NEW |