OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <string> | |
6 | |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "base/message_loop.h" | |
9 #include "base/utf_string_conversions.h" | |
10 #include "content/renderer/media/media_stream_impl.h" | |
11 #include "content/renderer/media/mock_media_stream_dependency_factory.h" | |
12 #include "content/renderer/media/mock_media_stream_dispatcher.h" | |
13 #include "content/renderer/media/mock_web_peer_connection_handler_client.h" | |
14 #include "content/renderer/media/video_capture_impl_manager.h" | |
15 #include "content/renderer/p2p/socket_dispatcher.h" | |
16 #include "testing/gtest/include/gtest/gtest.h" | |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPeerConnectionHand ler.h" | |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | |
21 | |
22 TEST(MediaStreamImplTest, Basic) { | |
23 MessageLoop loop; | |
24 | |
25 // Create our test object. | |
26 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher( | |
27 new MockMediaStreamDispatcher()); | |
28 scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher( | |
29 new content::P2PSocketDispatcher(NULL)); | |
30 scoped_refptr<VideoCaptureImplManager> vc_manager( | |
31 new VideoCaptureImplManager()); | |
32 MockMediaStreamDependencyFactory* dependency_factory = | |
33 new MockMediaStreamDependencyFactory(); | |
34 scoped_refptr<MediaStreamImpl> ms_impl(new MediaStreamImpl( | |
35 ms_dispatcher.get(), | |
36 p2p_socket_dispatcher.get(), | |
37 vc_manager.get(), | |
38 dependency_factory)); | |
39 | |
40 // TODO(grunell): Add tests for functions going to WebKit. Waiting for WebKit | |
41 // patches that changes the interface. | |
42 | |
43 // TODO(grunell): Enable and update implementation when available again. | |
44 // int request_id(1); | |
tommi (sloooow) - chröme
2011/11/08 12:27:24
remove?
Henrik Grunell
2011/11/08 22:06:41
Done.
| |
45 // WebKit::WebGenerateStreamOptionFlags flags = | |
46 // WebKit::WebGenerateStreamRequestAudio | | |
47 // WebKit::WebGenerateStreamRequestVideoFacingUser; | |
48 // WebKit::WebSecurityOrigin web_security_origin = | |
49 // WebKit::WebSecurityOrigin::create(WebKit::WebURL()); | |
50 // ms_impl->generateStream(request_id, flags, web_security_origin); | |
51 // EXPECT_EQ(ms_dispatcher->request_id(), request_id); | |
52 // EXPECT_TRUE(ms_dispatcher->components()->audio); | |
53 // EXPECT_EQ(ms_dispatcher->components()->video_option, | |
54 // media_stream::StreamOptions::kFacingUser); | |
55 | |
56 WebKit::MockWebPeerConnectionHandlerClient client; | |
57 // WebKit::WebPeerConnectionHandler* handler = | |
58 ms_impl->CreatePeerConnectionHandler(&client); | |
59 EXPECT_TRUE(ms_impl->peer_connection_handler_.get()); | |
60 | |
61 // webrtc::MockPeerConnectionImpl* mock_peer_connection = | |
62 // static_cast<webrtc::MockPeerConnectionImpl*>( | |
63 // ms_impl->peer_connection_handler_.get()); | |
64 | |
65 ms_impl->ClosePeerConnection(); | |
66 EXPECT_FALSE(ms_impl->peer_connection_handler_.get()); | |
67 } | |
OLD | NEW |