OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/media/webrtc_browsertest_common.h" | 5 #include "chrome/browser/media/webrtc_browsertest_common.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
18 | 18 |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 // Relative to the chrome/test/data directory. | 21 // Relative to the chrome/test/data directory. |
22 const base::FilePath::CharType kReferenceFilesDirName[] = | 22 const base::FilePath::CharType kReferenceFilesDirName[] = |
23 FILE_PATH_LITERAL("webrtc/resources"); | 23 FILE_PATH_LITERAL("webrtc/resources"); |
24 const base::FilePath::CharType kReferenceFileName360p[] = | 24 const base::FilePath::CharType kReferenceFileName360p[] = |
25 FILE_PATH_LITERAL("reference_video_640x360_30fps"); | 25 FILE_PATH_LITERAL("reference_video_640x360_30fps"); |
| 26 const base::FilePath::CharType kReferenceFileName720p[] = |
| 27 FILE_PATH_LITERAL("reference_video_1280x720_30fps"); |
26 const base::FilePath::CharType kYuvFileExtension[] = FILE_PATH_LITERAL("yuv"); | 28 const base::FilePath::CharType kYuvFileExtension[] = FILE_PATH_LITERAL("yuv"); |
27 const base::FilePath::CharType kY4mFileExtension[] = FILE_PATH_LITERAL("y4m"); | 29 const base::FilePath::CharType kY4mFileExtension[] = FILE_PATH_LITERAL("y4m"); |
28 | 30 |
29 // This message describes how to modify your .gclient to get the reference | 31 // This message describes how to modify your .gclient to get the reference |
30 // video files downloaded for you. | 32 // video files downloaded for you. |
31 static const char kAdviseOnGclientSolution[] = | 33 static const char kAdviseOnGclientSolution[] = |
32 "You need to add this solution to your .gclient to run this test:\n" | 34 "You need to add this solution to your .gclient to run this test:\n" |
33 "{\n" | 35 "{\n" |
34 " \"name\" : \"webrtc.DEPS\",\n" | 36 " \"name\" : \"webrtc.DEPS\",\n" |
35 " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" | 37 " \"url\" : \"svn://svn.chromium.org/chrome/trunk/deps/" |
(...skipping 10 matching lines...) Expand all Loading... |
46 } | 48 } |
47 | 49 |
48 bool HasReferenceFilesInCheckout() { | 50 bool HasReferenceFilesInCheckout() { |
49 if (!base::PathExists(GetReferenceFilesDir())) { | 51 if (!base::PathExists(GetReferenceFilesDir())) { |
50 LOG(ERROR) | 52 LOG(ERROR) |
51 << "Cannot find the working directory for the reference video " | 53 << "Cannot find the working directory for the reference video " |
52 << "files, expected at " << GetReferenceFilesDir().value() << ". " << | 54 << "files, expected at " << GetReferenceFilesDir().value() << ". " << |
53 kAdviseOnGclientSolution; | 55 kAdviseOnGclientSolution; |
54 return false; | 56 return false; |
55 } | 57 } |
| 58 if (!HasYuvAndY4mFile(test::kReferenceFileName360p)) |
| 59 return false; |
| 60 if (!HasYuvAndY4mFile(test::kReferenceFileName720p)) |
| 61 return false; |
| 62 return true; |
| 63 } |
| 64 |
| 65 bool HasYuvAndY4mFile(const base::FilePath::CharType* reference_file) { |
56 base::FilePath webrtc_reference_video_yuv = GetReferenceFilesDir() | 66 base::FilePath webrtc_reference_video_yuv = GetReferenceFilesDir() |
57 .Append(kReferenceFileName360p).AddExtension(kYuvFileExtension); | 67 .Append(reference_file).AddExtension(kYuvFileExtension); |
58 if (!base::PathExists(webrtc_reference_video_yuv)) { | 68 if (!base::PathExists(webrtc_reference_video_yuv)) { |
59 LOG(ERROR) | 69 LOG(ERROR) |
60 << "Missing YUV reference video to be used for quality" | 70 << "Missing YUV reference video to be used for quality" |
61 << " comparison, expected at " << webrtc_reference_video_yuv.value() | 71 << " comparison, expected at " << webrtc_reference_video_yuv.value() |
62 << ". " << kAdviseOnGclientSolution; | 72 << ". " << kAdviseOnGclientSolution; |
63 return false; | 73 return false; |
64 } | 74 } |
65 | 75 |
66 base::FilePath webrtc_reference_video_y4m = GetReferenceFilesDir() | 76 base::FilePath webrtc_reference_video_y4m = GetReferenceFilesDir() |
67 .Append(kReferenceFileName360p).AddExtension(kY4mFileExtension); | 77 .Append(reference_file).AddExtension(kY4mFileExtension); |
68 if (!base::PathExists(webrtc_reference_video_y4m)) { | 78 if (!base::PathExists(webrtc_reference_video_y4m)) { |
69 LOG(ERROR) | 79 LOG(ERROR) |
70 << "Missing Y4M reference video to be used for quality" | 80 << "Missing Y4M reference video to be used for quality" |
71 << " comparison, expected at "<< webrtc_reference_video_y4m.value() | 81 << " comparison, expected at "<< webrtc_reference_video_y4m.value() |
72 << ". " << kAdviseOnGclientSolution; | 82 << ". " << kAdviseOnGclientSolution; |
73 return false; | 83 return false; |
74 } | 84 } |
75 return true; | 85 return true; |
76 } | 86 } |
77 | 87 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void PeerConnectionServerRunner::KillAllPeerConnectionServers() { | 176 void PeerConnectionServerRunner::KillAllPeerConnectionServers() { |
167 if (!base::KillProcesses(kServerExecutable, -1, NULL)) { | 177 if (!base::KillProcesses(kServerExecutable, -1, NULL)) { |
168 LOG(ERROR) << "Failed to kill instances of " << kServerExecutable << "."; | 178 LOG(ERROR) << "Failed to kill instances of " << kServerExecutable << "."; |
169 return; | 179 return; |
170 } | 180 } |
171 base::WaitForProcessesToExit(kServerExecutable, | 181 base::WaitForProcessesToExit(kServerExecutable, |
172 base::TimeDelta::FromSeconds(5), NULL); | 182 base::TimeDelta::FromSeconds(5), NULL); |
173 } | 183 } |
174 | 184 |
175 } // namespace test | 185 } // namespace test |
OLD | NEW |