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

Side by Side Diff: media/audio/audio_output_proxy_unittest.cc

Issue 10466007: Fix wrong timing when audio is muted. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "media/audio/audio_output_dispatcher_impl.h" 10 #include "media/audio/audio_output_dispatcher_impl.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 .Times(1); 458 .Times(1);
459 EXPECT_CALL(stream, Close()) 459 EXPECT_CALL(stream, Close())
460 .Times(1); 460 .Times(1);
461 461
462 AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); 462 AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_);
463 AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); 463 AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_);
464 EXPECT_TRUE(proxy1->Open()); 464 EXPECT_TRUE(proxy1->Open());
465 EXPECT_TRUE(proxy2->Open()); 465 EXPECT_TRUE(proxy2->Open());
466 466
467 proxy1->Start(&callback_); 467 proxy1->Start(&callback_);
468
469 // Mute the proxy. Resulting stream should still have correct length.
470 proxy1->SetVolume(0.0);
471
468 uint8 zeroes[4] = {0, 0, 0, 0}; 472 uint8 zeroes[4] = {0, 0, 0, 0};
469 uint8 buf1[4] = {0}; 473 uint8 buf1[4] = {0};
470 EXPECT_CALL(callback_, 474 EXPECT_CALL(callback_,
471 OnMoreData(NotNull(), 4, 475 OnMoreData(NotNull(), 4,
472 AllOf(Field(&AudioBuffersState::pending_bytes, 0), 476 AllOf(Field(&AudioBuffersState::pending_bytes, 0),
473 Field(&AudioBuffersState::hardware_delay_bytes, 0)))) 477 Field(&AudioBuffersState::hardware_delay_bytes, 0))))
474 .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), 478 .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)),
475 Return(4))); 479 Return(4)));
476 mixer_->OnMoreData(buf1, sizeof(buf1), AudioBuffersState(0, 0)); 480 mixer_->OnMoreData(buf1, sizeof(buf1), AudioBuffersState(0, 0));
477 proxy2->Start(&callback_); 481 proxy2->Start(&callback_);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 583
580 proxy2->Start(&callback_); 584 proxy2->Start(&callback_);
581 585
582 Mock::VerifyAndClear(&callback_); 586 Mock::VerifyAndClear(&callback_);
583 587
584 proxy2->Close(); 588 proxy2->Close();
585 WaitForCloseTimer(kTestCloseDelayMs); 589 WaitForCloseTimer(kTestCloseDelayMs);
586 } 590 }
587 591
588 } // namespace media 592 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698