OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/test/gpu/gpu_test_expectations_parser.h" | 5 #include "content/test/gpu/gpu_test_expectations_parser.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 rt = false; | 179 rt = false; |
180 } | 180 } |
181 if (DetectConflictsBetweenEntries()) { | 181 if (DetectConflictsBetweenEntries()) { |
182 entries_.clear(); | 182 entries_.clear(); |
183 rt = false; | 183 rt = false; |
184 } | 184 } |
185 | 185 |
186 return rt; | 186 return rt; |
187 } | 187 } |
188 | 188 |
189 bool GPUTestExpectationsParser::LoadTestExpectations(const FilePath& path) { | 189 bool GPUTestExpectationsParser::LoadTestExpectations( |
| 190 const base::FilePath& path) { |
190 entries_.clear(); | 191 entries_.clear(); |
191 error_messages_.clear(); | 192 error_messages_.clear(); |
192 | 193 |
193 std::string data; | 194 std::string data; |
194 if (!file_util::ReadFileToString(path, &data)) { | 195 if (!file_util::ReadFileToString(path, &data)) { |
195 error_messages_.push_back(kErrorMessage[kErrorFileIO]); | 196 error_messages_.push_back(kErrorMessage[kErrorFileIO]); |
196 return false; | 197 return false; |
197 } | 198 } |
198 return LoadTestExpectations(data); | 199 return LoadTestExpectations(data); |
199 } | 200 } |
200 | 201 |
201 bool GPUTestExpectationsParser::LoadTestExpectations( | 202 bool GPUTestExpectationsParser::LoadTestExpectations( |
202 GPUTestProfile profile) { | 203 GPUTestProfile profile) { |
203 FilePath path; | 204 base::FilePath path; |
204 if (!GetExpectationsPath(profile, &path)) | 205 if (!GetExpectationsPath(profile, &path)) |
205 return false; | 206 return false; |
206 return LoadTestExpectations(path); | 207 return LoadTestExpectations(path); |
207 } | 208 } |
208 | 209 |
209 int32 GPUTestExpectationsParser::GetTestExpectation( | 210 int32 GPUTestExpectationsParser::GetTestExpectation( |
210 const std::string& test_name, | 211 const std::string& test_name, |
211 const GPUTestBotConfig& bot_config) const { | 212 const GPUTestBotConfig& bot_config) const { |
212 for (size_t i = 0; i < entries_.size(); ++i) { | 213 for (size_t i = 0; i < entries_.size(); ++i) { |
213 if (NamesMatching(entries_[i].test_name, test_name) && | 214 if (NamesMatching(entries_[i].test_name, test_name) && |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 size_t entry2_line_number) { | 498 size_t entry2_line_number) { |
498 error_messages_.push_back( | 499 error_messages_.push_back( |
499 base::StringPrintf("Line %d and %d : %s", | 500 base::StringPrintf("Line %d and %d : %s", |
500 static_cast<int>(entry1_line_number), | 501 static_cast<int>(entry1_line_number), |
501 static_cast<int>(entry2_line_number), | 502 static_cast<int>(entry2_line_number), |
502 message.c_str())); | 503 message.c_str())); |
503 } | 504 } |
504 | 505 |
505 // static | 506 // static |
506 bool GPUTestExpectationsParser::GetExpectationsPath( | 507 bool GPUTestExpectationsParser::GetExpectationsPath( |
507 GPUTestProfile profile, FilePath* path) { | 508 GPUTestProfile profile, base::FilePath* path) { |
508 DCHECK(path); | 509 DCHECK(path); |
509 | 510 |
510 bool rt = true; | 511 bool rt = true; |
511 switch (profile) { | 512 switch (profile) { |
512 case kWebGLConformanceTest: | 513 case kWebGLConformanceTest: |
513 rt = PathService::Get(content::DIR_TEST_DATA, path); | 514 rt = PathService::Get(content::DIR_TEST_DATA, path); |
514 if (rt) { | 515 if (rt) { |
515 *path = path->Append(FILE_PATH_LITERAL("gpu")) | 516 *path = path->Append(FILE_PATH_LITERAL("gpu")) |
516 .Append(FILE_PATH_LITERAL( | 517 .Append(FILE_PATH_LITERAL( |
517 "webgl_conformance_test_expectations.txt")); | 518 "webgl_conformance_test_expectations.txt")); |
518 rt = file_util::PathExists(*path); | 519 rt = file_util::PathExists(*path); |
519 } | 520 } |
520 break; | 521 break; |
521 default: | 522 default: |
522 DCHECK(false); | 523 DCHECK(false); |
523 } | 524 } |
524 return rt; | 525 return rt; |
525 } | 526 } |
526 | 527 |
527 GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry() | 528 GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry() |
528 : test_expectation(0), | 529 : test_expectation(0), |
529 line_number(0) { | 530 line_number(0) { |
530 } | 531 } |
531 | 532 |
OLD | NEW |