| OLD | NEW |
| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class AudioPipeReaderTest : public testing::Test, | 24 class AudioPipeReaderTest : public testing::Test, |
| 25 public AudioPipeReader::StreamObserver { | 25 public AudioPipeReader::StreamObserver { |
| 26 public: | 26 public: |
| 27 AudioPipeReaderTest() | 27 AudioPipeReaderTest() |
| 28 : stop_at_position_(-1) { | 28 : stop_at_position_(-1) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void SetUp() override { | 31 void SetUp() override { |
| 32 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 32 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
| 33 pipe_path_ = test_dir_.path().AppendASCII("test_pipe"); | 33 pipe_path_ = test_dir_.GetPath().AppendASCII("test_pipe"); |
| 34 audio_thread_.reset(new base::Thread("TestAudioThread")); | 34 audio_thread_.reset(new base::Thread("TestAudioThread")); |
| 35 audio_thread_->StartWithOptions( | 35 audio_thread_->StartWithOptions( |
| 36 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 36 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 37 reader_ = AudioPipeReader::Create(audio_thread_->task_runner(), | 37 reader_ = AudioPipeReader::Create(audio_thread_->task_runner(), |
| 38 pipe_path_); | 38 pipe_path_); |
| 39 reader_->AddObserver(this); | 39 reader_->AddObserver(this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // AudioPipeReader::StreamObserver interface. | 42 // AudioPipeReader::StreamObserver interface. |
| 43 void OnDataRead(scoped_refptr<base::RefCountedString> data) override { | 43 void OnDataRead(scoped_refptr<base::RefCountedString> data) override { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 base::TimeTicks start_time = base::TimeTicks::Now(); | 114 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 115 ASSERT_NO_FATAL_FAILURE(WriteAndWait(test_data)); | 115 ASSERT_NO_FATAL_FAILURE(WriteAndWait(test_data)); |
| 116 base::TimeDelta time_passed = base::TimeTicks::Now() - start_time; | 116 base::TimeDelta time_passed = base::TimeTicks::Now() - start_time; |
| 117 | 117 |
| 118 EXPECT_EQ(test_data, read_data_); | 118 EXPECT_EQ(test_data, read_data_); |
| 119 EXPECT_GE(time_passed, base::TimeDelta::FromMilliseconds(500)); | 119 EXPECT_GE(time_passed, base::TimeDelta::FromMilliseconds(500)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace remoting | 122 } // namespace remoting |
| OLD | NEW |