OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 public: | 50 public: |
51 GnubbyAuthHandlerLinuxTest() | 51 GnubbyAuthHandlerLinuxTest() |
52 : run_loop_(new base::RunLoop()), last_connection_id_received_(-1) { | 52 : run_loop_(new base::RunLoop()), last_connection_id_received_(-1) { |
53 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 53 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
54 socket_path_ = temp_dir_.path().Append(kSocketFilename); | 54 socket_path_ = temp_dir_.path().Append(kSocketFilename); |
55 remoting::GnubbyAuthHandler::SetGnubbySocketName(socket_path_); | 55 remoting::GnubbyAuthHandler::SetGnubbySocketName(socket_path_); |
56 | 56 |
57 send_message_callback_ = | 57 send_message_callback_ = |
58 base::Bind(&GnubbyAuthHandlerLinuxTest::SendMessageToClient, | 58 base::Bind(&GnubbyAuthHandlerLinuxTest::SendMessageToClient, |
59 base::Unretained(this)); | 59 base::Unretained(this)); |
60 auth_handler_ = remoting::GnubbyAuthHandler::Create(send_message_callback_); | 60 auth_handler_ = |
| 61 remoting::GnubbyAuthHandler::Create(nullptr, send_message_callback_); |
61 } | 62 } |
62 | 63 |
63 void WaitForSendMessageToClient() { | 64 void WaitForSendMessageToClient() { |
64 run_loop_->Run(); | 65 run_loop_->Run(); |
65 run_loop_.reset(new base::RunLoop); | 66 run_loop_.reset(new base::RunLoop); |
66 } | 67 } |
67 | 68 |
68 void SendMessageToClient(int connection_id, const std::string& data) { | 69 void SendMessageToClient(int connection_id, const std::string& data) { |
69 last_connection_id_received_ = connection_id; | 70 last_connection_id_received_ = connection_id; |
70 last_message_received_ = data; | 71 last_message_received_ = data; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 net::UnixDomainClientSocket client_socket(socket_path_.value(), false); | 239 net::UnixDomainClientSocket client_socket(socket_path_.value(), false); |
239 net::TestCompletionCallback connect_callback; | 240 net::TestCompletionCallback connect_callback; |
240 int rv = client_socket.Connect(connect_callback.callback()); | 241 int rv = client_socket.Connect(connect_callback.callback()); |
241 ASSERT_EQ(net::OK, connect_callback.GetResult(rv)); | 242 ASSERT_EQ(net::OK, connect_callback.GetResult(rv)); |
242 | 243 |
243 auth_handler_->SendErrorAndCloseConnection(1); | 244 auth_handler_->SendErrorAndCloseConnection(1); |
244 ASSERT_EQ(0u, auth_handler_->GetActiveConnectionCountForTest()); | 245 ASSERT_EQ(0u, auth_handler_->GetActiveConnectionCountForTest()); |
245 } | 246 } |
246 | 247 |
247 } // namespace remoting | 248 } // namespace remoting |
OLD | NEW |