diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-28 21:30:35 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-28 21:30:35 +0000 |
commit | 8918f99dbc48ab2cf69e1ad97e4277af33f51e48 (patch) | |
tree | 11db9f75dacf02d286e93fb1077a1ae9f4abc7d5 | |
parent | c5e8ee89876e50709254d643966ca9b5c80dcc03 (diff) | |
download | chromium_src-8918f99dbc48ab2cf69e1ad97e4277af33f51e48.zip chromium_src-8918f99dbc48ab2cf69e1ad97e4277af33f51e48.tar.gz chromium_src-8918f99dbc48ab2cf69e1ad97e4277af33f51e48.tar.bz2 |
Revert 260213 "Relanding Switched main WebRTC browser tests to u..."
I suspect that this caused the VerifyEncryption failure here:
http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%283%29/builds/25821
> Relanding Switched main WebRTC browser tests to use a more realistic video
>
> > Switched main WebRTC browser tests to use a more realistic video.
>
> > After switching to fake device flags instead of software webcams, we
> > noticed a ton of video-related metrics changed. This is because the
> > spinning green ball is an unrealistic encode/decode example. This patch
> > will use the new fake device file flag to play a more realistic video.
>
> > BUG=352261, 343504
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=259887
>
> TBR=tommi@chromium.org
> BUG=352261, 343504
>
> Review URL: https://codereview.chromium.org/216773002
TBR=phoglund@chromium.org
Review URL: https://codereview.chromium.org/217553002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260284 0039d316-1c4b-4281-b951-d872f2087c98
13 files changed, 121 insertions, 202 deletions
diff --git a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc index b3ac70a..4e686d5 100644 --- a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc +++ b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc @@ -119,9 +119,9 @@ IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, // Should fail with permission denied right away with no infobar popping up. GetUserMedia(tab_contents, kAudioVideoCallConstraints); - EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()", - kFailedWithPermissionDeniedError, - tab_contents)); + EXPECT_TRUE(PollingWaitUntil("obtainGetUserMediaResult()", + kFailedWithPermissionDeniedError, + tab_contents)); InfoBarService* infobar_service = InfoBarService::FromWebContents(tab_contents); EXPECT_EQ(0u, infobar_service->infobar_count()); diff --git a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc index d508977..fdd51d0 100644 --- a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc @@ -119,7 +119,7 @@ class WebRtcApprtcBrowserTest : public WebRtcTestBase { // Apprtc will set remoteVideo.style.opacity to 1 when the call comes up. std::string javascript = "window.domAutomationController.send(remoteVideo.style.opacity)"; - return test::PollingWaitUntil(javascript, "1", tab_contents); + return PollingWaitUntil(javascript, "1", tab_contents); } bool EvalInJavascriptFile(content::WebContents* tab_contents, diff --git a/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc index 6107928..562a715 100644 --- a/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc @@ -94,7 +94,7 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase, public: WebRtcAudioQualityBrowserTest() {} virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); + PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); DetectErrorsInJavaScript(); // Look for errors in our rather complex js. } @@ -137,10 +137,10 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase, ExecuteJavascript("negotiateCall()", from_tab)); // Ensure the call gets up on both sides. - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "active", from_tab)); - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "active", to_tab)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "active", from_tab)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "active", to_tab)); } base::FilePath CreateTemporaryWaveFile() { @@ -152,7 +152,7 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase, return wav_filename; } - test::PeerConnectionServerRunner peerconnection_server_; + PeerConnectionServerRunner peerconnection_server_; }; class AudioRecorder { @@ -419,7 +419,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcAudioQualityBrowserTest, // because the ready state is ok on both sides. We sleep a bit between call // establishment and playing to avoid cutting of the beginning of the audio // file. - test::SleepInJavascript(left_tab, 2000); + SleepInJavascript(left_tab, 2000); base::FilePath recording = CreateTemporaryWaveFile(); diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc index 570374c..e70eaef 100644 --- a/chrome/browser/media/chrome_webrtc_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_browsertest.cc @@ -32,24 +32,18 @@ #include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/perf/perf_test.h" -// For fine-grained suppression. -#if defined(OS_WIN) -#include "base/win/windows_version.h" -#endif - static const char kMainWebrtcTestHtmlPage[] = "/webrtc/webrtc_jsep01_test.html"; // Top-level integration test for WebRTC. The test methods here must run // sequentially since they use a server binary on the system (hence they are -// tagged as MANUAL). In addition, they need the reference videos which require -// the webrtc.DEPS solution, which is not generally available on Chromium bots. +// tagged as MANUAL). class WebRtcBrowserTest : public WebRtcTestBase, public testing::WithParamInterface<bool> { public: WebRtcBrowserTest() {} virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); + PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); DetectErrorsInJavaScript(); // Look for errors in our rather complex js. } @@ -57,12 +51,8 @@ class WebRtcBrowserTest : public WebRtcTestBase, // Ensure the infobar is enabled, since we expect that in this test. EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); - // Play a suitable, somewhat realistic video file. - base::FilePath input_video = test::GetReferenceVideosDir() - .Append(test::kReferenceFileName360p) - .AddExtension(test::kY4mFileExtension); - command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, - input_video); + // TODO(phoglund): allow this test to also run with real devices once we + // get real webcam bots up. command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); // Flag used by TestWebAudioMediaStream to force garbage collection. @@ -123,15 +113,7 @@ class WebRtcBrowserTest : public WebRtcTestBase, return NULL; } - bool OnWinXp() { -#if defined(OS_WIN) - return base::win::GetVersion() <= base::win::VERSION_XP; -#else - return false; -#endif - } - - test::PeerConnectionServerRunner peerconnection_server_; + PeerConnectionServerRunner peerconnection_server_; }; static const bool kRunTestsWithFlag[] = { false, true }; @@ -141,9 +123,6 @@ INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests, IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { - if (OnWinXp()) return; - - ASSERT_TRUE(test::HasReferenceFilesInCheckout()); ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(peerconnection_server_.Start()); @@ -168,9 +147,6 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, } IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_CpuUsage15Seconds) { - if (OnWinXp()) return; - - ASSERT_TRUE(test::HasReferenceFilesInCheckout()); ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(peerconnection_server_.Start()); @@ -206,7 +182,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_CpuUsage15Seconds) { EstablishCall(left_tab, right_tab); - test::SleepInJavascript(left_tab, 15000); + SleepInJavascript(left_tab, 15000); HangUp(left_tab); WaitUntilHangupVerified(left_tab); @@ -223,9 +199,6 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_CpuUsage15Seconds) { // This is manual for its long execution time. IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { - if (OnWinXp()) return; - - ASSERT_TRUE(test::HasReferenceFilesInCheckout()); ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(peerconnection_server_.Start()); @@ -247,7 +220,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, WaitForVideoToPlay(right_tab); // Let values stabilize, bandwidth ramp up, etc. - test::SleepInJavascript(left_tab, 60000); + SleepInJavascript(left_tab, 60000); // Start measurements. chrome::AddTabAt(browser(), GURL(), -1, true); @@ -255,7 +228,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, content::WebContents* webrtc_internals_tab = browser()->tab_strip_model()->GetActiveWebContents(); - test::SleepInJavascript(left_tab, 10000); + SleepInJavascript(left_tab, 10000); scoped_ptr<base::DictionaryValue> all_data( GetWebrtcInternalsData(webrtc_internals_tab)); @@ -264,8 +237,8 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, const base::DictionaryValue* first_pc_dict = GetDataOnFirstPeerConnection(all_data.get()); ASSERT_TRUE(first_pc_dict != NULL); - test::PrintBweForVideoMetrics(*first_pc_dict); - test::PrintMetricsForAllStreams(*first_pc_dict); + PrintBweForVideoMetrics(*first_pc_dict); + PrintMetricsForAllStreams(*first_pc_dict); HangUp(left_tab); WaitUntilHangupVerified(left_tab); @@ -274,10 +247,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, ASSERT_TRUE(peerconnection_server_.Stop()); } -IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_TestWebAudioMediaStream) { - if (OnWinXp()) return; - - ASSERT_TRUE(test::HasReferenceFilesInCheckout()); +IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, TestWebAudioMediaStream) { ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); ui_test_utils::NavigateToURL(browser(), url); @@ -285,7 +255,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_TestWebAudioMediaStream) { browser()->tab_strip_model()->GetActiveWebContents(); // A sleep is necessary to be able to detect the crash. - test::SleepInJavascript(tab, 1000); + SleepInJavascript(tab, 1000); ASSERT_FALSE(tab->IsCrashed()); } diff --git a/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc b/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc index b51aaa6..398bc99 100644 --- a/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc @@ -31,7 +31,7 @@ class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase { virtual ~WebRtcDisableEncryptionFlagBrowserTest() {} virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); + PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); DetectErrorsInJavaScript(); // Look for errors in our rather complex js. } @@ -44,7 +44,7 @@ class WebRtcDisableEncryptionFlagBrowserTest : public WebRtcTestBase { } protected: - test::PeerConnectionServerRunner peerconnection_server_; + PeerConnectionServerRunner peerconnection_server_; private: DISALLOW_COPY_AND_ASSIGN(WebRtcDisableEncryptionFlagBrowserTest); diff --git a/chrome/browser/media/chrome_webrtc_typing_detection_browsertest.cc b/chrome/browser/media/chrome_webrtc_typing_detection_browsertest.cc index 241f1ea..465d241 100644 --- a/chrome/browser/media/chrome_webrtc_typing_detection_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_typing_detection_browsertest.cc @@ -52,7 +52,7 @@ class WebRtcTypingDetectionBrowserTest : public WebRtcTestBase { // TODO(phoglund): clean up duplication from audio quality browser test when // this test is complete and is proven to work. virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); + PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); } bool HasAllRequiredResources() { @@ -88,13 +88,13 @@ class WebRtcTypingDetectionBrowserTest : public WebRtcTestBase { ExecuteJavascript("negotiateCall()", from_tab)); // Ensure the call gets up on both sides. - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "active", from_tab)); - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "active", to_tab)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "active", from_tab)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "active", to_tab)); } - test::PeerConnectionServerRunner peerconnection_server_; + PeerConnectionServerRunner peerconnection_server_; }; // TODO(phoglund): enable when fully implemented. @@ -133,13 +133,13 @@ IN_PROC_BROWSER_TEST_F(WebRtcTypingDetectionBrowserTest, // because the ready state is ok on both sides. We sleep a bit between call // establishment and playing to avoid cutting of the beginning of the audio // file. - test::SleepInJavascript(left_tab, 2000); + SleepInJavascript(left_tab, 2000); PlayAudioFile(left_tab); // TODO(phoglund): simulate key presses, look for changes in typing detection // state. - test::SleepInJavascript(left_tab, 10000); + SleepInJavascript(left_tab, 10000); HangUp(left_tab); WaitUntilHangupVerified(left_tab); diff --git a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc index f64d52c..9b88ff9 100644 --- a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc @@ -61,6 +61,14 @@ static const char kHomeEnvName[] = // The working dir should be in the user's home folder. static const base::FilePath::CharType kWorkingDirName[] = FILE_PATH_LITERAL("webrtc_video_quality"); +static const base::FilePath::CharType kReferenceVideosDirName[] = + FILE_PATH_LITERAL("webrtc.DEPS/webrtc_videos"); +static const base::FilePath::CharType kReferenceFileName360p[] = + FILE_PATH_LITERAL("reference_video_640x360_30fps"); +static const base::FilePath::CharType kYuvFileExtension[] = + FILE_PATH_LITERAL("yuv"); +static const base::FilePath::CharType kY4mFileExtension[] = + FILE_PATH_LITERAL("y4m"); static const base::FilePath::CharType kCapturedYuvFileName[] = FILE_PATH_LITERAL("captured_video.yuv"); static const base::FilePath::CharType kStatsFileName[] = @@ -76,6 +84,14 @@ static const int k360pHeight = 360; // too! static const char kPyWebSocketPortNumber[] = "12221"; +const char kAdviseOnGclientSolution[] = + "You need to add this solution to your .gclient to run this test:\n" + "{\n" + " \"name\" : \"webrtc.DEPS\",\n" + " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" + "third_party/webrtc/webrtc.DEPS\",\n" + "}"; + // Test the video quality of the WebRTC output. // // Prerequisites: This test case must run on a machine with a chrome playing @@ -106,16 +122,15 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { environment_(base::Environment::Create()) {} virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); + PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); DetectErrorsInJavaScript(); // Look for errors in our rather complex js. } virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { // Set up the command line option with the expected file name. We will check // its existence in HasAllRequiredResources(). - webrtc_reference_video_y4m_ = test::GetReferenceVideosDir() - .Append(test::kReferenceFileName360p) - .AddExtension(test::kY4mFileExtension); + webrtc_reference_video_y4m_ = GetReferenceVideosDir() + .Append(kReferenceFileName360p).AddExtension(kY4mFileExtension); command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, webrtc_reference_video_y4m_); command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); @@ -130,9 +145,27 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { "files:" << GetWorkingDir().value(); return false; } - - // Ensure we have the required input files. - return test::HasReferenceFilesInCheckout(); + if (!base::PathExists(GetReferenceVideosDir())) { + LOG(ERROR) << "Cannot find the working directory for the reference video " + "files, expected at " << GetReferenceVideosDir().value() << ". " << + kAdviseOnGclientSolution; + return false; + } + base::FilePath webrtc_reference_video_yuv = GetReferenceVideosDir() + .Append(kReferenceFileName360p).AddExtension(kYuvFileExtension); + if (!base::PathExists(webrtc_reference_video_yuv)) { + LOG(ERROR) << "Missing YUV reference video to be used for quality" + << " comparison, expected at " << webrtc_reference_video_yuv.value() + << ". " << kAdviseOnGclientSolution; + return false; + } + if (!base::PathExists(webrtc_reference_video_y4m_)) { + LOG(ERROR) << "Missing Y4M reference video to be used for quality" + << " comparison, expected at "<< webrtc_reference_video_y4m_.value() + << ". " << kAdviseOnGclientSolution; + return false; + } + return true; } bool StartPyWebSocketServer() { @@ -278,7 +311,23 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { return base::FilePath(native_home_dir).Append(kWorkingDirName); } - test::PeerConnectionServerRunner peerconnection_server_; + base::FilePath GetReferenceVideosDir() { + // FilePath does not tolerate relative paths, and we want to hang the + // kReferenceVideosDirName at the same level as Chromium codebase, so we + // need to subtract the trailing .../src manually from the path. + const size_t src_token_length = 3u; + const base::FilePath::StringType src_token(FILE_PATH_LITERAL("src")); + base::FilePath::StringType path = GetSourceDir().value(); + DCHECK_GT(path.size(), src_token_length); + std::size_t found = path.rfind(src_token); + if (found != std::string::npos) + path.replace(found, + src_token_length, + base::FilePath::StringType(FILE_PATH_LITERAL(""))); + return base::FilePath(path).Append(kReferenceVideosDirName); + } + + PeerConnectionServerRunner peerconnection_server_; private: base::FilePath GetSourceDir() { @@ -330,7 +379,7 @@ IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, // sending frames take quite a bit of time. int polling_interval_msec = 1000; - EXPECT_TRUE(test::PollingWaitUntil( + EXPECT_TRUE(PollingWaitUntil( "doneFrameCapturing()", "done-capturing", right_tab, polling_interval_msec)); @@ -338,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, WaitUntilHangupVerified(left_tab); WaitUntilHangupVerified(right_tab); - EXPECT_TRUE(test::PollingWaitUntil( + EXPECT_TRUE(PollingWaitUntil( "haveMoreFramesToSend()", "no-more-frames", right_tab, polling_interval_msec)); @@ -357,8 +406,7 @@ IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, k360pWidth, k360pHeight, GetWorkingDir().Append(kCapturedYuvFileName), - test::GetReferenceVideosDir() - .Append(test::kReferenceFileName360p) - .AddExtension(test::kYuvFileExtension), + GetReferenceVideosDir().Append(kReferenceFileName360p).AddExtension( + kYuvFileExtension), GetWorkingDir().Append(kStatsFileName))); } diff --git a/chrome/browser/media/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc_browsertest_base.cc index fafaacc..21c18b5 100644 --- a/chrome/browser/media/webrtc_browsertest_base.cc +++ b/chrome/browser/media/webrtc_browsertest_base.cc @@ -91,8 +91,8 @@ void WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndAccept( // Wait for WebRTC to call the success callback. const char kOkGotStream[] = "ok-got-stream"; - EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()", kOkGotStream, - tab_contents)); + EXPECT_TRUE(PollingWaitUntil("obtainGetUserMediaResult()", kOkGotStream, + tab_contents)); } void WebRtcTestBase::GetUserMediaAndDeny(content::WebContents* tab_contents) { @@ -108,9 +108,8 @@ void WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndDeny( CloseInfoBarInTab(tab_contents, infobar); // Wait for WebRTC to call the fail callback. - EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()", - kFailedWithPermissionDeniedError, - tab_contents)); + EXPECT_TRUE(PollingWaitUntil("obtainGetUserMediaResult()", + kFailedWithPermissionDeniedError, tab_contents)); } void WebRtcTestBase::GetUserMediaAndDismiss( @@ -121,9 +120,9 @@ void WebRtcTestBase::GetUserMediaAndDismiss( CloseInfoBarInTab(tab_contents, infobar); // A dismiss should be treated like a deny. - EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()", - kFailedWithPermissionDismissedError, - tab_contents)); + EXPECT_TRUE(PollingWaitUntil("obtainGetUserMediaResult()", + kFailedWithPermissionDismissedError, + tab_contents)); } void WebRtcTestBase::GetUserMedia(content::WebContents* tab_contents, @@ -233,7 +232,7 @@ void WebRtcTestBase::ConnectToPeerConnectionServer( content::WebContents* tab_contents) const { std::string javascript = base::StringPrintf( "connect('http://localhost:%s', '%s');", - test::PeerConnectionServerRunner::kDefaultPort, peer_name.c_str()); + PeerConnectionServerRunner::kDefaultPort, peer_name.c_str()); EXPECT_EQ("ok-connected", ExecuteJavascript(javascript, tab_contents)); } @@ -248,10 +247,10 @@ void WebRtcTestBase::EstablishCall(content::WebContents* from_tab, EXPECT_EQ("ok-negotiating", ExecuteJavascript("negotiateCall()", from_tab)); // Ensure the call gets up on both sides. - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "active", from_tab)); - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "active", to_tab)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "active", from_tab)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "active", to_tab)); } void WebRtcTestBase::HangUp(content::WebContents* from_tab) const { @@ -260,8 +259,8 @@ void WebRtcTestBase::HangUp(content::WebContents* from_tab) const { void WebRtcTestBase::WaitUntilHangupVerified( content::WebContents* tab_contents) const { - EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", - "no-peer-connection", tab_contents)); + EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", + "no-peer-connection", tab_contents)); } void WebRtcTestBase::DetectErrorsInJavaScript() { @@ -278,6 +277,6 @@ void WebRtcTestBase::StartDetectingVideo( void WebRtcTestBase::WaitForVideoToPlay( content::WebContents* tab_contents) const { - EXPECT_TRUE(test::PollingWaitUntil("isVideoPlaying()", "video-playing", - tab_contents)); + EXPECT_TRUE(PollingWaitUntil("isVideoPlaying()", "video-playing", + tab_contents)); } diff --git a/chrome/browser/media/webrtc_browsertest_common.cc b/chrome/browser/media/webrtc_browsertest_common.cc index 9928514..0c18313 100644 --- a/chrome/browser/media/webrtc_browsertest_common.cc +++ b/chrome/browser/media/webrtc_browsertest_common.cc @@ -15,75 +15,8 @@ #include "chrome/browser/ui/browser_tabstrip.h" #include "content/public/test/browser_test_utils.h" -namespace test { - -const base::FilePath::CharType kReferenceVideosDirName[] = - FILE_PATH_LITERAL("webrtc.DEPS/webrtc_videos"); -const base::FilePath::CharType kReferenceFileName360p[] = - FILE_PATH_LITERAL("reference_video_640x360_30fps"); -const base::FilePath::CharType kYuvFileExtension[] = FILE_PATH_LITERAL("yuv"); -const base::FilePath::CharType kY4mFileExtension[] = FILE_PATH_LITERAL("y4m"); - -// This message describes how to modify your .gclient to get the reference -// video files downloaded for you. -static const char kAdviseOnGclientSolution[] = - "You need to add this solution to your .gclient to run this test:\n" - "{\n" - " \"name\" : \"webrtc.DEPS\",\n" - " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" - "third_party/webrtc/webrtc.DEPS\",\n" - "}"; - const int kDefaultPollIntervalMsec = 250; -base::FilePath GetReferenceVideosDir() { - // FilePath does not tolerate relative paths, and we want to hang the - // kReferenceVideosDirName at the same level as Chromium codebase, so we - // need to subtract the trailing .../src manually from the path. - const size_t src_token_length = 3u; - const base::FilePath::StringType src_token(FILE_PATH_LITERAL("src")); - - base::FilePath source_dir; - PathService::Get(base::DIR_SOURCE_ROOT, &source_dir); - - base::FilePath::StringType path = source_dir.value(); - DCHECK_GT(path.size(), src_token_length); - std::size_t found = path.rfind(src_token); - if (found != std::string::npos) - path.erase(found, src_token_length); - return base::FilePath(path).Append(kReferenceVideosDirName); -} - -bool HasReferenceFilesInCheckout() { - if (!base::PathExists(GetReferenceVideosDir())) { - LOG(ERROR) - << "Cannot find the working directory for the reference video " - << "files, expected at " << GetReferenceVideosDir().value() << ". " << - kAdviseOnGclientSolution; - return false; - } - base::FilePath webrtc_reference_video_yuv = GetReferenceVideosDir() - .Append(kReferenceFileName360p).AddExtension(kYuvFileExtension); - if (!base::PathExists(webrtc_reference_video_yuv)) { - LOG(ERROR) - << "Missing YUV reference video to be used for quality" - << " comparison, expected at " << webrtc_reference_video_yuv.value() - << ". " << kAdviseOnGclientSolution; - return false; - } - - base::FilePath webrtc_reference_video_y4m = GetReferenceVideosDir() - .Append(kReferenceFileName360p).AddExtension(kY4mFileExtension); - if (!base::PathExists(webrtc_reference_video_y4m)) { - LOG(ERROR) - << "Missing Y4M reference video to be used for quality" - << " comparison, expected at "<< webrtc_reference_video_y4m.value() - << ". " << kAdviseOnGclientSolution; - return false; - } - return true; -} - bool SleepInJavascript(content::WebContents* tab_contents, int timeout_msec) { const std::string javascript = base::StringPrintf( "setTimeout(function() {" @@ -129,10 +62,9 @@ bool PollingWaitUntil(const std::string& javascript, LOG(ERROR) << "Failed to sleep."; } } - LOG(ERROR) - << "Timed out while waiting for " << javascript - << " to evaluate to " << evaluates_to << "; last result was '" << result - << "'"; + LOG(ERROR) << "Timed out while waiting for " << javascript << + " to evaluate to " << evaluates_to << "; last result was '" << result << + "'"; return false; } @@ -154,9 +86,8 @@ bool PeerConnectionServerRunner::Start() { peerconnection_server = peerconnection_server.Append(kServerExecutable); if (!base::PathExists(peerconnection_server)) { - LOG(ERROR) - << "Missing " << kServerExecutable << ". You must build " - << "it so it ends up next to the browser test binary."; + LOG(ERROR) << "Missing " << kServerExecutable << ". You must build " + "it so it ends up next to the browser test binary."; return false; } @@ -172,7 +103,7 @@ bool PeerConnectionServerRunner::Stop() { return base::KillProcess(server_pid_, 0, false); } -void PeerConnectionServerRunner::KillAllPeerConnectionServers() { +void PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem() { if (!base::KillProcesses(kServerExecutable, -1, NULL)) { LOG(ERROR) << "Failed to kill instances of " << kServerExecutable << "."; return; @@ -180,5 +111,3 @@ void PeerConnectionServerRunner::KillAllPeerConnectionServers() { base::WaitForProcessesToExit(kServerExecutable, base::TimeDelta::FromSeconds(5), NULL); } - -} // namespace test diff --git a/chrome/browser/media/webrtc_browsertest_common.h b/chrome/browser/media/webrtc_browsertest_common.h index 56d3ece..9d51c17 100644 --- a/chrome/browser/media/webrtc_browsertest_common.h +++ b/chrome/browser/media/webrtc_browsertest_common.h @@ -7,31 +7,12 @@ #include <string> -#include "base/files/file_path.h" #include "base/process/process_handle.h" namespace content { class WebContents; } -namespace test { - -// Reference video locations. - -// Checks if the user has the reference video files, returns true if so. -// If the user's checkout don't have these dirs, they need to configure their -// .gclient as described in kAdviseOnGclientSolution. The reason for this is -// that we don't want to burden regular chrome devs with downloading these -// sizable reference files by default. -bool HasReferenceFilesInCheckout(); - -// Retrieves the reference video dir, to which file names can be appended. -base::FilePath GetReferenceVideosDir(); - -extern const base::FilePath::CharType kReferenceFileName360p[]; -extern const base::FilePath::CharType kYuvFileExtension[]; -extern const base::FilePath::CharType kY4mFileExtension[]; - // Executes javascript code which will sleep for |timeout_msec| milliseconds. // Returns true on success. bool SleepInJavascript(content::WebContents* tab_contents, int timeout_msec); @@ -63,12 +44,10 @@ class PeerConnectionServerRunner { // Stops the peerconnection server. bool Stop(); - static void KillAllPeerConnectionServers(); + static void KillAllPeerConnectionServersOnCurrentSystem(); private: base::ProcessHandle server_pid_; }; -} // namespace test - #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_COMMON_H_ diff --git a/chrome/browser/media/webrtc_browsertest_perf.cc b/chrome/browser/media/webrtc_browsertest_perf.cc index fcf731a..18327427 100644 --- a/chrome/browser/media/webrtc_browsertest_perf.cc +++ b/chrome/browser/media/webrtc_browsertest_perf.cc @@ -172,8 +172,6 @@ static std::set<std::string> FindAllSsrcIdentifiers( return result; } -namespace test { - void PrintBweForVideoMetrics(const base::DictionaryValue& pc_dict) { const std::string kBweStatsKey = "bweforvideo"; std::string value; @@ -220,5 +218,3 @@ void PrintMetricsForAllStreams(const base::DictionaryValue& pc_dict) { << " is. "; } } - -} // namespace test diff --git a/chrome/browser/media/webrtc_browsertest_perf.h b/chrome/browser/media/webrtc_browsertest_perf.h index 19934f68..d469a73 100644 --- a/chrome/browser/media/webrtc_browsertest_perf.h +++ b/chrome/browser/media/webrtc_browsertest_perf.h @@ -9,8 +9,6 @@ namespace base { class DictionaryValue; } -namespace test { - // These functions takes parsed data (on one peer connection) from the // peerConnectionDataStore object that is backing webrtc-internals and prints // metrics they consider interesting using testing/perf/perf_test.h primitives. @@ -22,6 +20,4 @@ namespace test { void PrintBweForVideoMetrics(const base::DictionaryValue& pc_dict); void PrintMetricsForAllStreams(const base::DictionaryValue& pc_dict); -} // namespace test - #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_PERF_H_ diff --git a/chrome/test/data/webrtc/webrtc_jsep01_test.html b/chrome/test/data/webrtc/webrtc_jsep01_test.html index 2f66f6e..7270dc7 100644 --- a/chrome/test/data/webrtc/webrtc_jsep01_test.html +++ b/chrome/test/data/webrtc/webrtc_jsep01_test.html @@ -16,8 +16,10 @@ <td>Remote Video</td> </tr> <tr> - <td><video id="local-view" autoplay></video></td> - <td><video id="remote-view" autoplay></video></td> + <td><video width="320" height="240" id="local-view" + autoplay="autoplay"></video></td> + <td><video width="320" height="240" id="remote-view" + autoplay="autoplay"></video></td> </tr> </table> </body> |