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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 std::string V8UnitTest::ExceptionToString(const v8::TryCatch& try_catch) { | 232 std::string V8UnitTest::ExceptionToString(const v8::TryCatch& try_catch) { |
233 std::string str; | 233 std::string str; |
234 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 234 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
235 v8::String::Utf8Value exception(try_catch.Exception()); | 235 v8::String::Utf8Value exception(try_catch.Exception()); |
236 v8::Local<v8::Message> message(try_catch.Message()); | 236 v8::Local<v8::Message> message(try_catch.Message()); |
237 if (message.IsEmpty()) { | 237 if (message.IsEmpty()) { |
238 str.append(base::StringPrintf("%s\n", *exception)); | 238 str.append(base::StringPrintf("%s\n", *exception)); |
239 } else { | 239 } else { |
240 v8::String::Utf8Value filename(message->GetScriptResourceName()); | 240 v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName()); |
241 int linenum = message->GetLineNumber(); | 241 int linenum = message->GetLineNumber(); |
242 int colnum = message->GetStartColumn(); | 242 int colnum = message->GetStartColumn(); |
243 str.append(base::StringPrintf( | 243 str.append(base::StringPrintf( |
244 "%s:%i:%i %s\n", *filename, linenum, colnum, *exception)); | 244 "%s:%i:%i %s\n", *filename, linenum, colnum, *exception)); |
245 v8::String::Utf8Value sourceline(message->GetSourceLine()); | 245 v8::String::Utf8Value sourceline(message->GetSourceLine()); |
246 str.append(base::StringPrintf("%s\n", *sourceline)); | 246 str.append(base::StringPrintf("%s\n", *sourceline)); |
247 } | 247 } |
248 return str; | 248 return str; |
249 } | 249 } |
250 | 250 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>()); | 296 v8::Handle<v8::Array> testResult(args[1].As<v8::Array>()); |
297 EXPECT_EQ(2U, testResult->Length()); | 297 EXPECT_EQ(2U, testResult->Length()); |
298 if (::testing::Test::HasNonfatalFailure()) | 298 if (::testing::Test::HasNonfatalFailure()) |
299 return; | 299 return; |
300 testResult_ok = testResult->Get(0)->BooleanValue(); | 300 testResult_ok = testResult->Get(0)->BooleanValue(); |
301 if (!testResult_ok) { | 301 if (!testResult_ok) { |
302 v8::String::Utf8Value message(testResult->Get(1)); | 302 v8::String::Utf8Value message(testResult->Get(1)); |
303 LOG(ERROR) << *message; | 303 LOG(ERROR) << *message; |
304 } | 304 } |
305 } | 305 } |
OLD | NEW |