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/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 bool V8UnitTest::ExecuteJavascriptLibraries() { | 60 bool V8UnitTest::ExecuteJavascriptLibraries() { |
61 std::string utf8_content; | 61 std::string utf8_content; |
62 for (std::vector<base::FilePath>::iterator user_libraries_iterator = | 62 for (std::vector<base::FilePath>::iterator user_libraries_iterator = |
63 user_libraries_.begin(); | 63 user_libraries_.begin(); |
64 user_libraries_iterator != user_libraries_.end(); | 64 user_libraries_iterator != user_libraries_.end(); |
65 ++user_libraries_iterator) { | 65 ++user_libraries_iterator) { |
66 std::string library_content; | 66 std::string library_content; |
67 base::FilePath library_file(*user_libraries_iterator); | 67 base::FilePath library_file(*user_libraries_iterator); |
68 if (!user_libraries_iterator->IsAbsolute()) { | 68 if (!user_libraries_iterator->IsAbsolute()) { |
69 base::FilePath gen_file = gen_test_data_directory.Append(library_file); | 69 base::FilePath gen_file = gen_test_data_directory.Append(library_file); |
70 library_file = file_util::PathExists(gen_file) ? gen_file : | 70 library_file = base::PathExists(gen_file) ? gen_file : |
71 test_data_directory.Append(*user_libraries_iterator); | 71 test_data_directory.Append(*user_libraries_iterator); |
72 } | 72 } |
73 library_file = base::MakeAbsoluteFilePath(library_file); | 73 library_file = base::MakeAbsoluteFilePath(library_file); |
74 if (!file_util::ReadFileToString(library_file, &library_content)) { | 74 if (!file_util::ReadFileToString(library_file, &library_content)) { |
75 ADD_FAILURE() << library_file.value(); | 75 ADD_FAILURE() << library_file.value(); |
76 return false; | 76 return false; |
77 } | 77 } |
78 ExecuteScriptInContext(library_content, library_file.MaybeAsASCII()); | 78 ExecuteScriptInContext(library_content, library_file.MaybeAsASCII()); |
79 if (::testing::Test::HasFatalFailure()) | 79 if (::testing::Test::HasFatalFailure()) |
80 return false; | 80 return false; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>()); | 277 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>()); |
278 EXPECT_EQ(2U, testResult->Length()); | 278 EXPECT_EQ(2U, testResult->Length()); |
279 if (::testing::Test::HasNonfatalFailure()) | 279 if (::testing::Test::HasNonfatalFailure()) |
280 return; | 280 return; |
281 testResult_ok = testResult->Get(0)->BooleanValue(); | 281 testResult_ok = testResult->Get(0)->BooleanValue(); |
282 if (!testResult_ok) { | 282 if (!testResult_ok) { |
283 v8::String::Utf8Value message(testResult->Get(1)); | 283 v8::String::Utf8Value message(testResult->Get(1)); |
284 LOG(ERROR) << *message; | 284 LOG(ERROR) << *message; |
285 } | 285 } |
286 } | 286 } |
OLD | NEW |