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

Side by Side Diff: remoting/host/linux/audio_pipe_reader_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
« no previous file with comments | « remoting/host/it2me_desktop_environment.cc ('k') | remoting/host/local_input_monitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/linux/audio_pipe_reader.h" 5 #include "remoting/host/linux/audio_pipe_reader.h"
6 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
11 #include <memory>
12
11 #include "base/files/file.h" 13 #include "base/files/file.h"
12 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 17 #include "base/run_loop.h"
17 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 namespace remoting { 22 namespace remoting {
22 23
23 class AudioPipeReaderTest : public testing::Test, 24 class AudioPipeReaderTest : public testing::Test,
24 public AudioPipeReader::StreamObserver { 25 public AudioPipeReader::StreamObserver {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 68 }
68 69
69 void WriteAndWait(const std::string& data) { 70 void WriteAndWait(const std::string& data) {
70 ASSERT_EQ(static_cast<int>(data.size()), 71 ASSERT_EQ(static_cast<int>(data.size()),
71 output_->WriteAtCurrentPos(data.data(), data.size())); 72 output_->WriteAtCurrentPos(data.data(), data.size()));
72 WaitForInput(data.size()); 73 WaitForInput(data.size());
73 } 74 }
74 75
75 protected: 76 protected:
76 base::MessageLoop message_loop_; 77 base::MessageLoop message_loop_;
77 scoped_ptr<base::RunLoop> run_loop_; 78 std::unique_ptr<base::RunLoop> run_loop_;
78 scoped_ptr<base::Thread> audio_thread_; 79 std::unique_ptr<base::Thread> audio_thread_;
79 base::ScopedTempDir test_dir_; 80 base::ScopedTempDir test_dir_;
80 base::FilePath pipe_path_; 81 base::FilePath pipe_path_;
81 scoped_ptr<base::File> output_; 82 std::unique_ptr<base::File> output_;
82 83
83 scoped_refptr<AudioPipeReader> reader_; 84 scoped_refptr<AudioPipeReader> reader_;
84 85
85 std::string read_data_; 86 std::string read_data_;
86 int stop_at_position_; 87 int stop_at_position_;
87 88
88 DISALLOW_COPY_AND_ASSIGN(AudioPipeReaderTest); 89 DISALLOW_COPY_AND_ASSIGN(AudioPipeReaderTest);
89 }; 90 };
90 91
91 // Verify that the reader can detect when the pipe is created and destroyed. 92 // Verify that the reader can detect when the pipe is created and destroyed.
(...skipping 20 matching lines...) Expand all
112 113
113 base::TimeTicks start_time = base::TimeTicks::Now(); 114 base::TimeTicks start_time = base::TimeTicks::Now();
114 ASSERT_NO_FATAL_FAILURE(WriteAndWait(test_data)); 115 ASSERT_NO_FATAL_FAILURE(WriteAndWait(test_data));
115 base::TimeDelta time_passed = base::TimeTicks::Now() - start_time; 116 base::TimeDelta time_passed = base::TimeTicks::Now() - start_time;
116 117
117 EXPECT_EQ(test_data, read_data_); 118 EXPECT_EQ(test_data, read_data_);
118 EXPECT_GE(time_passed, base::TimeDelta::FromMilliseconds(500)); 119 EXPECT_GE(time_passed, base::TimeDelta::FromMilliseconds(500));
119 } 120 }
120 121
121 } // namespace remoting 122 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/it2me_desktop_environment.cc ('k') | remoting/host/local_input_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698