| 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 "blimp/net/engine_connection_manager.h" | 5 #include "blimp/net/engine_connection_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 namespace blimp { | 32 namespace blimp { |
| 33 | 33 |
| 34 class EngineConnectionManagerTest : public testing::Test { | 34 class EngineConnectionManagerTest : public testing::Test { |
| 35 public: | 35 public: |
| 36 EngineConnectionManagerTest() | 36 EngineConnectionManagerTest() |
| 37 : manager_(new EngineConnectionManager(&connection_handler_)) {} | 37 : manager_(new EngineConnectionManager(&connection_handler_)) {} |
| 38 | 38 |
| 39 ~EngineConnectionManagerTest() override {} | 39 ~EngineConnectionManagerTest() override {} |
| 40 | 40 |
| 41 std::unique_ptr<BlimpConnection> CreateConnection() { | 41 std::unique_ptr<BlimpConnection> CreateConnection() { |
| 42 return base::WrapUnique( | 42 return base::MakeUnique<BlimpConnection>( |
| 43 new BlimpConnection(base::WrapUnique(new MockPacketReader), | 43 base::WrapUnique(new MockPacketReader), |
| 44 base::WrapUnique(new MockPacketWriter))); | 44 base::WrapUnique(new MockPacketWriter)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 base::MessageLoopForIO message_loop_; | 48 base::MessageLoopForIO message_loop_; |
| 49 testing::StrictMock<MockConnectionHandler> connection_handler_; | 49 testing::StrictMock<MockConnectionHandler> connection_handler_; |
| 50 std::unique_ptr<EngineConnectionManager> manager_; | 50 std::unique_ptr<EngineConnectionManager> manager_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 TEST_F(EngineConnectionManagerTest, ConnectionSucceeds) { | 53 TEST_F(EngineConnectionManagerTest, ConnectionSucceeds) { |
| 54 std::unique_ptr<testing::StrictMock<MockTransport>> transport1( | 54 std::unique_ptr<testing::StrictMock<MockTransport>> transport1( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 manager_->AddTransport(std::move(transport2)); | 82 manager_->AddTransport(std::move(transport2)); |
| 83 ASSERT_FALSE(connect_cb_2.is_null()); | 83 ASSERT_FALSE(connect_cb_2.is_null()); |
| 84 | 84 |
| 85 base::ResetAndReturn(&connect_cb_1).Run(net::OK); | 85 base::ResetAndReturn(&connect_cb_1).Run(net::OK); |
| 86 base::ResetAndReturn(&connect_cb_2).Run(net::OK); | 86 base::ResetAndReturn(&connect_cb_2).Run(net::OK); |
| 87 ASSERT_FALSE(connect_cb_1.is_null()); | 87 ASSERT_FALSE(connect_cb_1.is_null()); |
| 88 ASSERT_FALSE(connect_cb_2.is_null()); | 88 ASSERT_FALSE(connect_cb_2.is_null()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace blimp | 91 } // namespace blimp |
| OLD | NEW |