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

Side by Side Diff: media/base/pipeline_impl_unittest.cc

Issue 7193001: Move rtc_video_decoder* from media/filter/ to content/renderer/media/. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/threading/simple_thread.h" 9 #include "base/threading/simple_thread.h"
10 #include "media/base/pipeline_impl.h" 10 #include "media/base/pipeline_impl.h"
(...skipping 16 matching lines...) Expand all
27 27
28 namespace media { 28 namespace media {
29 29
30 // Total bytes of the data source. 30 // Total bytes of the data source.
31 static const int kTotalBytes = 1024; 31 static const int kTotalBytes = 1024;
32 32
33 // Buffered bytes of the data source. 33 // Buffered bytes of the data source.
34 static const int kBufferedBytes = 1024; 34 static const int kBufferedBytes = 1024;
35 35
36 // Test url for raw video pipeline. 36 // Test url for raw video pipeline.
37 static const std::string kUrlMedia = "media://raw_video_stream"; 37 static const char kUrlRawVideo[] = "://raw_video_stream";
scherkus (not reviewing) 2011/06/29 00:39:28 why not just append the x-raw-video: scheme here a
Ronghua 2011/06/29 20:36:39 I don't want to hard code the "x-raw-media" here,
38 38
39 // Used for setting expectations on pipeline callbacks. Using a StrictMock 39 // Used for setting expectations on pipeline callbacks. Using a StrictMock
40 // also lets us test for missing callbacks. 40 // also lets us test for missing callbacks.
41 class CallbackHelper { 41 class CallbackHelper {
42 public: 42 public:
43 CallbackHelper() {} 43 CallbackHelper() {}
44 virtual ~CallbackHelper() {} 44 virtual ~CallbackHelper() {}
45 45
46 MOCK_METHOD1(OnStart, void(PipelineStatus)); 46 MOCK_METHOD1(OnStart, void(PipelineStatus));
47 MOCK_METHOD1(OnSeek, void(PipelineStatus)); 47 MOCK_METHOD1(OnSeek, void(PipelineStatus));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 InitializePipeline(build_status, start_status, ""); 199 InitializePipeline(build_status, start_status, "");
200 } 200 }
201 201
202 void InitializePipeline(PipelineStatus build_status, 202 void InitializePipeline(PipelineStatus build_status,
203 PipelineStatus start_status, 203 PipelineStatus start_status,
204 const std::string& url) { 204 const std::string& url) {
205 // Expect an initialization callback. 205 // Expect an initialization callback.
206 EXPECT_CALL(callbacks_, OnStart(start_status)); 206 EXPECT_CALL(callbacks_, OnStart(start_status));
207 207
208 bool run_build = true; 208 bool run_build = true;
209 if (url.compare(kUrlMedia) == 0) 209 if (url.find(kRawMediaScheme) == 0)
210 run_build = false; 210 run_build = false;
scherkus (not reviewing) 2011/06/29 00:39:28 this is over-indented -- can you fix?
Ronghua 2011/06/29 20:36:39 Done.
211 211
212 pipeline_->Start(mocks_->filter_collection(true, 212 pipeline_->Start(mocks_->filter_collection(true,
213 true, 213 true,
214 run_build, 214 run_build,
215 build_status), 215 build_status),
216 url, 216 url,
217 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), 217 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_),
218 &CallbackHelper::OnStart)); 218 &CallbackHelper::OnStart));
219 219
220 message_loop_.RunAllPending(); 220 message_loop_.RunAllPending();
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 InitializePipeline(PIPELINE_OK); 423 InitializePipeline(PIPELINE_OK);
424 EXPECT_TRUE(pipeline_->IsInitialized()); 424 EXPECT_TRUE(pipeline_->IsInitialized());
425 EXPECT_FALSE(pipeline_->HasAudio()); 425 EXPECT_FALSE(pipeline_->HasAudio());
426 EXPECT_TRUE(pipeline_->HasVideo()); 426 EXPECT_TRUE(pipeline_->HasVideo());
427 } 427 }
428 428
429 TEST_F(PipelineImplTest, RawVideoStream) { 429 TEST_F(PipelineImplTest, RawVideoStream) {
430 InitializeVideoDecoder(NULL); 430 InitializeVideoDecoder(NULL);
431 InitializeVideoRenderer(); 431 InitializeVideoRenderer();
432 432
433 InitializePipeline(PIPELINE_OK, PIPELINE_OK, kUrlMedia); 433 InitializePipeline(PIPELINE_OK, PIPELINE_OK,
434 std::string(kRawMediaScheme).append(kUrlRawVideo));
434 EXPECT_TRUE(pipeline_->IsInitialized()); 435 EXPECT_TRUE(pipeline_->IsInitialized());
435 EXPECT_FALSE(pipeline_->HasAudio()); 436 EXPECT_FALSE(pipeline_->HasAudio());
436 EXPECT_TRUE(pipeline_->HasVideo()); 437 EXPECT_TRUE(pipeline_->HasVideo());
437 } 438 }
438 439
439 TEST_F(PipelineImplTest, AudioVideoStream) { 440 TEST_F(PipelineImplTest, AudioVideoStream) {
440 CreateAudioStream(); 441 CreateAudioStream();
441 CreateVideoStream(); 442 CreateVideoStream();
442 MockDemuxerStreamVector streams; 443 MockDemuxerStreamVector streams;
443 streams.push_back(audio_stream()); 444 streams.push_back(audio_stream());
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 TestPipelineStatusNotification(0); 893 TestPipelineStatusNotification(0);
893 } 894 }
894 895
895 // Test that different-thread, some-delay callback (the expected common case) 896 // Test that different-thread, some-delay callback (the expected common case)
896 // works correctly. 897 // works correctly.
897 TEST(PipelineStatusNotificationTest, DelayedCallback) { 898 TEST(PipelineStatusNotificationTest, DelayedCallback) {
898 TestPipelineStatusNotification(20); 899 TestPipelineStatusNotification(20);
899 } 900 }
900 901
901 } // namespace media 902 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698