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

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

Issue 1547073003: Switch to standard integer types in content/renderer/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 "content/renderer/media/audio_track_recorder.h" 5 #include "content/renderer/media/audio_track_recorder.h"
6 6
7 #include <stdint.h>
8
9 #include "base/macros.h"
7 #include "base/run_loop.h" 10 #include "base/run_loop.h"
8 #include "base/stl_util.h" 11 #include "base/stl_util.h"
9 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
10 #include "content/renderer/media/media_stream_audio_source.h" 13 #include "content/renderer/media/media_stream_audio_source.h"
11 #include "content/renderer/media/mock_media_constraint_factory.h" 14 #include "content/renderer/media/mock_media_constraint_factory.h"
12 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 15 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
13 #include "content/renderer/media/webrtc_local_audio_track.h" 16 #include "content/renderer/media/webrtc_local_audio_track.h"
14 #include "media/audio/simple_sources.h" 17 #include "media/audio/simple_sources.h"
15 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 EXPECT_TRUE(!encoded_data->empty()); 156 EXPECT_TRUE(!encoded_data->empty());
154 157
155 // Decode |encoded_data| and check we get the expected number of frames 158 // Decode |encoded_data| and check we get the expected number of frames
156 // per buffer. 159 // per buffer.
157 EXPECT_EQ( 160 EXPECT_EQ(
158 params.sample_rate() * 161 params.sample_rate() *
159 audio_track_recorder_->GetOpusBufferDuration(params.sample_rate()) / 162 audio_track_recorder_->GetOpusBufferDuration(params.sample_rate()) /
160 1000, 163 1000,
161 opus_decode_float( 164 opus_decode_float(
162 opus_decoder_, 165 opus_decoder_,
163 reinterpret_cast<uint8*>(string_as_array(encoded_data.get())), 166 reinterpret_cast<uint8_t*>(string_as_array(encoded_data.get())),
164 encoded_data->size(), buffer_.get(), max_frames_per_buffer_, 0)); 167 encoded_data->size(), buffer_.get(), max_frames_per_buffer_, 0));
165 168
166 DoOnEncodedAudio(params, *encoded_data, timestamp); 169 DoOnEncodedAudio(params, *encoded_data, timestamp);
167 } 170 }
168 171
169 const base::MessageLoop message_loop_; 172 const base::MessageLoop message_loop_;
170 173
171 // ATR and WebMediaStreamTrack for fooling it. 174 // ATR and WebMediaStreamTrack for fooling it.
172 scoped_ptr<AudioTrackRecorder> audio_track_recorder_; 175 scoped_ptr<AudioTrackRecorder> audio_track_recorder_;
173 blink::WebMediaStreamTrack blink_track_; 176 blink::WebMediaStreamTrack blink_track_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 .WillOnce(RunClosure(quit_closure)); 247 .WillOnce(RunClosure(quit_closure));
245 audio_track_recorder_->OnData(*GetSecondSourceAudioBus(), time3); 248 audio_track_recorder_->OnData(*GetSecondSourceAudioBus(), time3);
246 249
247 run_loop.Run(); 250 run_loop.Run();
248 Mock::VerifyAndClearExpectations(this); 251 Mock::VerifyAndClearExpectations(this);
249 } 252 }
250 253
251 INSTANTIATE_TEST_CASE_P(, AudioTrackRecorderTest, ValuesIn(kATRTestParams)); 254 INSTANTIATE_TEST_CASE_P(, AudioTrackRecorderTest, ValuesIn(kATRTestParams));
252 255
253 } // namespace content 256 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/audio_track_recorder.cc ('k') | content/renderer/media/canvas_capture_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698