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/signaling/xmpp_signal_strategy.h" | 5 #include "remoting/signaling/xmpp_signal_strategy.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <utility> | 8 #include <utility> |
| 9 #include <vector> |
8 | 10 |
9 #include "base/base64.h" | 11 #include "base/base64.h" |
10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
11 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
13 #include "net/socket/socket_test_util.h" | 15 #include "net/socket/socket_test_util.h" |
14 #include "net/url_request/url_request_test_util.h" | 16 #include "net/url_request/url_request_test_util.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" | 18 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
17 | 19 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 155 |
154 protected: | 156 protected: |
155 base::MessageLoop message_loop_; | 157 base::MessageLoop message_loop_; |
156 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 158 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
157 MockClientSocketFactory client_socket_factory_; | 159 MockClientSocketFactory client_socket_factory_; |
158 std::unique_ptr<XmppSocketDataProvider> socket_data_provider_; | 160 std::unique_ptr<XmppSocketDataProvider> socket_data_provider_; |
159 std::unique_ptr<net::SSLSocketDataProvider> ssl_socket_data_provider_; | 161 std::unique_ptr<net::SSLSocketDataProvider> ssl_socket_data_provider_; |
160 std::unique_ptr<XmppSignalStrategy> signal_strategy_; | 162 std::unique_ptr<XmppSignalStrategy> signal_strategy_; |
161 | 163 |
162 std::vector<SignalStrategy::State> state_history_; | 164 std::vector<SignalStrategy::State> state_history_; |
163 ScopedVector<buzz::XmlElement> received_messages_; | 165 std::vector<std::unique_ptr<buzz::XmlElement>> received_messages_; |
164 }; | 166 }; |
165 | 167 |
166 void XmppSignalStrategyTest::Connect(bool success) { | 168 void XmppSignalStrategyTest::Connect(bool success) { |
167 EXPECT_EQ(SignalStrategy::DISCONNECTED, signal_strategy_->GetState()); | 169 EXPECT_EQ(SignalStrategy::DISCONNECTED, signal_strategy_->GetState()); |
168 state_history_.clear(); | 170 state_history_.clear(); |
169 | 171 |
170 socket_data_provider_.reset(new XmppSocketDataProvider()); | 172 socket_data_provider_.reset(new XmppSocketDataProvider()); |
171 socket_data_provider_->set_connect_data( | 173 socket_data_provider_->set_connect_data( |
172 net::MockConnect(net::ASYNC, net::OK)); | 174 net::MockConnect(net::ASYNC, net::OK)); |
173 client_socket_factory_.AddSocketDataProvider(socket_data_provider_.get()); | 175 client_socket_factory_.AddSocketDataProvider(socket_data_provider_.get()); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 "<proceed xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>"); | 375 "<proceed xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>"); |
374 | 376 |
375 // Verify that SSL is connected only after write is finished. | 377 // Verify that SSL is connected only after write is finished. |
376 EXPECT_FALSE(client_socket_factory_.ssl_socket_created()); | 378 EXPECT_FALSE(client_socket_factory_.ssl_socket_created()); |
377 socket_data_provider_->CompletePendingWrite(); | 379 socket_data_provider_->CompletePendingWrite(); |
378 EXPECT_TRUE(client_socket_factory_.ssl_socket_created()); | 380 EXPECT_TRUE(client_socket_factory_.ssl_socket_created()); |
379 } | 381 } |
380 | 382 |
381 | 383 |
382 } // namespace remoting | 384 } // namespace remoting |
OLD | NEW |