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

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc

Issue 10830335: Fix the flakiness of StopGeneratedStreamsOnChannelClosing on Android bot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | 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 (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/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 10 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 TEST_F(MediaStreamDispatcherHostTest, StopGeneratedStreamsOnChannelClosing) { 365 TEST_F(MediaStreamDispatcherHostTest, StopGeneratedStreamsOnChannelClosing) {
366 StreamOptions options(false, true); 366 StreamOptions options(false, true);
367 367
368 EXPECT_CALL(*host_, GetMediaObserver()) 368 EXPECT_CALL(*host_, GetMediaObserver())
369 .WillRepeatedly(Return(media_observer_.get())); 369 .WillRepeatedly(Return(media_observer_.get()));
370 370
371 // Create first group of streams. 371 // Create first group of streams.
372 size_t generated_streams = 3; 372 size_t generated_streams = 3;
373 for (size_t i = 0; i < generated_streams; ++i) { 373 for (size_t i = 0; i < generated_streams; ++i) {
374 EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId + i, 0, 1)); 374 EXPECT_CALL(*host_, OnStreamGenerated(kRenderId, kPageRequestId + i, 0, 1));
375 EXPECT_CALL(*media_observer_.get(), OnCaptureDevicesOpened(_, _, _));
375 host_->OnGenerateStream(kPageRequestId + i, options); 376 host_->OnGenerateStream(kPageRequestId + i, options);
377
378 // Wait until the stream is generated.
379 WaitForResult();
376 } 380 }
377 EXPECT_EQ(host_->NumberOfStreams(), generated_streams); 381 EXPECT_EQ(host_->NumberOfStreams(), generated_streams);
378 EXPECT_CALL(*media_observer_.get(), OnCaptureDevicesOpened(_, _, _))
379 .Times(3);
380 // Wait until the streams are all generated.
381 WaitForResult();
382 382
383 // Calling OnChannelClosing() to cancel all the pending/generated streams. 383 // Calling OnChannelClosing() to cancel all the pending/generated streams.
384 EXPECT_CALL(*media_observer_.get(), OnCaptureDevicesClosed(_, _, _)) 384 EXPECT_CALL(*media_observer_.get(), OnCaptureDevicesClosed(_, _, _))
385 .Times(3); 385 .Times(3);
386 host_->OnChannelClosing(); 386 host_->OnChannelClosing();
387 387
388 // Streams should have been cleaned up. 388 // Streams should have been cleaned up.
389 EXPECT_EQ(host_->NumberOfStreams(), 0u); 389 EXPECT_EQ(host_->NumberOfStreams(), 0u);
390 } 390 }
391 391
392 }; // namespace media_stream 392 }; // namespace media_stream
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698