OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
6 #include "base/memory/shared_memory.h" | 6 #include "base/memory/shared_memory.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/process/process_handle.h" | 8 #include "base/process/process_handle.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ~MockCaptureCallback() override {} | 47 ~MockCaptureCallback() override {} |
48 | 48 |
49 MOCK_METHOD0(OnCaptureStarted, void()); | 49 MOCK_METHOD0(OnCaptureStarted, void()); |
50 MOCK_METHOD4(Capture, | 50 MOCK_METHOD4(Capture, |
51 void(const AudioBus* audio_source, | 51 void(const AudioBus* audio_source, |
52 int audio_delay_milliseconds, | 52 int audio_delay_milliseconds, |
53 double volume, | 53 double volume, |
54 bool key_pressed)); | 54 bool key_pressed)); |
55 | 55 |
56 MOCK_METHOD1(OnCaptureError, void(const std::string& message)); | 56 MOCK_METHOD1(OnCaptureError, void(const std::string& message)); |
| 57 MOCK_METHOD1(OnCaptureMuted, void(bool is_muted)); |
57 }; | 58 }; |
58 | 59 |
59 // Used to terminate a loop from a different thread than the loop belongs to. | 60 // Used to terminate a loop from a different thread than the loop belongs to. |
60 // |task_runner| should be a SingleThreadTaskRunner. | 61 // |task_runner| should be a SingleThreadTaskRunner. |
61 ACTION_P(QuitLoop, task_runner) { | 62 ACTION_P(QuitLoop, task_runner) { |
62 task_runner->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 63 task_runner->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
63 } | 64 } |
64 | 65 |
65 } // namespace. | 66 } // namespace. |
66 | 67 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 EXPECT_CALL(*input_ipc, RecordStream()); | 141 EXPECT_CALL(*input_ipc, RecordStream()); |
141 EXPECT_CALL(callback, OnCaptureStarted()) | 142 EXPECT_CALL(callback, OnCaptureStarted()) |
142 .WillOnce(QuitLoop(io_loop.task_runner())); | 143 .WillOnce(QuitLoop(io_loop.task_runner())); |
143 base::RunLoop().Run(); | 144 base::RunLoop().Run(); |
144 device->Stop(); | 145 device->Stop(); |
145 base::RunLoop().RunUntilIdle(); | 146 base::RunLoop().RunUntilIdle(); |
146 duplicated_memory_handle.Close(); | 147 duplicated_memory_handle.Close(); |
147 } | 148 } |
148 | 149 |
149 } // namespace media. | 150 } // namespace media. |
OLD | NEW |