| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 6 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
| 7 #include "content/public/common/content_switches.h" | 7 #include "content/public/common/content_switches.h" |
| 8 #include "media/base/media_switches.h" | 8 #include "media/base/media_switches.h" |
| 9 | 9 |
| 10 static const char kMainWebrtcTestHtmlPage[] = "/webrtc/webrtc_jsep01_test.html"; | 10 static const char kMainWebrtcTestHtmlPage[] = "/webrtc/webrtc_jsep01_test.html"; |
| 11 | 11 |
| 12 class WebRtcRtpBrowserTest : public WebRtcTestBase { | 12 class WebRtcRtpBrowserTest : public WebRtcTestBase { |
| 13 public: | 13 public: |
| 14 WebRtcRtpBrowserTest() : left_tab_(nullptr), right_tab_(nullptr) {} | 14 WebRtcRtpBrowserTest() : left_tab_(nullptr), right_tab_(nullptr) {} |
| 15 | 15 |
| 16 void SetUpInProcessBrowserTestFixture() override { | 16 void SetUpInProcessBrowserTestFixture() override { |
| 17 DetectErrorsInJavaScript(); | 17 DetectErrorsInJavaScript(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void SetUpCommandLine(base::CommandLine* command_line) override { | 20 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 21 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 21 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 22 command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, |
| 23 "RTCRtpSender"); |
| 22 } | 24 } |
| 23 | 25 |
| 24 protected: | 26 protected: |
| 25 void StartServerAndOpenTabs() { | 27 void StartServerAndOpenTabs() { |
| 26 ASSERT_TRUE(embedded_test_server()->Start()); | 28 ASSERT_TRUE(embedded_test_server()->Start()); |
| 27 left_tab_ = OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 29 left_tab_ = OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 28 right_tab_ = OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 30 right_tab_ = OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 29 } | 31 } |
| 30 | 32 |
| 31 content::WebContents* left_tab_; | 33 content::WebContents* left_tab_; |
| 32 content::WebContents* right_tab_; | 34 content::WebContents* right_tab_; |
| 33 }; | 35 }; |
| 34 | 36 |
| 37 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, GetSenders) { |
| 38 StartServerAndOpenTabs(); |
| 39 |
| 40 SetupPeerconnectionWithoutLocalStream(left_tab_); |
| 41 CreateAndAddStreams(left_tab_, 3); |
| 42 |
| 43 SetupPeerconnectionWithoutLocalStream(right_tab_); |
| 44 CreateAndAddStreams(right_tab_, 1); |
| 45 |
| 46 NegotiateCall(left_tab_, right_tab_); |
| 47 |
| 48 VerifyRtpSenders(left_tab_, 6); |
| 49 VerifyRtpSenders(right_tab_, 2); |
| 50 } |
| 51 |
| 35 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, GetReceivers) { | 52 IN_PROC_BROWSER_TEST_F(WebRtcRtpBrowserTest, GetReceivers) { |
| 36 StartServerAndOpenTabs(); | 53 StartServerAndOpenTabs(); |
| 37 | 54 |
| 38 SetupPeerconnectionWithoutLocalStream(left_tab_); | 55 SetupPeerconnectionWithoutLocalStream(left_tab_); |
| 39 CreateAndAddStreams(left_tab_, 3); | 56 CreateAndAddStreams(left_tab_, 3); |
| 40 | 57 |
| 41 SetupPeerconnectionWithoutLocalStream(right_tab_); | 58 SetupPeerconnectionWithoutLocalStream(right_tab_); |
| 42 CreateAndAddStreams(right_tab_, 1); | 59 CreateAndAddStreams(right_tab_, 1); |
| 43 | 60 |
| 44 NegotiateCall(left_tab_, right_tab_); | 61 NegotiateCall(left_tab_, right_tab_); |
| 45 | 62 |
| 46 VerifyRtpReceivers(left_tab_, 2); | 63 VerifyRtpReceivers(left_tab_, 2); |
| 47 VerifyRtpReceivers(right_tab_, 6); | 64 VerifyRtpReceivers(right_tab_, 6); |
| 48 } | 65 } |
| OLD | NEW |