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/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 const int kDefaultPollIntervalMsec = 250; | 39 const int kDefaultPollIntervalMsec = 250; |
40 | 40 |
41 base::FilePath GetReferenceFilesDir() { | 41 base::FilePath GetReferenceFilesDir() { |
42 base::FilePath test_data_dir; | 42 base::FilePath test_data_dir; |
43 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 43 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
44 | 44 |
45 return test_data_dir.Append(kReferenceFilesDirName); | 45 return test_data_dir.Append(kReferenceFilesDirName); |
46 } | 46 } |
47 | 47 |
| 48 base::FilePath GetToolForPlatform(const std::string& tool_name) { |
| 49 base::FilePath tools_dir = |
| 50 GetReferenceFilesDir().Append(FILE_PATH_LITERAL("tools")); |
| 51 #if defined(OS_WIN) |
| 52 return tools_dir |
| 53 .Append(FILE_PATH_LITERAL("win")) |
| 54 .AppendASCII(tool_name) |
| 55 .AddExtension(FILE_PATH_LITERAL("exe")); |
| 56 #elif defined(OS_MACOSX) |
| 57 return tools_dir.Append(FILE_PATH_LITERAL("mac")).AppendASCII(tool_name); |
| 58 #elif defined(OS_LINUX) |
| 59 return tools_dir.Append(FILE_PATH_LITERAL("linux")).AppendASCII(tool_name); |
| 60 #else |
| 61 CHECK(false) << "Can't retrieve tool " << tool_name << " on this platform."; |
| 62 return base::FilePath(); |
| 63 #endif |
| 64 } |
| 65 |
48 bool HasReferenceFilesInCheckout() { | 66 bool HasReferenceFilesInCheckout() { |
49 if (!base::PathExists(GetReferenceFilesDir())) { | 67 if (!base::PathExists(GetReferenceFilesDir())) { |
50 LOG(ERROR) | 68 LOG(ERROR) |
51 << "Cannot find the working directory for the reference video " | 69 << "Cannot find the working directory for the reference video " |
52 << "files, expected at " << GetReferenceFilesDir().value() << ". " << | 70 << "files, expected at " << GetReferenceFilesDir().value() << ". " << |
53 kAdviseOnGclientSolution; | 71 kAdviseOnGclientSolution; |
54 return false; | 72 return false; |
55 } | 73 } |
56 return HasYuvAndY4mFile(test::kReferenceFileName360p) && | 74 return HasYuvAndY4mFile(test::kReferenceFileName360p) && |
57 HasYuvAndY4mFile(test::kReferenceFileName720p); | 75 HasYuvAndY4mFile(test::kReferenceFileName720p); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 144 } |
127 } | 145 } |
128 LOG(ERROR) | 146 LOG(ERROR) |
129 << "Timed out while waiting for " << javascript | 147 << "Timed out while waiting for " << javascript |
130 << " to evaluate to " << evaluates_to << "; last result was '" << result | 148 << " to evaluate to " << evaluates_to << "; last result was '" << result |
131 << "'"; | 149 << "'"; |
132 return false; | 150 return false; |
133 } | 151 } |
134 | 152 |
135 } // namespace test | 153 } // namespace test |
OLD | NEW |