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

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

Issue 9146039: Provide access to function inferred name in v8 public API (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 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 14020 matching lines...) Expand 10 before | Expand all | Expand 10 after
14031 14031
14032 v8::ScriptOrigin script_origin_f = f->GetScriptOrigin(); 14032 v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
14033 CHECK_EQ("test", *v8::String::AsciiValue(script_origin_f.ResourceName())); 14033 CHECK_EQ("test", *v8::String::AsciiValue(script_origin_f.ResourceName()));
14034 CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value()); 14034 CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value());
14035 14035
14036 v8::ScriptOrigin script_origin_g = g->GetScriptOrigin(); 14036 v8::ScriptOrigin script_origin_g = g->GetScriptOrigin();
14037 CHECK_EQ("test", *v8::String::AsciiValue(script_origin_g.ResourceName())); 14037 CHECK_EQ("test", *v8::String::AsciiValue(script_origin_g.ResourceName()));
14038 CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value()); 14038 CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value());
14039 } 14039 }
14040 14040
14041 THREADED_TEST(FunctionGetInferredName) {
14042 v8::HandleScope scope;
14043 LocalContext env;
14044 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
14045 v8::Handle<v8::String> script = v8::String::New(
14046 "var foo = { bar : { baz : function() {}}}; var f = foo.bar.baz;");
14047 v8::Script::Compile(script, &origin)->Run();
14048 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
14049 env->Global()->Get(v8::String::New("f")));
14050 CHECK_EQ("foo.bar.baz", *v8::String::AsciiValue(f->GetInferredName()));
14051 }
14041 14052
14042 THREADED_TEST(ScriptLineNumber) { 14053 THREADED_TEST(ScriptLineNumber) {
14043 v8::HandleScope scope; 14054 v8::HandleScope scope;
14044 LocalContext env; 14055 LocalContext env;
14045 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test")); 14056 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
14046 v8::Handle<v8::String> script = v8::String::New( 14057 v8::Handle<v8::String> script = v8::String::New(
14047 "function f() {}\n\nfunction g() {}"); 14058 "function f() {}\n\nfunction g() {}");
14048 v8::Script::Compile(script, &origin)->Run(); 14059 v8::Script::Compile(script, &origin)->Run();
14049 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( 14060 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
14050 env->Global()->Get(v8::String::New("f"))); 14061 env->Global()->Get(v8::String::New("f")));
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
15926 CompileRun("throw 'exception';"); 15937 CompileRun("throw 'exception';");
15927 } 15938 }
15928 15939
15929 15940
15930 TEST(CallCompletedCallbackTwoExceptions) { 15941 TEST(CallCompletedCallbackTwoExceptions) {
15931 v8::HandleScope scope; 15942 v8::HandleScope scope;
15932 LocalContext env; 15943 LocalContext env;
15933 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); 15944 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException);
15934 CompileRun("throw 'first exception';"); 15945 CompileRun("throw 'first exception';");
15935 } 15946 }
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