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

Side by Side Diff: remoting/host/security_key/gnubby_auth_handler_win_unittest.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months 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 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/gnubby_auth_handler.h" 5 #include "remoting/host/security_key/gnubby_auth_handler.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/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "ipc/ipc_channel.h" 15 #include "ipc/ipc_channel.h"
16 #include "ipc/ipc_listener.h" 16 #include "ipc/ipc_listener.h"
17 #include "ipc/ipc_message.h" 17 #include "ipc/ipc_message.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 #include "remoting/host/security_key/fake_remote_security_key_ipc_client.h" 19 #include "remoting/host/security_key/fake_remote_security_key_ipc_client.h"
20 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h" 20 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h"
21 #include "remoting/host/security_key/remote_security_key_ipc_constants.h" 21 #include "remoting/host/security_key/remote_security_key_ipc_constants.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 // Returns a unique IPC channel name which prevents conflicts when running 79 // Returns a unique IPC channel name which prevents conflicts when running
80 // tests concurrently. 80 // tests concurrently.
81 std::string GetUniqueTestChannelName(); 81 std::string GetUniqueTestChannelName();
82 82
83 // IPC tests require a valid MessageLoop to run. 83 // IPC tests require a valid MessageLoop to run.
84 base::MessageLoopForIO message_loop_; 84 base::MessageLoopForIO message_loop_;
85 85
86 // Used to allow |message_loop_| to run during tests. The instance is reset 86 // Used to allow |message_loop_| to run during tests. The instance is reset
87 // after each stage of the tests has been completed. 87 // after each stage of the tests has been completed.
88 scoped_ptr<base::RunLoop> run_loop_; 88 std::unique_ptr<base::RunLoop> run_loop_;
89 89
90 // The object under test. 90 // The object under test.
91 scoped_ptr<GnubbyAuthHandler> auth_handler_; 91 std::unique_ptr<GnubbyAuthHandler> auth_handler_;
92 92
93 // Set as the default factory to create RemoteSecurityKeyIpcServerFactory 93 // Set as the default factory to create RemoteSecurityKeyIpcServerFactory
94 // instances, this class will track each objects creation and allow the tests 94 // instances, this class will track each objects creation and allow the tests
95 // to access it and use it for driving tests and validate state. 95 // to access it and use it for driving tests and validate state.
96 FakeRemoteSecurityKeyIpcServerFactory ipc_server_factory_; 96 FakeRemoteSecurityKeyIpcServerFactory ipc_server_factory_;
97 97
98 // Used to validate the object under test uses the correct ID when 98 // Used to validate the object under test uses the correct ID when
99 // communicating over the IPC channel. 99 // communicating over the IPC channel.
100 int last_connection_id_received_ = -1; 100 int last_connection_id_received_ = -1;
101 101
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 ASSERT_FALSE(fake_ipc_server.get()); 483 ASSERT_FALSE(fake_ipc_server.get());
484 ASSERT_FALSE(auth_handler_->IsValidConnectionId(kConnectionId1)); 484 ASSERT_FALSE(auth_handler_->IsValidConnectionId(kConnectionId1));
485 ASSERT_EQ(0u, auth_handler_->GetActiveConnectionCountForTest()); 485 ASSERT_EQ(0u, auth_handler_->GetActiveConnectionCountForTest());
486 486
487 // Attempt to connect again after the error. 487 // Attempt to connect again after the error.
488 EstablishInitialIpcConnection(&fake_ipc_client, kConnectionId2, channel_name, 488 EstablishInitialIpcConnection(&fake_ipc_client, kConnectionId2, channel_name,
489 /*close_connection=*/true); 489 /*close_connection=*/true);
490 } 490 }
491 491
492 } // namespace remoting 492 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/security_key/gnubby_auth_handler_win.cc ('k') | remoting/host/security_key/gnubby_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698