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 "remoting/test/test_chromoting_client.h" | 5 #include "remoting/test/test_chromoting_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 TestChromotingClientTest::~TestChromotingClientTest() {} | 61 TestChromotingClientTest::~TestChromotingClientTest() {} |
62 | 62 |
63 void TestChromotingClientTest::SetUp() { | 63 void TestChromotingClientTest::SetUp() { |
64 test_chromoting_client_.reset(new TestChromotingClient()); | 64 test_chromoting_client_.reset(new TestChromotingClient()); |
65 test_chromoting_client_->AddRemoteConnectionObserver(this); | 65 test_chromoting_client_->AddRemoteConnectionObserver(this); |
66 | 66 |
67 // Pass ownership of the FakeConnectionToHost to the chromoting instance but | 67 // Pass ownership of the FakeConnectionToHost to the chromoting instance but |
68 // keep the ptr around so we can use it to simulate state changes. It will | 68 // keep the ptr around so we can use it to simulate state changes. It will |
69 // remain valid until |test_chromoting_client_| is destroyed. | 69 // remain valid until |test_chromoting_client_| is destroyed. |
70 fake_connection_to_host_ = new FakeConnectionToHost(); | 70 fake_connection_to_host_ = new FakeConnectionToHost(); |
71 test_chromoting_client_->SetSignalStrategyForTests(base::WrapUnique( | 71 test_chromoting_client_->SetSignalStrategyForTests( |
72 new FakeSignalStrategy("test_user@faux_address.com/123"))); | 72 base::MakeUnique<FakeSignalStrategy>("test_user@faux_address.com/123")); |
73 test_chromoting_client_->SetConnectionToHostForTests( | 73 test_chromoting_client_->SetConnectionToHostForTests( |
74 base::WrapUnique(fake_connection_to_host_)); | 74 base::WrapUnique(fake_connection_to_host_)); |
75 | 75 |
76 connection_setup_info_.host_jid = "test_host@faux_address.com/321"; | 76 connection_setup_info_.host_jid = "test_host@faux_address.com/321"; |
77 } | 77 } |
78 | 78 |
79 void TestChromotingClientTest::TearDown() { | 79 void TestChromotingClientTest::TearDown() { |
80 test_chromoting_client_->RemoveRemoteConnectionObserver(this); | 80 test_chromoting_client_->RemoveRemoteConnectionObserver(this); |
81 fake_connection_to_host_ = nullptr; | 81 fake_connection_to_host_ = nullptr; |
82 | 82 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Close the connection via the TestChromotingClient and verify the error | 195 // Close the connection via the TestChromotingClient and verify the error |
196 // state is persisted. | 196 // state is persisted. |
197 test_chromoting_client_->EndConnection(); | 197 test_chromoting_client_->EndConnection(); |
198 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); | 198 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); |
199 EXPECT_EQ(protocol::ErrorCode::UNKNOWN_ERROR, error_code_); | 199 EXPECT_EQ(protocol::ErrorCode::UNKNOWN_ERROR, error_code_); |
200 EXPECT_FALSE(is_connected_to_host_); | 200 EXPECT_FALSE(is_connected_to_host_); |
201 } | 201 } |
202 | 202 |
203 } // namespace test | 203 } // namespace test |
204 } // namespace remoting | 204 } // namespace remoting |
OLD | NEW |