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

Side by Side Diff: content/renderer/media/media_recorder_handler_unittest.cc

Issue 2101303004: Pass delay and timestamp to AudioSourceCallback::OnMoreData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix Mac CQ errors. Created 4 years, 2 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 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string>
8
7 #include "base/macros.h" 9 #include "base/macros.h"
8 #include "base/run_loop.h" 10 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h"
10 #include "content/child/child_process.h" 13 #include "content/child/child_process.h"
11 #include "content/renderer/media/media_recorder_handler.h" 14 #include "content/renderer/media/media_recorder_handler.h"
12 #include "content/renderer/media/mock_media_stream_registry.h" 15 #include "content/renderer/media/mock_media_stream_registry.h"
13 #include "media/audio/simple_sources.h" 16 #include "media/audio/simple_sources.h"
14 #include "media/base/audio_bus.h" 17 #include "media/base/audio_bus.h"
15 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
16 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h" 21 #include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h"
19 #include "third_party/WebKit/public/platform/WebString.h" 22 #include "third_party/WebKit/public/platform/WebString.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (GetParam().has_video) 113 if (GetParam().has_video)
111 registry_.AddVideoTrack(kTestVideoTrackId); 114 registry_.AddVideoTrack(kTestVideoTrackId);
112 if (GetParam().has_audio) 115 if (GetParam().has_audio)
113 registry_.AddAudioTrack(kTestAudioTrackId); 116 registry_.AddAudioTrack(kTestAudioTrackId);
114 } 117 }
115 118
116 std::unique_ptr<media::AudioBus> NextAudioBus() { 119 std::unique_ptr<media::AudioBus> NextAudioBus() {
117 std::unique_ptr<media::AudioBus> bus(media::AudioBus::Create( 120 std::unique_ptr<media::AudioBus> bus(media::AudioBus::Create(
118 kTestAudioChannels, 121 kTestAudioChannels,
119 kTestAudioSampleRate * kTestAudioBufferDurationMs / 1000)); 122 kTestAudioSampleRate * kTestAudioBufferDurationMs / 1000));
120 audio_source_.OnMoreData(bus.get(), 0, 0); 123 audio_source_.OnMoreData(base::TimeDelta(), base::TimeTicks::Now(), 0,
124 bus.get());
121 return bus; 125 return bus;
122 } 126 }
123 127
124 // A ChildProcess and a MessageLoopForUI are both needed to fool the Tracks 128 // A ChildProcess and a MessageLoopForUI are both needed to fool the Tracks
125 // and Sources in |registry_| into believing they are on the right threads. 129 // and Sources in |registry_| into believing they are on the right threads.
126 const base::MessageLoopForUI message_loop_; 130 const base::MessageLoopForUI message_loop_;
127 const ChildProcess child_process_; 131 const ChildProcess child_process_;
128 MockMediaStreamRegistry registry_; 132 MockMediaStreamRegistry registry_;
129 133
130 // The Class under test. Needs to be scoped_ptr to force its destruction. 134 // The Class under test. Needs to be scoped_ptr to force its destruction.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 333 }
330 334
331 media_recorder_handler_->stop(); 335 media_recorder_handler_->stop();
332 336
333 // Expect a last call on destruction, with size 0 and |lastInSlice| true. 337 // Expect a last call on destruction, with size 0 and |lastInSlice| true.
334 EXPECT_CALL(*this, writeData(nullptr, 0, true)).Times(1); 338 EXPECT_CALL(*this, writeData(nullptr, 0, true)).Times(1);
335 media_recorder_handler_.reset(); 339 media_recorder_handler_.reset();
336 } 340 }
337 341
338 } // namespace content 342 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698