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

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

Issue 68213002: api: set ScriptOrigin::ResourceIsSharedCrossOrigin()
Patch Set: Created 7 years, 1 month 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
« 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 17466 matching lines...) Expand 10 before | Expand all | Expand 10 after
17477 "function f() {}\n\nfunction g() {}"); 17477 "function f() {}\n\nfunction g() {}");
17478 v8::Script::Compile(script, &origin)->Run(); 17478 v8::Script::Compile(script, &origin)->Run();
17479 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( 17479 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
17480 env->Global()->Get(v8::String::New("f"))); 17480 env->Global()->Get(v8::String::New("f")));
17481 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( 17481 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
17482 env->Global()->Get(v8::String::New("g"))); 17482 env->Global()->Get(v8::String::New("g")));
17483 17483
17484 v8::ScriptOrigin script_origin_f = f->GetScriptOrigin(); 17484 v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
17485 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName())); 17485 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName()));
17486 CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value()); 17486 CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value());
17487 CHECK_EQ(false, script_origin_f.ResourceIsSharedCrossOrigin()->IsTrue());
17487 17488
17488 v8::ScriptOrigin script_origin_g = g->GetScriptOrigin(); 17489 v8::ScriptOrigin script_origin_g = g->GetScriptOrigin();
17489 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName())); 17490 CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName()));
17490 CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value()); 17491 CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value());
17492 CHECK_EQ(false, script_origin_g.ResourceIsSharedCrossOrigin()->IsTrue());
17491 } 17493 }
17492 17494
17493 17495
17494 THREADED_TEST(FunctionGetInferredName) { 17496 THREADED_TEST(FunctionGetInferredName) {
17495 LocalContext env; 17497 LocalContext env;
17496 v8::HandleScope scope(env->GetIsolate()); 17498 v8::HandleScope scope(env->GetIsolate());
17497 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test")); 17499 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
17498 v8::Handle<v8::String> script = v8::String::New( 17500 v8::Handle<v8::String> script = v8::String::New(
17499 "var foo = { bar : { baz : function() {}}}; var f = foo.bar.baz;"); 17501 "var foo = { bar : { baz : function() {}}}; var f = foo.bar.baz;");
17500 v8::Script::Compile(script, &origin)->Run(); 17502 v8::Script::Compile(script, &origin)->Run();
(...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after
20739 } 20741 }
20740 for (int i = 0; i < runs; i++) { 20742 for (int i = 0; i < runs; i++) {
20741 Local<String> expected; 20743 Local<String> expected;
20742 if (i != 0) { 20744 if (i != 0) {
20743 CHECK_EQ(v8_str("escape value"), values[i]); 20745 CHECK_EQ(v8_str("escape value"), values[i]);
20744 } else { 20746 } else {
20745 CHECK(values[i].IsEmpty()); 20747 CHECK(values[i].IsEmpty());
20746 } 20748 }
20747 } 20749 }
20748 } 20750 }
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