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

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

Issue 16206014: Add Persistent::Upcast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 7 years, 6 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 | « include/v8.h ('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 bc72e37154fc18f352c328e6e46dc34a526e849b..d03ceb10465b93b8b2bcef30480899ff3623a276 100755
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2885,6 +2885,24 @@ THREADED_TEST(ClearAndLeakGlobal) {
}
+THREADED_TEST(GlobalHandleUpcast) {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope scope(isolate);
+ v8::Local<String> local = v8::Local<String>::New(v8_str("str"));
+ v8::Persistent<String> global_string(isolate, local);
+#ifdef V8_USE_UNSAFE_HANDLES
+ v8::Persistent<Value> global_value =
+ v8::Persistent<Value>::Cast(global_string);
+#else
+ v8::Persistent<Value>& global_value =
+ v8::Persistent<Value>::Cast(global_string);
+#endif
+ CHECK(v8::Local<v8::Value>::New(isolate, global_value)->IsString());
+ CHECK(global_string == v8::Persistent<String>::Cast(global_value));
+ global_string.Dispose();
+}
+
+
THREADED_TEST(LocalHandle) {
v8::HandleScope scope(v8::Isolate::GetCurrent());
v8::Local<String> local = v8::Local<String>::New(v8_str("str"));
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698