| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/win/windows_version.h" | 6 #include "base/win/windows_version.h" |
| 7 #include "chrome/browser/media/webrtc_browsertest_base.h" | 7 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 8 #include "chrome/browser/media/webrtc_browsertest_common.h" | 8 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 9 #include "chrome/common/chrome_version_info.h" | 9 #include "chrome/common/chrome_version_info.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // detected until a branch has been promoted to another channel. The unit | 25 // detected until a branch has been promoted to another channel. The unit |
| 26 // test for ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch | 26 // test for ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch |
| 27 // tests for all channels however. | 27 // tests for all channels however. |
| 28 // TODO(grunell): Test the different channel cases for any build. | 28 // TODO(grunell): Test the different channel cases for any build. |
| 29 class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase { | 29 class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase { |
| 30 public: | 30 public: |
| 31 WebRtcDisableEncryptionFlagBrowserTest() {} | 31 WebRtcDisableEncryptionFlagBrowserTest() {} |
| 32 virtual ~WebRtcDisableEncryptionFlagBrowserTest() {} | 32 virtual ~WebRtcDisableEncryptionFlagBrowserTest() {} |
| 33 | 33 |
| 34 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 34 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 35 test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); | |
| 36 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 35 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 37 } | 36 } |
| 38 | 37 |
| 39 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 38 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 40 // This test should run with fake devices. | 39 // This test should run with fake devices. |
| 41 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 40 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 42 | 41 |
| 43 // Disable encryption with the command line flag. | 42 // Disable encryption with the command line flag. |
| 44 command_line->AppendSwitch(switches::kDisableWebRtcEncryption); | 43 command_line->AppendSwitch(switches::kDisableWebRtcEncryption); |
| 45 } | 44 } |
| 46 | 45 |
| 47 protected: | |
| 48 test::PeerConnectionServerRunner peerconnection_server_; | |
| 49 | |
| 50 private: | 46 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(WebRtcDisableEncryptionFlagBrowserTest); | 47 DISALLOW_COPY_AND_ASSIGN(WebRtcDisableEncryptionFlagBrowserTest); |
| 52 }; | 48 }; |
| 53 | 49 |
| 54 // Makes a call and checks that there's encryption or not in the SDP offer. | 50 // Makes a call and checks that there's encryption or not in the SDP offer. |
| 55 // TODO(phoglund): this is unreliable on non-webrtc bots because its peer | 51 // TODO(phoglund): this is unreliable on non-webrtc bots because its peer |
| 56 // connection server could clash with other tests running in parallel, | 52 // connection server could clash with other tests running in parallel, |
| 57 // therefore only running manually. http://crbug.com/358207. | 53 // therefore only running manually. http://crbug.com/358207. |
| 58 IN_PROC_BROWSER_TEST_F(WebRtcDisableEncryptionFlagBrowserTest, | 54 IN_PROC_BROWSER_TEST_F(WebRtcDisableEncryptionFlagBrowserTest, |
| 59 MANUAL_VerifyEncryption) { | 55 MANUAL_VerifyEncryption) { |
| 60 // Flaky timeout on a webrtc Win XP bot. http://crbug.com/368163. | 56 // Flaky timeout on a webrtc Win XP bot. http://crbug.com/368163. |
| 61 #if defined (OS_WIN) | 57 #if defined (OS_WIN) |
| 62 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 58 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 63 return; | 59 return; |
| 64 #endif | 60 #endif |
| 65 | 61 |
| 66 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 62 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 67 ASSERT_TRUE(peerconnection_server_.Start()); | |
| 68 | 63 |
| 69 content::WebContents* left_tab = | 64 content::WebContents* left_tab = |
| 70 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 65 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 71 content::WebContents* right_tab = | 66 content::WebContents* right_tab = |
| 72 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 67 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 73 | 68 |
| 74 EstablishCall(left_tab, right_tab); | 69 SetupPeerconnectionWithLocalStream(left_tab); |
| 70 SetupPeerconnectionWithLocalStream(right_tab); |
| 71 |
| 72 NegotiateCall(left_tab, right_tab); |
| 75 | 73 |
| 76 StartDetectingVideo(left_tab, "remote-view"); | 74 StartDetectingVideo(left_tab, "remote-view"); |
| 77 StartDetectingVideo(right_tab, "remote-view"); | 75 StartDetectingVideo(right_tab, "remote-view"); |
| 78 | 76 |
| 79 WaitForVideoToPlay(left_tab); | 77 WaitForVideoToPlay(left_tab); |
| 80 WaitForVideoToPlay(right_tab); | 78 WaitForVideoToPlay(right_tab); |
| 81 | 79 |
| 82 bool should_detect_encryption = true; | 80 bool should_detect_encryption = true; |
| 83 VersionInfo::Channel channel = VersionInfo::GetChannel(); | 81 VersionInfo::Channel channel = VersionInfo::GetChannel(); |
| 84 if (channel == VersionInfo::CHANNEL_UNKNOWN || | 82 if (channel == VersionInfo::CHANNEL_UNKNOWN || |
| 85 channel == VersionInfo::CHANNEL_CANARY || | 83 channel == VersionInfo::CHANNEL_CANARY || |
| 86 channel == VersionInfo::CHANNEL_DEV) { | 84 channel == VersionInfo::CHANNEL_DEV) { |
| 87 should_detect_encryption = false; | 85 should_detect_encryption = false; |
| 88 } | 86 } |
| 89 #if defined(OS_ANDROID) | 87 #if defined(OS_ANDROID) |
| 90 if (channel == VersionInfo::CHANNEL_BETA) | 88 if (channel == VersionInfo::CHANNEL_BETA) |
| 91 should_detect_encryption = false; | 89 should_detect_encryption = false; |
| 92 #endif | 90 #endif |
| 93 | 91 |
| 94 std::string expected_string = should_detect_encryption ? | 92 std::string expected_string = should_detect_encryption ? |
| 95 "crypto-seen" : "no-crypto-seen"; | 93 "crypto-seen" : "no-crypto-seen"; |
| 96 | 94 |
| 97 ASSERT_EQ(expected_string, | 95 ASSERT_EQ(expected_string, |
| 98 ExecuteJavascript("hasSeenCryptoInSdp()", left_tab)); | 96 ExecuteJavascript("hasSeenCryptoInSdp()", left_tab)); |
| 99 | 97 |
| 100 HangUp(left_tab); | 98 HangUp(left_tab); |
| 101 WaitUntilHangupVerified(left_tab); | |
| 102 WaitUntilHangupVerified(right_tab); | |
| 103 | |
| 104 ASSERT_TRUE(peerconnection_server_.Stop()); | |
| 105 } | 99 } |
| OLD | NEW |