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

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

Issue 173465: Only pass idle notifications on from the API if V8 has been... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 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/mark-compact.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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 7797 matching lines...) Expand 10 before | Expand all | Expand 10 after
7808 result = CompileRun("pixels[1] = 23;" 7808 result = CompileRun("pixels[1] = 23;"
7809 "pixels.__proto__ = [];" 7809 "pixels.__proto__ = [];"
7810 "js_array.__proto__ = pixels;" 7810 "js_array.__proto__ = pixels;"
7811 "js_array.concat(pixels);"); 7811 "js_array.concat(pixels);");
7812 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 7812 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
7813 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); 7813 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
7814 7814
7815 free(pixel_data); 7815 free(pixel_data);
7816 } 7816 }
7817 7817
7818
7818 THREADED_TEST(ScriptContextDependence) { 7819 THREADED_TEST(ScriptContextDependence) {
7819 v8::HandleScope scope; 7820 v8::HandleScope scope;
7820 LocalContext c1; 7821 LocalContext c1;
7821 const char *source = "foo"; 7822 const char *source = "foo";
7822 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); 7823 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
7823 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); 7824 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source));
7824 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); 7825 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100));
7825 CHECK_EQ(dep->Run()->Int32Value(), 100); 7826 CHECK_EQ(dep->Run()->Int32Value(), 100);
7826 CHECK_EQ(indep->Run()->Int32Value(), 100); 7827 CHECK_EQ(indep->Run()->Int32Value(), 100);
7827 LocalContext c2; 7828 LocalContext c2;
7828 c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101)); 7829 c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101));
7829 CHECK_EQ(dep->Run()->Int32Value(), 100); 7830 CHECK_EQ(dep->Run()->Int32Value(), 100);
7830 CHECK_EQ(indep->Run()->Int32Value(), 101); 7831 CHECK_EQ(indep->Run()->Int32Value(), 101);
7831 } 7832 }
7832 7833
7834
7833 THREADED_TEST(StackTrace) { 7835 THREADED_TEST(StackTrace) {
7834 v8::HandleScope scope; 7836 v8::HandleScope scope;
7835 LocalContext context; 7837 LocalContext context;
7836 v8::TryCatch try_catch; 7838 v8::TryCatch try_catch;
7837 const char *source = "function foo() { FAIL.FAIL; }; foo();"; 7839 const char *source = "function foo() { FAIL.FAIL; }; foo();";
7838 v8::Handle<v8::String> src = v8::String::New(source); 7840 v8::Handle<v8::String> src = v8::String::New(source);
7839 v8::Handle<v8::String> origin = v8::String::New("stack-trace-test"); 7841 v8::Handle<v8::String> origin = v8::String::New("stack-trace-test");
7840 v8::Script::New(src, origin)->Run(); 7842 v8::Script::New(src, origin)->Run();
7841 CHECK(try_catch.HasCaught()); 7843 CHECK(try_catch.HasCaught());
7842 v8::String::Utf8Value stack(try_catch.StackTrace()); 7844 v8::String::Utf8Value stack(try_catch.StackTrace());
7843 CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL); 7845 CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL);
7844 } 7846 }
7847
7848
7849 // Test that idle notification can be handled when V8 has not yet been
7850 // set up.
7851 THREADED_TEST(IdleNotification) {
7852 for (int i = 0; i < 100; i++) v8::V8::IdleNotification(true);
7853 for (int i = 0; i < 100; i++) v8::V8::IdleNotification(false);
7854 }
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698