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> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 9 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 VerifyRtpReceivers(left_tab_, 2); | 66 VerifyRtpReceivers(left_tab_, 2); |
67 VerifyRtpReceivers(right_tab_, 6); | 67 VerifyRtpReceivers(right_tab_, 6); |
68 } | 68 } |
69 | 69 |
70 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, AddAndRemoveTracksWithoutStream) { | 70 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, AddAndRemoveTracksWithoutStream) { |
71 StartServerAndOpenTabs(); | 71 StartServerAndOpenTabs(); |
72 | 72 |
73 SetupPeerconnectionWithoutLocalStream(left_tab_); | 73 SetupPeerconnectionWithoutLocalStream(left_tab_); |
74 SetupPeerconnectionWithoutLocalStream(right_tab_); | 74 SetupPeerconnectionWithoutLocalStream(right_tab_); |
| 75 SetupOnTrackListener(right_tab_); |
75 | 76 |
76 // TODO(hbos): Here and in other "AddAndRemoveTracks" tests: when ontrack and | 77 // TODO(hbos): Here and in other "AddAndRemoveTracks" tests: when ontrack and |
77 // ended events are supported, verify that these are fired on the remote side | 78 // ended events are supported, verify that these are fired on the remote side |
78 // when tracks are added and removed. https://crbug.com/webrtc/7933 | 79 // when tracks are added and removed. https://crbug.com/webrtc/7933 |
79 | 80 |
80 // Add two tracks. | 81 // Add two tracks. |
81 EXPECT_EQ(0u, GetNegotiationNeededCount(left_tab_)); | 82 EXPECT_EQ(0u, GetNegotiationNeededCount(left_tab_)); |
82 std::vector<std::string> ids = | 83 std::vector<std::string> ids = |
83 CreateAndAddAudioAndVideoTrack(left_tab_, StreamArgumentType::NO_STREAM); | 84 CreateAndAddAudioAndVideoTrack(left_tab_, StreamArgumentType::NO_STREAM); |
84 // TODO(hbos): Should only fire once (if the "negotiationneeded" bit changes | 85 // TODO(hbos): Should only fire once (if the "negotiationneeded" bit changes |
(...skipping 17 matching lines...) Expand all Loading... |
102 // Negotiate call, sets remote description. | 103 // Negotiate call, sets remote description. |
103 NegotiateCall(left_tab_, right_tab_); | 104 NegotiateCall(left_tab_, right_tab_); |
104 // TODO(hbos): When |addTrack| without streams results in SDP that does not | 105 // TODO(hbos): When |addTrack| without streams results in SDP that does not |
105 // signal a remote stream to be added this should be EXPECT_FALSE. | 106 // signal a remote stream to be added this should be EXPECT_FALSE. |
106 // https://crbug.com/webrtc/7933 | 107 // https://crbug.com/webrtc/7933 |
107 EXPECT_TRUE(HasRemoteStreamWithTrack(right_tab_, kUndefined, audio_track_id)); | 108 EXPECT_TRUE(HasRemoteStreamWithTrack(right_tab_, kUndefined, audio_track_id)); |
108 EXPECT_TRUE(HasRemoteStreamWithTrack(right_tab_, kUndefined, video_track_id)); | 109 EXPECT_TRUE(HasRemoteStreamWithTrack(right_tab_, kUndefined, video_track_id)); |
109 EXPECT_TRUE(HasReceiverWithTrack(right_tab_, audio_track_id)); | 110 EXPECT_TRUE(HasReceiverWithTrack(right_tab_, audio_track_id)); |
110 EXPECT_TRUE(HasReceiverWithTrack(right_tab_, video_track_id)); | 111 EXPECT_TRUE(HasReceiverWithTrack(right_tab_, video_track_id)); |
111 VerifyRtpReceivers(right_tab_, 2); | 112 VerifyRtpReceivers(right_tab_, 2); |
| 113 std::vector<TrackEvent> track_events = GetTrackEvents(right_tab_); |
| 114 for (TrackEvent& track_event : track_events) { |
| 115 printf("HBOS: track_id: %s", track_event.track_id.c_str()); |
| 116 if (!track_event.stream_ids.empty()) { |
| 117 for (std::string& stream_id : track_event.stream_ids) |
| 118 printf(" %s", stream_id.c_str()); |
| 119 } |
| 120 printf("\n"); |
| 121 } |
112 | 122 |
113 // Remove first track. | 123 // Remove first track. |
114 RemoveTrack(left_tab_, audio_track_id); | 124 RemoveTrack(left_tab_, audio_track_id); |
115 EXPECT_EQ(3u, GetNegotiationNeededCount(left_tab_)); | 125 EXPECT_EQ(3u, GetNegotiationNeededCount(left_tab_)); |
116 EXPECT_FALSE(HasSenderWithTrack(left_tab_, audio_track_id)); | 126 EXPECT_FALSE(HasSenderWithTrack(left_tab_, audio_track_id)); |
117 EXPECT_TRUE(HasSenderWithTrack(left_tab_, video_track_id)); | 127 EXPECT_TRUE(HasSenderWithTrack(left_tab_, video_track_id)); |
118 VerifyRtpSenders(left_tab_, 1); | 128 VerifyRtpSenders(left_tab_, 1); |
119 // Re-negotiate call, sets remote description again. | 129 // Re-negotiate call, sets remote description again. |
120 NegotiateCall(left_tab_, right_tab_); | 130 NegotiateCall(left_tab_, right_tab_); |
121 EXPECT_FALSE( | 131 EXPECT_FALSE( |
(...skipping 19 matching lines...) Expand all Loading... |
141 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, video_track_id)); | 151 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, video_track_id)); |
142 VerifyRtpReceivers(right_tab_, 0); | 152 VerifyRtpReceivers(right_tab_, 0); |
143 } | 153 } |
144 | 154 |
145 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, | 155 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, |
146 AddAndRemoveTracksWithSharedStream) { | 156 AddAndRemoveTracksWithSharedStream) { |
147 StartServerAndOpenTabs(); | 157 StartServerAndOpenTabs(); |
148 | 158 |
149 SetupPeerconnectionWithoutLocalStream(left_tab_); | 159 SetupPeerconnectionWithoutLocalStream(left_tab_); |
150 SetupPeerconnectionWithoutLocalStream(right_tab_); | 160 SetupPeerconnectionWithoutLocalStream(right_tab_); |
| 161 SetupOnTrackListener(right_tab_); |
151 | 162 |
152 // Add two tracks. | 163 // Add two tracks. |
153 EXPECT_EQ(0u, GetNegotiationNeededCount(left_tab_)); | 164 EXPECT_EQ(0u, GetNegotiationNeededCount(left_tab_)); |
154 std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack( | 165 std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack( |
155 left_tab_, StreamArgumentType::SHARED_STREAM); | 166 left_tab_, StreamArgumentType::SHARED_STREAM); |
156 // TODO(hbos): Should only fire once (if the "negotiationneeded" bit changes | 167 // TODO(hbos): Should only fire once (if the "negotiationneeded" bit changes |
157 // from false to true), not once per track added. https://crbug.com/740501 | 168 // from false to true), not once per track added. https://crbug.com/740501 |
158 EXPECT_EQ(2u, GetNegotiationNeededCount(left_tab_)); | 169 EXPECT_EQ(2u, GetNegotiationNeededCount(left_tab_)); |
159 std::string audio_stream_id = ids[0]; | 170 std::string audio_stream_id = ids[0]; |
160 std::string audio_track_id = ids[1]; | 171 std::string audio_track_id = ids[1]; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, video_track_id)); | 228 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, video_track_id)); |
218 VerifyRtpReceivers(right_tab_, 0); | 229 VerifyRtpReceivers(right_tab_, 0); |
219 } | 230 } |
220 | 231 |
221 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, | 232 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, |
222 AddAndRemoveTracksWithIndividualStreams) { | 233 AddAndRemoveTracksWithIndividualStreams) { |
223 StartServerAndOpenTabs(); | 234 StartServerAndOpenTabs(); |
224 | 235 |
225 SetupPeerconnectionWithoutLocalStream(left_tab_); | 236 SetupPeerconnectionWithoutLocalStream(left_tab_); |
226 SetupPeerconnectionWithoutLocalStream(right_tab_); | 237 SetupPeerconnectionWithoutLocalStream(right_tab_); |
| 238 SetupOnTrackListener(right_tab_); |
227 | 239 |
228 // Add two tracks. | 240 // Add two tracks. |
229 EXPECT_EQ(0u, GetNegotiationNeededCount(left_tab_)); | 241 EXPECT_EQ(0u, GetNegotiationNeededCount(left_tab_)); |
230 std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack( | 242 std::vector<std::string> ids = CreateAndAddAudioAndVideoTrack( |
231 left_tab_, StreamArgumentType::INDIVIDUAL_STREAMS); | 243 left_tab_, StreamArgumentType::INDIVIDUAL_STREAMS); |
232 // TODO(hbos): Should only fire once (if the "negotiationneeded" bit changes | 244 // TODO(hbos): Should only fire once (if the "negotiationneeded" bit changes |
233 // from false to true), not once per track added. https://crbug.com/740501 | 245 // from false to true), not once per track added. https://crbug.com/740501 |
234 EXPECT_EQ(2u, GetNegotiationNeededCount(left_tab_)); | 246 EXPECT_EQ(2u, GetNegotiationNeededCount(left_tab_)); |
235 std::string audio_stream_id = ids[0]; | 247 std::string audio_stream_id = ids[0]; |
236 std::string audio_track_id = ids[1]; | 248 std::string audio_track_id = ids[1]; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // Re-negotiate call, sets remote description again. | 298 // Re-negotiate call, sets remote description again. |
287 NegotiateCall(left_tab_, right_tab_); | 299 NegotiateCall(left_tab_, right_tab_); |
288 EXPECT_FALSE( | 300 EXPECT_FALSE( |
289 HasRemoteStreamWithTrack(right_tab_, audio_stream_id, audio_track_id)); | 301 HasRemoteStreamWithTrack(right_tab_, audio_stream_id, audio_track_id)); |
290 EXPECT_FALSE( | 302 EXPECT_FALSE( |
291 HasRemoteStreamWithTrack(right_tab_, video_stream_id, video_track_id)); | 303 HasRemoteStreamWithTrack(right_tab_, video_stream_id, video_track_id)); |
292 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, audio_track_id)); | 304 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, audio_track_id)); |
293 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, video_track_id)); | 305 EXPECT_FALSE(HasReceiverWithTrack(right_tab_, video_track_id)); |
294 VerifyRtpReceivers(right_tab_, 0); | 306 VerifyRtpReceivers(right_tab_, 0); |
295 } | 307 } |
OLD | NEW |