Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1353)

Unified Diff: test/cctest/test-api.cc

Issue 1010803008: convert String::New functions to maybe (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 7016bf7ac2b135bfc444664b92d38af527198f2d..d339c153c8d74b4f8d7a2a4a77f4124155ed96cf 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -694,28 +694,23 @@ class RandomLengthOneByteResource
THREADED_TEST(NewExternalForVeryLongString) {
+ auto isolate = CcTest::isolate();
{
- LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
+ v8::HandleScope scope(isolate);
v8::TryCatch try_catch;
RandomLengthOneByteResource r(1 << 30);
- v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), &r);
+ v8::Local<v8::String> str = v8::String::NewExternal(isolate, &r);
CHECK(str.IsEmpty());
- CHECK(try_catch.HasCaught());
- String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(0, strcmp("RangeError: Invalid string length", *exception_value));
+ CHECK(!try_catch.HasCaught());
}
{
- LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
+ v8::HandleScope scope(isolate);
v8::TryCatch try_catch;
RandomLengthResource r(1 << 30);
- v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), &r);
+ v8::Local<v8::String> str = v8::String::NewExternal(isolate, &r);
CHECK(str.IsEmpty());
- CHECK(try_catch.HasCaught());
- String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(0, strcmp("RangeError: Invalid string length", *exception_value));
+ CHECK(!try_catch.HasCaught());
}
}
@@ -21618,7 +21613,6 @@ TEST(StreamingScriptWithSourceMappingURLInTheMiddle) {
TEST(NewStringRangeError) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
- LocalContext env;
const int length = i::String::kMaxLength + 1;
const int buffer_size = length * sizeof(uint16_t);
void* buffer = malloc(buffer_size);
@@ -21629,21 +21623,21 @@ TEST(NewStringRangeError) {
char* data = reinterpret_cast<char*>(buffer);
CHECK(v8::String::NewFromUtf8(isolate, data, v8::String::kNormalString,
length).IsEmpty());
- CHECK(try_catch.HasCaught());
+ CHECK(!try_catch.HasCaught());
}
{
v8::TryCatch try_catch;
uint8_t* data = reinterpret_cast<uint8_t*>(buffer);
CHECK(v8::String::NewFromOneByte(isolate, data, v8::String::kNormalString,
length).IsEmpty());
- CHECK(try_catch.HasCaught());
+ CHECK(!try_catch.HasCaught());
}
{
v8::TryCatch try_catch;
uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
length).IsEmpty());
- CHECK(try_catch.HasCaught());
+ CHECK(!try_catch.HasCaught());
}
free(buffer);
}
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698