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

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

Issue 526653002: Replace init_cb in Renderer::Initialize() with base::Closure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 6 years, 3 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
« media/base/renderer.h ('K') | « media/filters/renderer_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 class RendererImplTest : public ::testing::Test { 50 class RendererImplTest : public ::testing::Test {
51 public: 51 public:
52 // Used for setting expectations on pipeline callbacks. Using a StrictMock 52 // Used for setting expectations on pipeline callbacks. Using a StrictMock
53 // also lets us test for missing callbacks. 53 // also lets us test for missing callbacks.
54 class CallbackHelper { 54 class CallbackHelper {
55 public: 55 public:
56 CallbackHelper() {} 56 CallbackHelper() {}
57 virtual ~CallbackHelper() {} 57 virtual ~CallbackHelper() {}
58 58
59 MOCK_METHOD1(OnInitialize, void(PipelineStatus)); 59 MOCK_METHOD0(OnInitialize, void());
60 MOCK_METHOD0(OnFlushed, void()); 60 MOCK_METHOD0(OnFlushed, void());
61 MOCK_METHOD0(OnEnded, void()); 61 MOCK_METHOD0(OnEnded, void());
62 MOCK_METHOD1(OnError, void(PipelineStatus)); 62 MOCK_METHOD1(OnError, void(PipelineStatus));
63 MOCK_METHOD1(OnUpdateStatistics, void(const PipelineStatistics&)); 63 MOCK_METHOD1(OnUpdateStatistics, void(const PipelineStatistics&));
64 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState)); 64 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState));
65 65
66 private: 66 private:
67 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); 67 DISALLOW_COPY_AND_ASSIGN(CallbackHelper);
68 }; 68 };
69 69
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Sets up expectations to allow the video renderer to initialize. 118 // Sets up expectations to allow the video renderer to initialize.
119 void SetVideoRendererInitializeExpectations(PipelineStatus status) { 119 void SetVideoRendererInitializeExpectations(PipelineStatus status) {
120 EXPECT_CALL(*video_renderer_, 120 EXPECT_CALL(*video_renderer_,
121 Initialize(video_stream_.get(), _, _, _, _, _, _, _, _, _)) 121 Initialize(video_stream_.get(), _, _, _, _, _, _, _, _, _))
122 .WillOnce(DoAll(SaveArg<5>(&video_buffering_state_cb_), 122 .WillOnce(DoAll(SaveArg<5>(&video_buffering_state_cb_),
123 SaveArg<6>(&video_ended_cb_), 123 SaveArg<6>(&video_ended_cb_),
124 RunCallback<2>(status))); 124 RunCallback<2>(status)));
125 } 125 }
126 126
127 void InitializeAndExpect(PipelineStatus start_status) { 127 void InitializeAndExpect(PipelineStatus start_status) {
128 EXPECT_CALL(callbacks_, OnInitialize(start_status)); 128 if (start_status != PIPELINE_OK)
129 EXPECT_CALL(callbacks_, OnError(start_status));
130
131 EXPECT_CALL(callbacks_, OnInitialize());
129 132
130 renderer_impl_->Initialize( 133 renderer_impl_->Initialize(
131 base::Bind(&CallbackHelper::OnInitialize, 134 base::Bind(&CallbackHelper::OnInitialize,
132 base::Unretained(&callbacks_)), 135 base::Unretained(&callbacks_)),
133 base::Bind(&CallbackHelper::OnUpdateStatistics, 136 base::Bind(&CallbackHelper::OnUpdateStatistics,
134 base::Unretained(&callbacks_)), 137 base::Unretained(&callbacks_)),
135 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), 138 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)),
136 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), 139 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)),
137 base::Bind(&CallbackHelper::OnBufferingStateChange, 140 base::Bind(&CallbackHelper::OnBufferingStateChange,
138 base::Unretained(&callbacks_)), 141 base::Unretained(&callbacks_)),
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 InitializeWithAudio(); 548 InitializeWithAudio();
546 Play(); 549 Play();
547 Flush(false); 550 Flush(false);
548 551
549 EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_DECODE)); 552 EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_DECODE));
550 audio_error_cb_.Run(PIPELINE_ERROR_DECODE); 553 audio_error_cb_.Run(PIPELINE_ERROR_DECODE);
551 base::RunLoop().RunUntilIdle(); 554 base::RunLoop().RunUntilIdle();
552 } 555 }
553 556
554 } // namespace media 557 } // namespace media
OLDNEW
« media/base/renderer.h ('K') | « media/filters/renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698