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

Side by Side Diff: remoting/host/security_key/remote_security_key_message_writer_impl_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/remote_security_key_message_writer.h" 5 #include "remoting/host/security_key/remote_security_key_message_writer_impl.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory>
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/bind.h" 11 #include "base/bind.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 "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "remoting/host/security_key/remote_security_key_message_writer_impl.h"
19 #include "remoting/host/security_key/security_key_message.h" 18 #include "remoting/host/security_key/security_key_message.h"
20 #include "remoting/host/setup/test_util.h" 19 #include "remoting/host/setup/test_util.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 21
23 namespace { 22 namespace {
24 const remoting::RemoteSecurityKeyMessageType kTestMessageType = 23 const remoting::RemoteSecurityKeyMessageType kTestMessageType =
25 remoting::RemoteSecurityKeyMessageType::CONNECT; 24 remoting::RemoteSecurityKeyMessageType::CONNECT;
26 const unsigned int kLargeMessageSizeBytes = 200000; 25 const unsigned int kLargeMessageSizeBytes = 200000;
27 } // namespace 26 } // namespace
28 27
(...skipping 13 matching lines...) Expand all
42 const std::string& result); 41 const std::string& result);
43 42
44 protected: 43 protected:
45 // testing::Test interface. 44 // testing::Test interface.
46 void SetUp() override; 45 void SetUp() override;
47 46
48 // Writes |kTestMessageType| and |payload| to the output stream and verifies 47 // Writes |kTestMessageType| and |payload| to the output stream and verifies
49 // they were written correctly. 48 // they were written correctly.
50 void WriteMessageToOutput(const std::string& payload); 49 void WriteMessageToOutput(const std::string& payload);
51 50
52 scoped_ptr<RemoteSecurityKeyMessageWriter> writer_; 51 std::unique_ptr<RemoteSecurityKeyMessageWriter> writer_;
53 base::File read_file_; 52 base::File read_file_;
54 base::File write_file_; 53 base::File write_file_;
55 54
56 // Stores the result of the last read operation. 55 // Stores the result of the last read operation.
57 std::string message_result_; 56 std::string message_result_;
58 57
59 private: 58 private:
60 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageWriterImplTest); 59 DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageWriterImplTest);
61 }; 60 };
62 61
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 195 }
197 196
198 TEST_F(RemoteSecurityKeyMessageWriterImplTest, EnsureWriteFailsWhenPipeClosed) { 197 TEST_F(RemoteSecurityKeyMessageWriterImplTest, EnsureWriteFailsWhenPipeClosed) {
199 // Close the read end so that writing fails immediately. 198 // Close the read end so that writing fails immediately.
200 read_file_.Close(); 199 read_file_.Close();
201 200
202 EXPECT_FALSE(writer_->WriteMessage(kTestMessageType)); 201 EXPECT_FALSE(writer_->WriteMessage(kTestMessageType));
203 } 202 }
204 203
205 } // namespace remoting 204 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698