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

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

Issue 6273004: Unthread message handling test. Changing the MessageHandler in a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | « no previous file | 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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 v8::Handle<v8::Message> message, 2361 v8::Handle<v8::Message> message,
2362 v8::Handle<v8::Value> data) { 2362 v8::Handle<v8::Value> data) {
2363 const char* reference_error = "Uncaught ReferenceError: asdf is not defined"; 2363 const char* reference_error = "Uncaught ReferenceError: asdf is not defined";
2364 CHECK(message->Get()->Equals(v8_str(reference_error))); 2364 CHECK(message->Get()->Equals(v8_str(reference_error)));
2365 } 2365 }
2366 2366
2367 2367
2368 // Test that overwritten toString methods are not invoked on uncaught 2368 // Test that overwritten toString methods are not invoked on uncaught
2369 // exception formatting. However, they are invoked when performing 2369 // exception formatting. However, they are invoked when performing
2370 // normal error string conversions. 2370 // normal error string conversions.
2371 THREADED_TEST(APIThrowMessageOverwrittenToString) { 2371 TEST(APIThrowMessageOverwrittenToString) {
2372 v8::HandleScope scope; 2372 v8::HandleScope scope;
2373 v8::V8::AddMessageListener(check_reference_error_message); 2373 v8::V8::AddMessageListener(check_reference_error_message);
2374 LocalContext context; 2374 LocalContext context;
2375 CompileRun("ReferenceError.prototype.toString =" 2375 CompileRun("ReferenceError.prototype.toString ="
2376 " function() { return 'Whoops' }"); 2376 " function() { return 'Whoops' }");
2377 CompileRun("asdf;"); 2377 CompileRun("asdf;");
2378 v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }"); 2378 v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }");
2379 CHECK(string->Equals(v8_str("Whoops"))); 2379 CHECK(string->Equals(v8_str("Whoops")));
2380 v8::V8::RemoveMessageListeners(check_message); 2380 v8::V8::RemoveMessageListeners(check_message);
2381 } 2381 }
(...skipping 9784 matching lines...) Expand 10 before | Expand all | Expand 10 after
12166 v8::Context::Scope context_scope(context.local()); 12166 v8::Context::Scope context_scope(context.local());
12167 12167
12168 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); 12168 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New();
12169 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); 12169 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator);
12170 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); 12170 context->Global()->Set(v8_str("o"), tmpl->NewInstance());
12171 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( 12171 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
12172 "var result = []; for (var k in o) result.push(k); result")); 12172 "var result = []; for (var k in o) result.push(k); result"));
12173 CHECK_EQ(1, result->Length()); 12173 CHECK_EQ(1, result->Length());
12174 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); 12174 CHECK_EQ(v8_str("universalAnswer"), result->Get(0));
12175 } 12175 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698