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

Side by Side Diff: media/renderers/renderer_impl_unittest.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
11 #include "media/base/gmock_callback_support.h" 11 #include "media/base/gmock_callback_support.h"
12 #include "media/base/mock_filters.h" 12 #include "media/base/mock_filters.h"
13 #include "media/base/test_helpers.h" 13 #include "media/base/test_helpers.h"
14 #include "media/renderers/renderer_impl.h" 14 #include "media/renderers/renderer_impl.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using ::testing::_; 17 using ::testing::_;
18 using ::testing::DoAll; 18 using ::testing::DoAll;
19 using ::testing::InSequence; 19 using ::testing::InSequence;
20 using ::testing::Mock; 20 using ::testing::Mock;
21 using ::testing::Return; 21 using ::testing::Return;
22 using ::testing::SaveArg; 22 using ::testing::SaveArg;
23 using ::testing::StrictMock; 23 using ::testing::StrictMock;
24 24
25 namespace media { 25 namespace media {
26 26
27 const int64 kStartPlayingTimeInMs = 100; 27 const int64_t kStartPlayingTimeInMs = 100;
28 28
29 ACTION_P2(SetBufferingState, cb, buffering_state) { 29 ACTION_P2(SetBufferingState, cb, buffering_state) {
30 cb->Run(buffering_state); 30 cb->Run(buffering_state);
31 } 31 }
32 32
33 ACTION_P2(AudioError, cb, error) { 33 ACTION_P2(AudioError, cb, error) {
34 cb->Run(error); 34 cb->Run(error);
35 } 35 }
36 36
37 class RendererImplTest : public ::testing::Test { 37 class RendererImplTest : public ::testing::Test {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 base::Bind(&CallbackHelper::OnFlushed, base::Unretained(&callbacks_))); 216 base::Bind(&CallbackHelper::OnFlushed, base::Unretained(&callbacks_)));
217 base::RunLoop().RunUntilIdle(); 217 base::RunLoop().RunUntilIdle();
218 } 218 }
219 219
220 void SetPlaybackRate(double playback_rate) { 220 void SetPlaybackRate(double playback_rate) {
221 EXPECT_CALL(time_source_, SetPlaybackRate(playback_rate)); 221 EXPECT_CALL(time_source_, SetPlaybackRate(playback_rate));
222 renderer_impl_->SetPlaybackRate(playback_rate); 222 renderer_impl_->SetPlaybackRate(playback_rate);
223 base::RunLoop().RunUntilIdle(); 223 base::RunLoop().RunUntilIdle();
224 } 224 }
225 225
226 int64 GetMediaTimeMs() { 226 int64_t GetMediaTimeMs() {
227 return renderer_impl_->GetMediaTime().InMilliseconds(); 227 return renderer_impl_->GetMediaTime().InMilliseconds();
228 } 228 }
229 229
230 bool IsMediaTimeAdvancing(double playback_rate) { 230 bool IsMediaTimeAdvancing(double playback_rate) {
231 int64 start_time_ms = GetMediaTimeMs(); 231 int64_t start_time_ms = GetMediaTimeMs();
232 const int64 time_to_advance_ms = 100; 232 const int64_t time_to_advance_ms = 100;
233 233
234 test_tick_clock_.Advance( 234 test_tick_clock_.Advance(
235 base::TimeDelta::FromMilliseconds(time_to_advance_ms)); 235 base::TimeDelta::FromMilliseconds(time_to_advance_ms));
236 236
237 if (GetMediaTimeMs() == start_time_ms + time_to_advance_ms * playback_rate) 237 if (GetMediaTimeMs() == start_time_ms + time_to_advance_ms * playback_rate)
238 return true; 238 return true;
239 239
240 DCHECK_EQ(start_time_ms, GetMediaTimeMs()); 240 DCHECK_EQ(start_time_ms, GetMediaTimeMs());
241 return false; 241 return false;
242 } 242 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 .WillOnce( 596 .WillOnce(
597 SetBufferingState(&audio_buffering_state_cb_, BUFFERING_HAVE_ENOUGH)); 597 SetBufferingState(&audio_buffering_state_cb_, BUFFERING_HAVE_ENOUGH));
598 EXPECT_CALL(*video_renderer_, StartPlayingFrom(kStartTime)); 598 EXPECT_CALL(*video_renderer_, StartPlayingFrom(kStartTime));
599 renderer_impl_->StartPlayingFrom(kStartTime); 599 renderer_impl_->StartPlayingFrom(kStartTime);
600 600
601 // Nothing else should primed on the message loop. 601 // Nothing else should primed on the message loop.
602 base::RunLoop().RunUntilIdle(); 602 base::RunLoop().RunUntilIdle();
603 } 603 }
604 604
605 } // namespace media 605 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698