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

Side by Side Diff: test/cctest/test-api.cc

Issue 24245005: Add EscapableHandleScope to api to fix problems with HandleScope::Close (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 20575 matching lines...) Expand 10 before | Expand all | Expand 10 after
20586 Local<Object> data2 = v8::Object::New(); 20586 Local<Object> data2 = v8::Object::New();
20587 function_new_expected_env = data2; 20587 function_new_expected_env = data2;
20588 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); 20588 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2);
20589 CHECK(!func2->IsNull()); 20589 CHECK(!func2->IsNull());
20590 CHECK_NE(func, func2); 20590 CHECK_NE(func, func2);
20591 env->Global()->Set(v8_str("func2"), func2); 20591 env->Global()->Set(v8_str("func2"), func2);
20592 Local<Value> result2 = CompileRun("func2();"); 20592 Local<Value> result2 = CompileRun("func2();");
20593 CHECK_EQ(v8::Integer::New(17, isolate), result2); 20593 CHECK_EQ(v8::Integer::New(17, isolate), result2);
20594 } 20594 }
20595 20595
20596
20597 TEST(EscapeableHandleScope) {
20598 HandleScope outer_scope(CcTest::isolate());
20599 LocalContext context;
20600 const int runs = 10;
20601 Local<String> values[runs];
20602 for (int i = 0; i < runs; i++) {
20603 v8::EscapableHandleScope inner_scope(CcTest::isolate());
20604 Local<String> value;
20605 if (i != 0) value = v8_str("escape value");
20606 values[i] = inner_scope.Escape(value);
20607 }
20608 for (int i = 0; i < runs; i++) {
20609 Local<String> expected;
20610 if (i != 0) {
20611 CHECK_EQ(v8_str("escape value"), values[i]);
20612 } else {
20613 CHECK(values[i].IsEmpty());
20614 }
20615 }
20616 }
OLDNEW
« 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