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

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

Issue 1435273002: Fix name shown by devtools for subclasses. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/profiler/heap-snapshot-generator.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | 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 5532 matching lines...) Expand 10 before | Expand all | Expand 10 after
5543 " }" 5543 " }"
5544 "} catch (e) {" 5544 "} catch (e) {"
5545 "}"); 5545 "}");
5546 CHECK(result->IsTrue()); 5546 CHECK(result->IsTrue());
5547 } 5547 }
5548 5548
5549 5549
5550 static void check_reference_error_message(v8::Local<v8::Message> message, 5550 static void check_reference_error_message(v8::Local<v8::Message> message,
5551 v8::Local<v8::Value> data) { 5551 v8::Local<v8::Value> data) {
5552 const char* reference_error = "Uncaught ReferenceError: asdf is not defined"; 5552 const char* reference_error = "Uncaught ReferenceError: asdf is not defined";
5553 CHECK(message->Get() 5553 Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
5554 ->Equals(CcTest::isolate()->GetCurrentContext(), 5554 const char* reference_error2 = "Uncaught Error: asdf is not defined";
5555 v8_str(reference_error)) 5555 CHECK(message->Get()->Equals(context, v8_str(reference_error)).FromJust() ||
5556 .FromJust()); 5556 message->Get()->Equals(context, v8_str(reference_error2)).FromJust());
5557 } 5557 }
5558 5558
5559 5559
5560 static void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) { 5560 static void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) {
5561 ApiTestFuzzer::Fuzz(); 5561 ApiTestFuzzer::Fuzz();
5562 CHECK(false); 5562 CHECK(false);
5563 } 5563 }
5564 5564
5565 5565
5566 // Test that overwritten methods are not invoked on uncaught exception 5566 // Test that overwritten methods are not invoked on uncaught exception
(...skipping 7317 matching lines...) Expand 10 before | Expand all | Expand 10 after
12884 12884
12885 12885
12886 THREADED_TEST(ObjectGetConstructorName) { 12886 THREADED_TEST(ObjectGetConstructorName) {
12887 v8::Isolate* isolate = CcTest::isolate(); 12887 v8::Isolate* isolate = CcTest::isolate();
12888 LocalContext context; 12888 LocalContext context;
12889 v8::HandleScope scope(isolate); 12889 v8::HandleScope scope(isolate);
12890 v8_compile( 12890 v8_compile(
12891 "function Parent() {};" 12891 "function Parent() {};"
12892 "function Child() {};" 12892 "function Child() {};"
12893 "Child.prototype = new Parent();" 12893 "Child.prototype = new Parent();"
12894 "Child.prototype.constructor = Child;"
12894 "var outer = { inner: function() { } };" 12895 "var outer = { inner: function() { } };"
12895 "var p = new Parent();" 12896 "var p = new Parent();"
12896 "var c = new Child();" 12897 "var c = new Child();"
12897 "var x = new outer.inner();" 12898 "var x = new outer.inner();"
12898 "var proto = Child.prototype;")->Run(); 12899 "var proto = Child.prototype;")
12900 ->Run();
12899 12901
12900 Local<v8::Value> p = context->Global()->Get(v8_str("p")); 12902 Local<v8::Value> p = context->Global()->Get(v8_str("p"));
12901 CHECK(p->IsObject() && 12903 CHECK(p->IsObject() &&
12902 p->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Parent"))); 12904 p->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Parent")));
12903 12905
12904 Local<v8::Value> c = context->Global()->Get(v8_str("c")); 12906 Local<v8::Value> c = context->Global()->Get(v8_str("c"));
12905 CHECK(c->IsObject() && 12907 CHECK(c->IsObject() &&
12906 c->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Child"))); 12908 c->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Child")));
12907 12909
12908 Local<v8::Value> x = context->Global()->Get(v8_str("x")); 12910 Local<v8::Value> x = context->Global()->Get(v8_str("x"));
12909 CHECK(x->IsObject() && 12911 CHECK(x->IsObject() &&
12910 x->ToObject(isolate)->GetConstructorName()->Equals( 12912 x->ToObject(isolate)->GetConstructorName()->Equals(
12911 v8_str("outer.inner"))); 12913 v8_str("outer.inner")));
12912 12914
12913 Local<v8::Value> child_prototype = context->Global()->Get(v8_str("proto")); 12915 Local<v8::Value> child_prototype = context->Global()->Get(v8_str("proto"));
12914 CHECK(child_prototype->IsObject() && 12916 CHECK(child_prototype->IsObject() &&
12915 child_prototype->ToObject(isolate)->GetConstructorName()->Equals( 12917 child_prototype->ToObject(isolate)->GetConstructorName()->Equals(
12916 v8_str("Parent"))); 12918 v8_str("Parent")));
12917 } 12919 }
12918 12920
12919 12921
12922 THREADED_TEST(SubclassGetConstructorName) {
12923 v8::Isolate* isolate = CcTest::isolate();
12924 LocalContext context;
12925 v8::HandleScope scope(isolate);
12926 v8_compile(
12927 "\"use strict\";"
12928 "class Parent {}"
12929 "class Child extends Parent {}"
12930 "var p = new Parent();"
12931 "var c = new Child();")
12932 ->Run();
12933
12934 Local<v8::Value> p = context->Global()->Get(v8_str("p"));
12935 CHECK(p->IsObject() &&
12936 p->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Parent")));
12937
12938 Local<v8::Value> c = context->Global()->Get(v8_str("c"));
12939 CHECK(c->IsObject() &&
12940 c->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Child")));
12941 }
12942
12943
12920 bool ApiTestFuzzer::fuzzing_ = false; 12944 bool ApiTestFuzzer::fuzzing_ = false;
12921 v8::base::Semaphore ApiTestFuzzer::all_tests_done_(0); 12945 v8::base::Semaphore ApiTestFuzzer::all_tests_done_(0);
12922 int ApiTestFuzzer::active_tests_; 12946 int ApiTestFuzzer::active_tests_;
12923 int ApiTestFuzzer::tests_being_run_; 12947 int ApiTestFuzzer::tests_being_run_;
12924 int ApiTestFuzzer::current_; 12948 int ApiTestFuzzer::current_;
12925 12949
12926 12950
12927 // We are in a callback and want to switch to another thread (if we 12951 // We are in a callback and want to switch to another thread (if we
12928 // are currently running the thread fuzzing test). 12952 // are currently running the thread fuzzing test).
12929 void ApiTestFuzzer::Fuzz() { 12953 void ApiTestFuzzer::Fuzz() {
(...skipping 10930 matching lines...) Expand 10 before | Expand all | Expand 10 after
23860 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); 23884 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust());
23861 ExpectString("typeof obj2.values", "function"); 23885 ExpectString("typeof obj2.values", "function");
23862 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); 23886 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values")));
23863 23887
23864 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); 23888 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values")));
23865 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); 23889 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2));
23866 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); 23890 auto ctx2 = v8::Utils::OpenHandle(*env2.local());
23867 CHECK_EQ(fn2->GetCreationContext(), *ctx2); 23891 CHECK_EQ(fn2->GetCreationContext(), *ctx2);
23868 } 23892 }
23869 } 23893 }
OLDNEW
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698