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

Side by Side Diff: content/renderer/media/media_stream_dependency_factory_unittest.cc

Issue 10703095: New PeerConnection handler in Chrome to support latest PeerConnection draft (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Readd the UMA histogram for Deprecated PeerConnection to not screw up the stats. Created 8 years, 3 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "content/common/media/media_stream_options.h" 6 #include "content/common/media/media_stream_options.h"
7 #include "content/renderer/media/media_stream_extra_data.h" 7 #include "content/renderer/media/media_stream_extra_data.h"
8 #include "content/renderer/media/media_stream_source_extra_data.h" 8 #include "content/renderer/media/media_stream_source_extra_data.h"
9 #include "content/renderer/media/mock_media_stream_dependency_factory.h" 9 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
10 #include "content/renderer/media/mock_web_peer_connection_00_handler_client.h" 10 #include "content/renderer/media/mock_web_peer_connection_00_handler_client.h"
11 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amComponent.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCompo nent.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamDescr iptor.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00Handler.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebPeerConnection00 Handler.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebPeerConnectionHa ndler.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectio nHandler.h"
18 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
19 20
20 class MediaStreamDependencyFactoryTest : public ::testing::Test { 21 class MediaStreamDependencyFactoryTest : public ::testing::Test {
21 public: 22 public:
22 void SetUp() { 23 void SetUp() {
23 dependency_factory_.reset(new MockMediaStreamDependencyFactory()); 24 dependency_factory_.reset(new MockMediaStreamDependencyFactory());
24 } 25 }
25 26
26 WebKit::WebMediaStreamDescriptor CreateWebKitMediaStream(bool audio, 27 WebKit::WebMediaStreamDescriptor CreateWebKitMediaStream(bool audio,
27 bool video) { 28 bool video) {
28 WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources( 29 WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources(
(...skipping 27 matching lines...) Expand all
56 stream_desc.initialize("media stream", audio_sources, video_sources); 57 stream_desc.initialize("media stream", audio_sources, video_sources);
57 58
58 return stream_desc; 59 return stream_desc;
59 } 60 }
60 61
61 protected: 62 protected:
62 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_; 63 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_;
63 }; 64 };
64 65
65 TEST_F(MediaStreamDependencyFactoryTest, CreatePeerConnectionHandlerJsep) { 66 TEST_F(MediaStreamDependencyFactoryTest, CreatePeerConnectionHandlerJsep) {
66 // Create JSEP PeerConnection.
67 WebKit::MockWebPeerConnection00HandlerClient client_jsep; 67 WebKit::MockWebPeerConnection00HandlerClient client_jsep;
68 scoped_ptr<WebKit::WebPeerConnection00Handler> pc_handler_jsep( 68 scoped_ptr<WebKit::WebPeerConnection00Handler> pc_handler_jsep(
69 dependency_factory_->CreatePeerConnectionHandlerJsep(&client_jsep)); 69 dependency_factory_->CreatePeerConnectionHandlerJsep(&client_jsep));
70 EXPECT_TRUE(pc_handler_jsep.get() != NULL); 70 EXPECT_TRUE(pc_handler_jsep.get() != NULL);
71 pc_handler_jsep.reset(); 71 }
72
73 TEST_F(MediaStreamDependencyFactoryTest, CreateRTCPeerConnectionHandler) {
74 WebKit::MockWebRTCPeerConnectionHandlerClient client_jsep;
75 scoped_ptr<WebKit::WebRTCPeerConnectionHandler> pc_handler(
76 dependency_factory_->CreateRTCPeerConnectionHandler(&client_jsep));
77 EXPECT_TRUE(pc_handler.get() != NULL);
72 } 78 }
73 79
74 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStream) { 80 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStream) {
75 WebKit::WebMediaStreamDescriptor stream_desc = CreateWebKitMediaStream(true, 81 WebKit::WebMediaStreamDescriptor stream_desc = CreateWebKitMediaStream(true,
76 true); 82 true);
77 EXPECT_TRUE(dependency_factory_->CreateNativeLocalMediaStream(&stream_desc)); 83 EXPECT_TRUE(dependency_factory_->CreateNativeLocalMediaStream(&stream_desc));
78 84
79 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( 85 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>(
80 stream_desc.extraData()); 86 stream_desc.extraData());
81 ASSERT_TRUE(extra_data && extra_data->local_stream()); 87 ASSERT_TRUE(extra_data && extra_data->local_stream());
(...skipping 19 matching lines...) Expand all
101 "something"); 107 "something");
102 stream_desc.initialize("new stream", audio_sources, video_sources); 108 stream_desc.initialize("new stream", audio_sources, video_sources);
103 109
104 EXPECT_TRUE(dependency_factory_->CreateNativeLocalMediaStream(&stream_desc)); 110 EXPECT_TRUE(dependency_factory_->CreateNativeLocalMediaStream(&stream_desc));
105 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( 111 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>(
106 stream_desc.extraData()); 112 stream_desc.extraData());
107 ASSERT_TRUE(extra_data && extra_data->local_stream()); 113 ASSERT_TRUE(extra_data && extra_data->local_stream());
108 EXPECT_EQ(0u, extra_data->local_stream()->video_tracks()->count()); 114 EXPECT_EQ(0u, extra_data->local_stream()->video_tracks()->count());
109 EXPECT_EQ(0u, extra_data->local_stream()->audio_tracks()->count()); 115 EXPECT_EQ(0u, extra_data->local_stream()->audio_tracks()->count());
110 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698