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

Side by Side Diff: media/cast/test/end2end_unittest.cc

Issue 163553006: Cast: Refactoring Cast API's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This test generate synthetic data. For audio it's a sinusoid waveform with 5 // This test generate synthetic data. For audio it's a sinusoid waveform with
6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern 6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern
7 // that is shifting by one pixel per frame, each pixels neighbors right and down 7 // that is shifting by one pixel per frame, each pixels neighbors right and down
8 // is this pixels value +1, since the pixel value is 8 bit it will wrap 8 // is this pixels value +1, since the pixel value is 8 bit it will wrap
9 // frequently within the image. Visually this will create diagonally color bands 9 // frequently within the image. Visually this will create diagonally color bands
10 // that moves across the screen 10 // that moves across the screen
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 &receiver_to_sender_)); 482 &receiver_to_sender_));
483 transport_sender_.reset(new transport::CastTransportSenderImpl( 483 transport_sender_.reset(new transport::CastTransportSenderImpl(
484 testing_clock_, 484 testing_clock_,
485 transport_config_, 485 transport_config_,
486 base::Bind(&UpdateCastTransportStatus), 486 base::Bind(&UpdateCastTransportStatus),
487 task_runner_, 487 task_runner_,
488 &sender_to_receiver_)); 488 &sender_to_receiver_));
489 489
490 cast_sender_.reset(CastSender::CreateCastSender( 490 cast_sender_.reset(CastSender::CreateCastSender(
491 cast_environment_, 491 cast_environment_,
492 &audio_sender_config_,
493 &video_sender_config_,
494 NULL,
495 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)), 492 base::Bind(&End2EndTest::InitializationResult, base::Unretained(this)),
496 transport_sender_.get())); 493 transport_sender_.get()));
497 494
495 // Initializing audio and video senders.
496 cast_sender_->InitializeAudio(audio_sender_config_);
497 cast_sender_->InitializeVideo(video_sender_config_, NULL);
498
498 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver()); 499 receiver_to_sender_.SetPacketReceiver(cast_sender_->packet_receiver());
499 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver()); 500 sender_to_receiver_.SetPacketReceiver(cast_receiver_->packet_receiver());
500 501
501 frame_input_ = cast_sender_->frame_input(); 502 frame_input_ = cast_sender_->frame_input();
502 frame_receiver_ = cast_receiver_->frame_receiver(); 503 frame_receiver_ = cast_receiver_->frame_receiver();
503 504
504 audio_bus_factory_.reset( 505 audio_bus_factory_.reset(
505 new TestAudioBusFactory(audio_sender_config_.channels, 506 new TestAudioBusFactory(audio_sender_config_.channels,
506 audio_sender_config_.frequency, 507 audio_sender_config_.frequency,
507 kSoundFrequency, 508 kSoundFrequency,
(...skipping 27 matching lines...) Expand all
535 536
536 void RunTasks(int during_ms) { 537 void RunTasks(int during_ms) {
537 for (int i = 0; i < during_ms; ++i) { 538 for (int i = 0; i < during_ms; ++i) {
538 // Call process the timers every 1 ms. 539 // Call process the timers every 1 ms.
539 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); 540 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1));
540 task_runner_->RunTasks(); 541 task_runner_->RunTasks();
541 } 542 }
542 } 543 }
543 544
544 void InitializationResult(CastInitializationStatus result) { 545 void InitializationResult(CastInitializationStatus result) {
545 EXPECT_EQ(result, STATUS_INITIALIZED); 546 bool end_result = result == STATUS_AUDIO_INITIALIZED ||
547 result == STATUS_VIDEO_INITIALIZED;
548 EXPECT_TRUE(end_result);
Ami GONE FROM CHROMIUM 2014/02/13 18:02:14 Any desire to check that each status is hit exactl
mikhal1 2014/02/14 18:03:16 Wasn't aware of one, but since you brought it up..
546 } 549 }
547 550
548 AudioReceiverConfig audio_receiver_config_; 551 AudioReceiverConfig audio_receiver_config_;
549 VideoReceiverConfig video_receiver_config_; 552 VideoReceiverConfig video_receiver_config_;
550 AudioSenderConfig audio_sender_config_; 553 AudioSenderConfig audio_sender_config_;
551 VideoSenderConfig video_sender_config_; 554 VideoSenderConfig video_sender_config_;
552 transport::CastTransportConfig transport_config_; 555 transport::CastTransportConfig transport_config_;
553 556
554 base::TimeTicks start_time_; 557 base::TimeTicks start_time_;
555 base::SimpleTestTickClock* testing_clock_; 558 base::SimpleTestTickClock* testing_clock_;
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame); 1287 EXPECT_EQ(total_event_count_for_frame, expected_event_count_for_frame);
1285 } 1288 }
1286 1289
1287 // TODO(pwestin): Add repeatable packet loss test. 1290 // TODO(pwestin): Add repeatable packet loss test.
1288 // TODO(pwestin): Add test for misaligned send get calls. 1291 // TODO(pwestin): Add test for misaligned send get calls.
1289 // TODO(pwestin): Add more tests that does not resample. 1292 // TODO(pwestin): Add more tests that does not resample.
1290 // TODO(pwestin): Add test when we have starvation for our RunTask. 1293 // TODO(pwestin): Add test when we have starvation for our RunTask.
1291 1294
1292 } // namespace cast 1295 } // namespace cast
1293 } // namespace media 1296 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698