Index: trunk/src/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
=================================================================== |
--- trunk/src/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc (revision 260283) |
+++ trunk/src/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc (working copy) |
@@ -61,6 +61,14 @@ |
// 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 @@ |
// 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 @@ |
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 @@ |
"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,8 +311,24 @@ |
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() { |
base::FilePath source_dir; |
@@ -330,7 +379,7 @@ |
// 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 @@ |
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 @@ |
k360pWidth, |
k360pHeight, |
GetWorkingDir().Append(kCapturedYuvFileName), |
- test::GetReferenceVideosDir() |
- .Append(test::kReferenceFileName360p) |
- .AddExtension(test::kYuvFileExtension), |
+ GetReferenceVideosDir().Append(kReferenceFileName360p).AddExtension( |
+ kYuvFileExtension), |
GetWorkingDir().Append(kStatsFileName))); |
} |