OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/renderer_host/media/audio_input_sync_writer.h" | 5 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 using ::testing::_; | 27 using ::testing::_; |
28 using base::TimeDelta; | 28 using base::TimeDelta; |
29 using media::AudioBus; | 29 using media::AudioBus; |
30 using media::AudioParameters; | 30 using media::AudioParameters; |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 | 33 |
34 namespace { | 34 namespace { |
| 35 |
35 // Number of audio buffers in the faked ring buffer. | 36 // Number of audio buffers in the faked ring buffer. |
36 const int kSegments = 10; | 37 const int kSegments = 10; |
| 38 |
37 } // namespace | 39 } // namespace |
38 | 40 |
39 // Mocked out sockets used for Send/ReceiveWithTimeout. Counts the number of | 41 // Mocked out sockets used for Send/ReceiveWithTimeout. Counts the number of |
40 // outstanding reads, i.e. the diff between send and receive calls. | 42 // outstanding reads, i.e. the diff between send and receive calls. |
41 class MockCancelableSyncSocket : public base::CancelableSyncSocket { | 43 class MockCancelableSyncSocket : public base::CancelableSyncSocket { |
42 public: | 44 public: |
43 explicit MockCancelableSyncSocket(int buffer_size) | 45 explicit MockCancelableSyncSocket(int buffer_size) |
44 : in_failure_mode_(false), | 46 : in_failure_mode_(false), |
45 writes_(0), | 47 writes_(0), |
46 reads_(0), | 48 reads_(0), |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2)); | 341 EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2)); |
340 | 342 |
341 // Empty both. Should render a log call for emptying the fifo. | 343 // Empty both. Should render a log call for emptying the fifo. |
342 socket_->Read(kSegments); | 344 socket_->Read(kSegments); |
343 writer_->Write(audio_bus_.get(), 0, false, 0); | 345 writer_->Write(audio_bus_.get(), 0, false, 0); |
344 socket_->Read(3); | 346 socket_->Read(3); |
345 EXPECT_TRUE(TestSocketAndFifoExpectations(0, 3 * sizeof(uint32_t), 0)); | 347 EXPECT_TRUE(TestSocketAndFifoExpectations(0, 3 * sizeof(uint32_t), 0)); |
346 } | 348 } |
347 | 349 |
348 } // namespace content | 350 } // namespace content |
OLD | NEW |