Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc

Issue 1762413002: Cleanup: remove prefix chrome_ of chrome/browser/media/chrome* files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reran the commands Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "base/macros.h"
7 #include "build/build_config.h"
8 #include "chrome/browser/media/webrtc_browsertest_base.h"
9 #include "chrome/browser/media/webrtc_browsertest_common.h"
10 #include "chrome/common/channel_info.h"
11 #include "components/version_info/version_info.h"
12 #include "content/public/common/content_switches.h"
13 #include "media/base/media_switches.h"
14 #include "net/test/embedded_test_server/embedded_test_server.h"
15
16 static const char kMainWebrtcTestHtmlPage[] =
17 "/webrtc/webrtc_jsep01_test.html";
18
19 // This tests the --disable-webrtc-encryption command line flag. Disabling
20 // encryption should only be possible on certain channels.
21
22 // NOTE: The test case for each channel will only be exercised when the browser
23 // is actually built for that channel. This is not ideal. One can test manually
24 // by e.g. faking the channel returned in chrome::GetChannel(). It's likely good
25 // to have the test anyway, even though a failure might not be detected until a
26 // branch has been promoted to another channel. The unit test for
27 // ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch tests for
28 // all channels however.
29 // TODO(grunell): Test the different channel cases for any build.
30 class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase {
31 public:
32 WebRtcDisableEncryptionFlagBrowserTest() {}
33 ~WebRtcDisableEncryptionFlagBrowserTest() override {}
34
35 void SetUpInProcessBrowserTestFixture() override {
36 DetectErrorsInJavaScript(); // Look for errors in our rather complex js.
37 }
38
39 void SetUpCommandLine(base::CommandLine* command_line) override {
40 // This test should run with fake devices.
41 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
42
43 // Disable encryption with the command line flag.
44 command_line->AppendSwitch(switches::kDisableWebRtcEncryption);
45 }
46
47 private:
48 DISALLOW_COPY_AND_ASSIGN(WebRtcDisableEncryptionFlagBrowserTest);
49 };
50
51 // Makes a call and checks that there's encryption or not in the SDP offer.
52 IN_PROC_BROWSER_TEST_F(WebRtcDisableEncryptionFlagBrowserTest,
53 VerifyEncryption) {
54 if (!OnWinXp())
55 return; // Flaky timeout on a webrtc Win XP bot. http://crbug.com/368163.
56
57 ASSERT_TRUE(embedded_test_server()->Start());
58
59 content::WebContents* left_tab =
60 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
61 content::WebContents* right_tab =
62 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
63
64 SetupPeerconnectionWithLocalStream(left_tab);
65 SetupPeerconnectionWithLocalStream(right_tab);
66
67 NegotiateCall(left_tab, right_tab);
68
69 StartDetectingVideo(left_tab, "remote-view");
70 StartDetectingVideo(right_tab, "remote-view");
71
72 WaitForVideoToPlay(left_tab);
73 WaitForVideoToPlay(right_tab);
74
75 bool should_detect_encryption = true;
76 version_info::Channel channel = chrome::GetChannel();
77 if (channel == version_info::Channel::UNKNOWN ||
78 channel == version_info::Channel::CANARY ||
79 channel == version_info::Channel::DEV) {
80 should_detect_encryption = false;
81 }
82 #if defined(OS_ANDROID)
83 if (channel == version_info::Channel::BETA)
84 should_detect_encryption = false;
85 #endif
86
87 std::string expected_string = should_detect_encryption ?
88 "crypto-seen" : "no-crypto-seen";
89
90 ASSERT_EQ(expected_string,
91 ExecuteJavascript("hasSeenCryptoInSdp()", left_tab));
92
93 HangUp(left_tab);
94 HangUp(right_tab);
95 }
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_webrtc_browsertest.cc ('k') | chrome/browser/media/chrome_webrtc_getmediadevices_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698