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

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

Issue 345713005: Make sure MediaStreamManager handles requests in order. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment. Created 6 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 #include <queue> 6 #include <queue>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 18 matching lines...) Expand all
29 #include "media/audio/mock_audio_manager.h" 29 #include "media/audio/mock_audio_manager.h"
30 #include "media/base/media_switches.h" 30 #include "media/base/media_switches.h"
31 #include "media/video/capture/fake_video_capture_device_factory.h" 31 #include "media/video/capture/fake_video_capture_device_factory.h"
32 #include "net/url_request/url_request_context.h" 32 #include "net/url_request/url_request_context.h"
33 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 35
36 using ::testing::_; 36 using ::testing::_;
37 using ::testing::DeleteArg; 37 using ::testing::DeleteArg;
38 using ::testing::DoAll; 38 using ::testing::DoAll;
39 using ::testing::InSequence;
39 using ::testing::Return; 40 using ::testing::Return;
40 using ::testing::SaveArg; 41 using ::testing::SaveArg;
41 42
42 const int kProcessId = 5; 43 const int kProcessId = 5;
43 const int kRenderId = 6; 44 const int kRenderId = 6;
44 const int kPageRequestId = 7; 45 const int kPageRequestId = 7;
45 46
46 namespace content { 47 namespace content {
47 48
48 class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, 49 class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost,
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 558 }
558 559
559 // This test request two streams with video only without waiting for the first 560 // This test request two streams with video only without waiting for the first
560 // stream to be generated before requesting the second. 561 // stream to be generated before requesting the second.
561 // The same device id and session ids are expected. 562 // The same device id and session ids are expected.
562 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithoutWaiting) { 563 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithoutWaiting) {
563 StreamOptions options(false, true); 564 StreamOptions options(false, true);
564 565
565 // Generate first stream. 566 // Generate first stream.
566 SetupFakeUI(true); 567 SetupFakeUI(true);
567 EXPECT_CALL(*host_.get(), OnStreamGenerated(kRenderId, kPageRequestId, 0, 1)); 568 {
569 InSequence s;
570 EXPECT_CALL(*host_.get(),
571 OnStreamGenerated(kRenderId, kPageRequestId, 0, 1));
568 572
569 // Generate second stream. 573 // Generate second stream.
570 EXPECT_CALL(*host_.get(), 574 EXPECT_CALL(*host_.get(),
571 OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1)); 575 OnStreamGenerated(kRenderId, kPageRequestId + 1, 0, 1));
572 576 }
573 base::RunLoop run_loop1; 577 base::RunLoop run_loop1;
574 base::RunLoop run_loop2; 578 base::RunLoop run_loop2;
575 host_->OnGenerateStream(kRenderId, kPageRequestId, options, origin_, 579 host_->OnGenerateStream(kRenderId, kPageRequestId, options, origin_,
576 run_loop1.QuitClosure()); 580 run_loop1.QuitClosure());
577 host_->OnGenerateStream(kRenderId, kPageRequestId + 1, options, origin_, 581 host_->OnGenerateStream(kRenderId, kPageRequestId + 1, options, origin_,
578 run_loop2.QuitClosure()); 582 run_loop2.QuitClosure());
579 583
580 run_loop1.Run(); 584 run_loop1.Run();
581 run_loop2.Run(); 585 run_loop2.Run();
582 } 586 }
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { 904 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) {
901 MockResourceContext* mock_resource_context = 905 MockResourceContext* mock_resource_context =
902 static_cast<MockResourceContext*>(browser_context_.GetResourceContext()); 906 static_cast<MockResourceContext*>(browser_context_.GetResourceContext());
903 mock_resource_context->set_camera_access(false); 907 mock_resource_context->set_camera_access(false);
904 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, 908 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
905 MEDIA_DEVICE_VIDEO_CAPTURE); 909 MEDIA_DEVICE_VIDEO_CAPTURE);
906 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); 910 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_));
907 } 911 }
908 912
909 }; // namespace content 913 }; // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_getusermedia_browsertest.cc ('k') | content/browser/renderer_host/media/media_stream_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698