OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/base/v8_unit_test.h" | 5 #include "chrome/test/base/v8_unit_test.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 user_libraries_.begin(); | 61 user_libraries_.begin(); |
62 user_libraries_iterator != user_libraries_.end(); | 62 user_libraries_iterator != user_libraries_.end(); |
63 ++user_libraries_iterator) { | 63 ++user_libraries_iterator) { |
64 std::string library_content; | 64 std::string library_content; |
65 FilePath library_file(*user_libraries_iterator); | 65 FilePath library_file(*user_libraries_iterator); |
66 if (!user_libraries_iterator->IsAbsolute()) { | 66 if (!user_libraries_iterator->IsAbsolute()) { |
67 FilePath gen_file = gen_test_data_directory.Append(library_file); | 67 FilePath gen_file = gen_test_data_directory.Append(library_file); |
68 library_file = file_util::PathExists(gen_file) ? gen_file : | 68 library_file = file_util::PathExists(gen_file) ? gen_file : |
69 test_data_directory.Append(*user_libraries_iterator); | 69 test_data_directory.Append(*user_libraries_iterator); |
70 } | 70 } |
| 71 file_util::AbsolutePath(&library_file); |
71 if (!file_util::ReadFileToString(library_file, &library_content)) { | 72 if (!file_util::ReadFileToString(library_file, &library_content)) { |
72 ADD_FAILURE() << library_file.value(); | 73 ADD_FAILURE() << library_file.value(); |
73 return false; | 74 return false; |
74 } | 75 } |
75 ExecuteScriptInContext(library_content, library_file.MaybeAsASCII()); | 76 ExecuteScriptInContext(library_content, library_file.MaybeAsASCII()); |
76 if (::testing::Test::HasFatalFailure()) | 77 if (::testing::Test::HasFatalFailure()) |
77 return false; | 78 return false; |
78 } | 79 } |
79 return true; | 80 return true; |
80 } | 81 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 EXPECT_EQ(2U, testResult->Length()); | 264 EXPECT_EQ(2U, testResult->Length()); |
264 if (::testing::Test::HasNonfatalFailure()) | 265 if (::testing::Test::HasNonfatalFailure()) |
265 return v8::Undefined(); | 266 return v8::Undefined(); |
266 testResult_ok = testResult->Get(0)->BooleanValue(); | 267 testResult_ok = testResult->Get(0)->BooleanValue(); |
267 if (!testResult_ok) { | 268 if (!testResult_ok) { |
268 v8::String::Utf8Value message(testResult->Get(1)); | 269 v8::String::Utf8Value message(testResult->Get(1)); |
269 LOG(ERROR) << *message; | 270 LOG(ERROR) << *message; |
270 } | 271 } |
271 return v8::Undefined(); | 272 return v8::Undefined(); |
272 } | 273 } |
OLD | NEW |