OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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> | |
6 #include <vector> | |
7 | |
5 #include "base/command_line.h" | 8 #include "base/command_line.h" |
6 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 9 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
7 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
8 #include "media/base/media_switches.h" | 11 #include "media/base/media_switches.h" |
9 | 12 |
10 static const char kMainWebrtcTestHtmlPage[] = "/webrtc/webrtc_jsep01_test.html"; | 13 static const char kMainWebrtcTestHtmlPage[] = "/webrtc/webrtc_jsep01_test.html"; |
11 | 14 |
12 class WebRtcRtpBrowserTest : public WebRtcTestBase { | 15 class WebRtcRtpBrowserTest : public WebRtcTestBase { |
13 public: | 16 public: |
14 WebRtcRtpBrowserTest() : left_tab_(nullptr), right_tab_(nullptr) {} | 17 WebRtcRtpBrowserTest() : left_tab_(nullptr), right_tab_(nullptr) {} |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 CreateAndAddStreams(left_tab_, 3); | 59 CreateAndAddStreams(left_tab_, 3); |
57 | 60 |
58 SetupPeerconnectionWithoutLocalStream(right_tab_); | 61 SetupPeerconnectionWithoutLocalStream(right_tab_); |
59 CreateAndAddStreams(right_tab_, 1); | 62 CreateAndAddStreams(right_tab_, 1); |
60 | 63 |
61 NegotiateCall(left_tab_, right_tab_); | 64 NegotiateCall(left_tab_, right_tab_); |
62 | 65 |
63 VerifyRtpReceivers(left_tab_, 2); | 66 VerifyRtpReceivers(left_tab_, 2); |
64 VerifyRtpReceivers(right_tab_, 6); | 67 VerifyRtpReceivers(right_tab_, 6); |
65 } | 68 } |
69 | |
70 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, AddAndRemoveTracksWithoutStream) { | |
71 StartServerAndOpenTabs(); | |
72 | |
73 SetupPeerconnectionWithoutLocalStream(left_tab_); | |
74 SetupPeerconnectionWithoutLocalStream(right_tab_); | |
75 | |
76 std::vector<std::string> ids = | |
77 CreateAndAddAudioAndVideoTrack(left_tab_, StreamArgumentType::NO_STREAM); | |
78 std::string audio_stream_id = ids[0]; | |
79 std::string audio_track_id = ids[1]; | |
80 std::string video_stream_id = ids[2]; | |
81 std::string video_track_id = ids[3]; | |
82 EXPECT_NE("null", audio_stream_id); | |
Taylor_Brandstetter
2017/07/06 22:45:14
I think we should fix this before we ship the feat
hbos_chromium
2017/07/07 12:07:47
SGTM. Will fix before unflagging. Added a TODO.
T
| |
83 EXPECT_NE("null", audio_track_id); | |
84 EXPECT_NE("null", video_stream_id); | |
85 EXPECT_NE("null", video_track_id); | |
86 EXPECT_NE(audio_stream_id, video_stream_id); | |
87 | |
88 NegotiateCall(left_tab_, right_tab_); | |
89 VerifyRtpSenders(left_tab_, 2); | |
90 VerifyRtpReceivers(right_tab_, 2); | |
91 | |
92 RemoveTrack(left_tab_, audio_track_id); | |
93 NegotiateCall(left_tab_, right_tab_); | |
94 VerifyRtpSenders(left_tab_, 1); | |
95 VerifyRtpReceivers(right_tab_, 1); | |
96 | |
97 RemoveTrack(left_tab_, video_track_id); | |
98 NegotiateCall(left_tab_, right_tab_); | |
99 VerifyRtpSenders(left_tab_, 0); | |
100 VerifyRtpReceivers(right_tab_, 0); | |
101 } | |
102 | |
103 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, | |
104 AddAndRemoveTracksWithSharedStream) { | |
105 StartServerAndOpenTabs(); | |
106 | |
107 SetupPeerconnectionWithoutLocalStream(left_tab_); | |
108 SetupPeerconnectionWithoutLocalStream(right_tab_); | |
109 | |
110 std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack( | |
111 left_tab_, StreamArgumentType::SHARED_STREAM); | |
112 std::string audio_stream_id = ids[0]; | |
113 std::string audio_track_id = ids[1]; | |
114 std::string video_stream_id = ids[2]; | |
115 std::string video_track_id = ids[3]; | |
116 EXPECT_NE("null", audio_stream_id); | |
117 EXPECT_EQ(audio_stream_id, video_stream_id); | |
118 EXPECT_NE("null", audio_track_id); | |
119 EXPECT_NE("null", video_track_id); | |
120 | |
121 NegotiateCall(left_tab_, right_tab_); | |
122 // TODO(hbos): Here and in other "AddAndRemoveTracks" tests: when ontrack and | |
123 // ended events are supported, verify that these are fired on the remote side | |
124 // when tracks are added and removed. https://crbug.com/webrtc/7933 | |
125 VerifyRtpSenders(left_tab_, 2); | |
126 VerifyRtpReceivers(right_tab_, 2); | |
127 | |
128 RemoveTrack(left_tab_, audio_track_id); | |
129 NegotiateCall(left_tab_, right_tab_); | |
130 VerifyRtpSenders(left_tab_, 1); | |
131 VerifyRtpReceivers(right_tab_, 1); | |
132 | |
133 RemoveTrack(left_tab_, video_track_id); | |
134 NegotiateCall(left_tab_, right_tab_); | |
135 VerifyRtpSenders(left_tab_, 0); | |
136 VerifyRtpReceivers(right_tab_, 0); | |
137 } | |
138 | |
139 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, | |
140 AddAndRemoveTracksWithIndividualStreams) { | |
141 StartServerAndOpenTabs(); | |
142 | |
143 SetupPeerconnectionWithoutLocalStream(left_tab_); | |
144 SetupPeerconnectionWithoutLocalStream(right_tab_); | |
145 | |
146 std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack( | |
147 left_tab_, StreamArgumentType::INDIVIDUAL_STREAMS); | |
148 std::string audio_stream_id = ids[0]; | |
149 std::string audio_track_id = ids[1]; | |
150 std::string video_stream_id = ids[2]; | |
151 std::string video_track_id = ids[3]; | |
152 EXPECT_NE("null", audio_stream_id); | |
153 EXPECT_NE("null", audio_track_id); | |
154 EXPECT_NE("null", video_stream_id); | |
155 EXPECT_NE("null", video_track_id); | |
156 EXPECT_NE(audio_stream_id, video_stream_id); | |
157 | |
158 NegotiateCall(left_tab_, right_tab_); | |
159 VerifyRtpSenders(left_tab_, 2); | |
160 VerifyRtpReceivers(right_tab_, 2); | |
161 | |
162 RemoveTrack(left_tab_, audio_track_id); | |
163 NegotiateCall(left_tab_, right_tab_); | |
164 VerifyRtpSenders(left_tab_, 1); | |
165 VerifyRtpReceivers(right_tab_, 1); | |
166 | |
167 RemoveTrack(left_tab_, video_track_id); | |
168 NegotiateCall(left_tab_, right_tab_); | |
169 VerifyRtpSenders(left_tab_, 0); | |
170 VerifyRtpReceivers(right_tab_, 0); | |
171 } | |
OLD | NEW |