Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: remoting/signaling/xmpp_signal_strategy_unittest.cc

Issue 1545723002: Use std::move() instead of .Pass() in remoting/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_host
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility>
8
7 #include "base/base64.h" 9 #include "base/base64.h"
8 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 11 #include "base/run_loop.h"
10 #include "net/socket/socket_test_util.h" 12 #include "net/socket/socket_test_util.h"
11 #include "net/url_request/url_request_test_util.h" 13 #include "net/url_request/url_request_test_util.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
14 16
15 namespace remoting { 17 namespace remoting {
16 18
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 89
88 class MockClientSocketFactory : public net::MockClientSocketFactory { 90 class MockClientSocketFactory : public net::MockClientSocketFactory {
89 public: 91 public:
90 scoped_ptr<net::SSLClientSocket> CreateSSLClientSocket( 92 scoped_ptr<net::SSLClientSocket> CreateSSLClientSocket(
91 scoped_ptr<net::ClientSocketHandle> transport_socket, 93 scoped_ptr<net::ClientSocketHandle> transport_socket,
92 const net::HostPortPair& host_and_port, 94 const net::HostPortPair& host_and_port,
93 const net::SSLConfig& ssl_config, 95 const net::SSLConfig& ssl_config,
94 const net::SSLClientSocketContext& context) override { 96 const net::SSLClientSocketContext& context) override {
95 ssl_socket_created_ = true; 97 ssl_socket_created_ = true;
96 return net::MockClientSocketFactory::CreateSSLClientSocket( 98 return net::MockClientSocketFactory::CreateSSLClientSocket(
97 transport_socket.Pass(), host_and_port, ssl_config, context); 99 std::move(transport_socket), host_and_port, ssl_config, context);
98 } 100 }
99 101
100 bool ssl_socket_created() const { return ssl_socket_created_; } 102 bool ssl_socket_created() const { return ssl_socket_created_; }
101 103
102 private: 104 private:
103 bool ssl_socket_created_ = false; 105 bool ssl_socket_created_ = false;
104 }; 106 };
105 107
106 } // namespace 108 } // namespace
107 109
108 const char kTestUsername[] = "test_username@example.com"; 110 const char kTestUsername[] = "test_username@example.com";
109 const char kTestAuthToken[] = "test_auth_token"; 111 const char kTestAuthToken[] = "test_auth_token";
110 const int kDefaultPort = 443; 112 const int kDefaultPort = 443;
111 113
112 class XmppSignalStrategyTest : public testing::Test, 114 class XmppSignalStrategyTest : public testing::Test,
113 public SignalStrategy::Listener { 115 public SignalStrategy::Listener {
114 public: 116 public:
115 XmppSignalStrategyTest() : message_loop_(base::MessageLoop::TYPE_IO) {} 117 XmppSignalStrategyTest() : message_loop_(base::MessageLoop::TYPE_IO) {}
116 118
117 void SetUp() override { 119 void SetUp() override {
118 scoped_ptr<net::TestURLRequestContext> context(
119 new net::TestURLRequestContext());
120 request_context_getter_ = new net::TestURLRequestContextGetter( 120 request_context_getter_ = new net::TestURLRequestContextGetter(
121 message_loop_.task_runner(), context.Pass()); 121 message_loop_.task_runner(),
122 make_scoped_ptr(new net::TestURLRequestContext()));
122 } 123 }
123 124
124 void CreateSignalStrategy(int port) { 125 void CreateSignalStrategy(int port) {
125 XmppSignalStrategy::XmppServerConfig config; 126 XmppSignalStrategy::XmppServerConfig config;
126 config.host = "talk.google.com"; 127 config.host = "talk.google.com";
127 config.port = port; 128 config.port = port;
128 config.username = kTestUsername; 129 config.username = kTestUsername;
129 config.auth_token = kTestAuthToken; 130 config.auth_token = kTestAuthToken;
130 signal_strategy_.reset(new XmppSignalStrategy( 131 signal_strategy_.reset(new XmppSignalStrategy(
131 &client_socket_factory_, request_context_getter_, config)); 132 &client_socket_factory_, request_context_getter_, config));
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 "<proceed xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>"); 373 "<proceed xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>");
373 374
374 // Verify that SSL is connected only after write is finished. 375 // Verify that SSL is connected only after write is finished.
375 EXPECT_FALSE(client_socket_factory_.ssl_socket_created()); 376 EXPECT_FALSE(client_socket_factory_.ssl_socket_created());
376 socket_data_provider_->CompletePendingWrite(); 377 socket_data_provider_->CompletePendingWrite();
377 EXPECT_TRUE(client_socket_factory_.ssl_socket_created()); 378 EXPECT_TRUE(client_socket_factory_.ssl_socket_created());
378 } 379 }
379 380
380 381
381 } // namespace remoting 382 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/signaling/xmpp_signal_strategy.cc ('k') | remoting/signaling/xmpp_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698