| 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 "chrome/browser/media/webrtc_browsertest_base.h" | 6 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 7 #include "chrome/browser/media/webrtc_browsertest_common.h" | 7 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 8 #include "chrome/common/chrome_version_info.h" | 8 #include "chrome/common/channel_info.h" |
| 9 #include "components/version_info/version_info.h" |
| 9 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 10 #include "media/base/media_switches.h" | 11 #include "media/base/media_switches.h" |
| 11 #include "net/test/embedded_test_server/embedded_test_server.h" | 12 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 12 | 13 |
| 13 static const char kMainWebrtcTestHtmlPage[] = | 14 static const char kMainWebrtcTestHtmlPage[] = |
| 14 "/webrtc/webrtc_jsep01_test.html"; | 15 "/webrtc/webrtc_jsep01_test.html"; |
| 15 | 16 |
| 16 using chrome::VersionInfo; | |
| 17 | |
| 18 // This tests the --disable-webrtc-encryption command line flag. Disabling | 17 // This tests the --disable-webrtc-encryption command line flag. Disabling |
| 19 // encryption should only be possible on certain channels. | 18 // encryption should only be possible on certain channels. |
| 20 | 19 |
| 21 // NOTE: The test case for each channel will only be exercised when the browser | 20 // NOTE: The test case for each channel will only be exercised when the browser |
| 22 // is actually built for that channel. This is not ideal. One can test manually | 21 // is actually built for that channel. This is not ideal. One can test manually |
| 23 // by e.g. faking the channel returned in VersionInfo::GetChannel(). It's | 22 // by e.g. faking the channel returned in chrome::GetChannel(). It's likely good |
| 24 // likely good to have the test anyway, even though a failure might not be | 23 // to have the test anyway, even though a failure might not be detected until a |
| 25 // detected until a branch has been promoted to another channel. The unit | 24 // branch has been promoted to another channel. The unit test for |
| 26 // test for ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch | 25 // ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch tests for |
| 27 // tests for all channels however. | 26 // all channels however. |
| 28 // TODO(grunell): Test the different channel cases for any build. | 27 // TODO(grunell): Test the different channel cases for any build. |
| 29 class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase { | 28 class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase { |
| 30 public: | 29 public: |
| 31 WebRtcDisableEncryptionFlagBrowserTest() {} | 30 WebRtcDisableEncryptionFlagBrowserTest() {} |
| 32 ~WebRtcDisableEncryptionFlagBrowserTest() override {} | 31 ~WebRtcDisableEncryptionFlagBrowserTest() override {} |
| 33 | 32 |
| 34 void SetUpInProcessBrowserTestFixture() override { | 33 void SetUpInProcessBrowserTestFixture() override { |
| 35 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 34 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 36 } | 35 } |
| 37 | 36 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 | 64 |
| 66 NegotiateCall(left_tab, right_tab); | 65 NegotiateCall(left_tab, right_tab); |
| 67 | 66 |
| 68 StartDetectingVideo(left_tab, "remote-view"); | 67 StartDetectingVideo(left_tab, "remote-view"); |
| 69 StartDetectingVideo(right_tab, "remote-view"); | 68 StartDetectingVideo(right_tab, "remote-view"); |
| 70 | 69 |
| 71 WaitForVideoToPlay(left_tab); | 70 WaitForVideoToPlay(left_tab); |
| 72 WaitForVideoToPlay(right_tab); | 71 WaitForVideoToPlay(right_tab); |
| 73 | 72 |
| 74 bool should_detect_encryption = true; | 73 bool should_detect_encryption = true; |
| 75 version_info::Channel channel = VersionInfo::GetChannel(); | 74 version_info::Channel channel = chrome::GetChannel(); |
| 76 if (channel == version_info::Channel::UNKNOWN || | 75 if (channel == version_info::Channel::UNKNOWN || |
| 77 channel == version_info::Channel::CANARY || | 76 channel == version_info::Channel::CANARY || |
| 78 channel == version_info::Channel::DEV) { | 77 channel == version_info::Channel::DEV) { |
| 79 should_detect_encryption = false; | 78 should_detect_encryption = false; |
| 80 } | 79 } |
| 81 #if defined(OS_ANDROID) | 80 #if defined(OS_ANDROID) |
| 82 if (channel == version_info::Channel::BETA) | 81 if (channel == version_info::Channel::BETA) |
| 83 should_detect_encryption = false; | 82 should_detect_encryption = false; |
| 84 #endif | 83 #endif |
| 85 | 84 |
| 86 std::string expected_string = should_detect_encryption ? | 85 std::string expected_string = should_detect_encryption ? |
| 87 "crypto-seen" : "no-crypto-seen"; | 86 "crypto-seen" : "no-crypto-seen"; |
| 88 | 87 |
| 89 ASSERT_EQ(expected_string, | 88 ASSERT_EQ(expected_string, |
| 90 ExecuteJavascript("hasSeenCryptoInSdp()", left_tab)); | 89 ExecuteJavascript("hasSeenCryptoInSdp()", left_tab)); |
| 91 | 90 |
| 92 HangUp(left_tab); | 91 HangUp(left_tab); |
| 93 HangUp(right_tab); | 92 HangUp(right_tab); |
| 94 } | 93 } |
| OLD | NEW |