This source file includes following definitions.
- SetUpInProcessBrowserTestFixture
- SetUpCommandLine
- IN_PROC_BROWSER_TEST_F
#include "base/command_line.h"
#include "chrome/browser/media/webrtc_browsertest_base.h"
#include "chrome/browser/media/webrtc_browsertest_common.h"
#include "chrome/common/chrome_version_info.h"
#include "content/public/common/content_switches.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
static const char kMainWebrtcTestHtmlPage[] =
"/webrtc/webrtc_jsep01_test.html";
using chrome::VersionInfo;
class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase {
public:
WebRtcDisableEncryptionFlagBrowserTest() {}
virtual ~WebRtcDisableEncryptionFlagBrowserTest() {}
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
test::PeerConnectionServerRunner::KillAllPeerConnectionServers();
DetectErrorsInJavaScript();
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
command_line->AppendSwitch(switches::kDisableWebRtcEncryption);
}
protected:
test::PeerConnectionServerRunner peerconnection_server_;
private:
DISALLOW_COPY_AND_ASSIGN(WebRtcDisableEncryptionFlagBrowserTest);
};
IN_PROC_BROWSER_TEST_F(WebRtcDisableEncryptionFlagBrowserTest,
MANUAL_VerifyEncryption) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ASSERT_TRUE(peerconnection_server_.Start());
content::WebContents* left_tab =
OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
content::WebContents* right_tab =
OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
EstablishCall(left_tab, right_tab);
StartDetectingVideo(left_tab, "remote-view");
StartDetectingVideo(right_tab, "remote-view");
WaitForVideoToPlay(left_tab);
WaitForVideoToPlay(right_tab);
bool should_detect_encryption = true;
VersionInfo::Channel channel = VersionInfo::GetChannel();
if (channel == VersionInfo::CHANNEL_UNKNOWN ||
channel == VersionInfo::CHANNEL_CANARY ||
channel == VersionInfo::CHANNEL_DEV) {
should_detect_encryption = false;
}
#if defined(OS_ANDROID)
if (channel == VersionInfo::CHANNEL_BETA)
should_detect_encryption = false;
#endif
std::string expected_string = should_detect_encryption ?
"crypto-seen" : "no-crypto-seen";
ASSERT_EQ(expected_string,
ExecuteJavascript("hasSeenCryptoInSdp()", left_tab));
HangUp(left_tab);
WaitUntilHangupVerified(left_tab);
WaitUntilHangupVerified(right_tab);
ASSERT_TRUE(peerconnection_server_.Stop());
}