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 "remoting/host/security_key/remote_security_key_ipc_client.h" | 5 #include "remoting/host/security_key/remote_security_key_ipc_client.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
15 #include "remoting/host/security_key/fake_ipc_gnubby_auth_handler.h" | 15 #include "remoting/host/security_key/fake_ipc_gnubby_auth_handler.h" |
16 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h" | 16 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 const int kTestConnectionId = 1; | 20 const int kTestConnectionId = 1; |
21 const char kNonexistentIpcChannelName[] = "Nonexistent_IPC_Channel"; | 21 const char kNonexistentIpcChannelName[] = "Nonexistent_IPC_Channel"; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const std::string& response_data); | 61 const std::string& response_data); |
62 | 62 |
63 // Creates a unique IPC channel name to use for testing. | 63 // Creates a unique IPC channel name to use for testing. |
64 std::string GenerateUniqueTestChannelName(); | 64 std::string GenerateUniqueTestChannelName(); |
65 | 65 |
66 // IPC tests require a valid MessageLoop to run. | 66 // IPC tests require a valid MessageLoop to run. |
67 base::MessageLoopForIO message_loop_; | 67 base::MessageLoopForIO message_loop_; |
68 | 68 |
69 // Used to allow |message_loop_| to run during tests. The instance is reset | 69 // Used to allow |message_loop_| to run during tests. The instance is reset |
70 // after each stage of the tests has been completed. | 70 // after each stage of the tests has been completed. |
71 scoped_ptr<base::RunLoop> run_loop_; | 71 std::unique_ptr<base::RunLoop> run_loop_; |
72 | 72 |
73 // The object under test. | 73 // The object under test. |
74 RemoteSecurityKeyIpcClient remote_security_key_ipc_client_; | 74 RemoteSecurityKeyIpcClient remote_security_key_ipc_client_; |
75 | 75 |
76 // Provides a connection details message to |remote_security_key_ipc_client_| | 76 // Provides a connection details message to |remote_security_key_ipc_client_| |
77 // for testing. | 77 // for testing. |
78 FakeIpcGnubbyAuthHandler fake_gnubby_auth_handler_; | 78 FakeIpcGnubbyAuthHandler fake_gnubby_auth_handler_; |
79 | 79 |
80 // Used to send/receive security key IPC messages for testing. | 80 // Used to send/receive security key IPC messages for testing. |
81 FakeRemoteSecurityKeyIpcServer fake_ipc_server_; | 81 FakeRemoteSecurityKeyIpcServer fake_ipc_server_; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 remote_security_key_ipc_client_.SetExpectedIpcServerSessionIdForTest( | 343 remote_security_key_ipc_client_.SetExpectedIpcServerSessionIdForTest( |
344 session_id_ + 1); | 344 session_id_ + 1); |
345 | 345 |
346 // Attempting to establish a connection should fail here since the IPC Server | 346 // Attempting to establish a connection should fail here since the IPC Server |
347 // is 'running' in a different session than expected. | 347 // is 'running' in a different session than expected. |
348 EstablishConnection(/*expect_success=*/false); | 348 EstablishConnection(/*expect_success=*/false); |
349 } | 349 } |
350 #endif // defined(OS_WIN) | 350 #endif // defined(OS_WIN) |
351 | 351 |
352 } // namespace remoting | 352 } // namespace remoting |
OLD | NEW |