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

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

Issue 9139051: Cosmetic changes ("set up" is a verb, "setup" is a noun). (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 | « test/cctest/test-alloc.cc ('k') | test/cctest/test-assembler-x64.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 7933 matching lines...) Expand 10 before | Expand all | Expand 10 after
7944 7944
7945 THREADED_TEST(CrossEval) { 7945 THREADED_TEST(CrossEval) {
7946 v8::HandleScope scope; 7946 v8::HandleScope scope;
7947 LocalContext other; 7947 LocalContext other;
7948 LocalContext current; 7948 LocalContext current;
7949 7949
7950 Local<String> token = v8_str("<security token>"); 7950 Local<String> token = v8_str("<security token>");
7951 other->SetSecurityToken(token); 7951 other->SetSecurityToken(token);
7952 current->SetSecurityToken(token); 7952 current->SetSecurityToken(token);
7953 7953
7954 // Setup reference from current to other. 7954 // Set up reference from current to other.
7955 current->Global()->Set(v8_str("other"), other->Global()); 7955 current->Global()->Set(v8_str("other"), other->Global());
7956 7956
7957 // Check that new variables are introduced in other context. 7957 // Check that new variables are introduced in other context.
7958 Local<Script> script = 7958 Local<Script> script =
7959 Script::Compile(v8_str("other.eval('var foo = 1234')")); 7959 Script::Compile(v8_str("other.eval('var foo = 1234')"));
7960 script->Run(); 7960 script->Run();
7961 Local<Value> foo = other->Global()->Get(v8_str("foo")); 7961 Local<Value> foo = other->Global()->Get(v8_str("foo"));
7962 CHECK_EQ(1234, foo->Int32Value()); 7962 CHECK_EQ(1234, foo->Int32Value());
7963 CHECK(!current->Global()->Has(v8_str("foo"))); 7963 CHECK(!current->Global()->Has(v8_str("foo")));
7964 7964
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
8024 8024
8025 // Test that calling eval in a context which has been detached from 8025 // Test that calling eval in a context which has been detached from
8026 // its global throws an exception. This behavior is consistent with 8026 // its global throws an exception. This behavior is consistent with
8027 // other JavaScript implementations. 8027 // other JavaScript implementations.
8028 THREADED_TEST(EvalInDetachedGlobal) { 8028 THREADED_TEST(EvalInDetachedGlobal) {
8029 v8::HandleScope scope; 8029 v8::HandleScope scope;
8030 8030
8031 v8::Persistent<Context> context0 = Context::New(); 8031 v8::Persistent<Context> context0 = Context::New();
8032 v8::Persistent<Context> context1 = Context::New(); 8032 v8::Persistent<Context> context1 = Context::New();
8033 8033
8034 // Setup function in context0 that uses eval from context0. 8034 // Set up function in context0 that uses eval from context0.
8035 context0->Enter(); 8035 context0->Enter();
8036 v8::Handle<v8::Value> fun = 8036 v8::Handle<v8::Value> fun =
8037 CompileRun("var x = 42;" 8037 CompileRun("var x = 42;"
8038 "(function() {" 8038 "(function() {"
8039 " var e = eval;" 8039 " var e = eval;"
8040 " return function(s) { return e(s); }" 8040 " return function(s) { return e(s); }"
8041 "})()"); 8041 "})()");
8042 context0->Exit(); 8042 context0->Exit();
8043 8043
8044 // Put the function into context1 and call it before and after 8044 // Put the function into context1 and call it before and after
(...skipping 17 matching lines...) Expand all
8062 8062
8063 THREADED_TEST(CrossLazyLoad) { 8063 THREADED_TEST(CrossLazyLoad) {
8064 v8::HandleScope scope; 8064 v8::HandleScope scope;
8065 LocalContext other; 8065 LocalContext other;
8066 LocalContext current; 8066 LocalContext current;
8067 8067
8068 Local<String> token = v8_str("<security token>"); 8068 Local<String> token = v8_str("<security token>");
8069 other->SetSecurityToken(token); 8069 other->SetSecurityToken(token);
8070 current->SetSecurityToken(token); 8070 current->SetSecurityToken(token);
8071 8071
8072 // Setup reference from current to other. 8072 // Set up reference from current to other.
8073 current->Global()->Set(v8_str("other"), other->Global()); 8073 current->Global()->Set(v8_str("other"), other->Global());
8074 8074
8075 // Trigger lazy loading in other context. 8075 // Trigger lazy loading in other context.
8076 Local<Script> script = 8076 Local<Script> script =
8077 Script::Compile(v8_str("other.eval('new Date(42)')")); 8077 Script::Compile(v8_str("other.eval('new Date(42)')"));
8078 Local<Value> value = script->Run(); 8078 Local<Value> value = script->Run();
8079 CHECK_EQ(42.0, value->NumberValue()); 8079 CHECK_EQ(42.0, value->NumberValue());
8080 } 8080 }
8081 8081
8082 8082
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
10173 } else { 10173 } else {
10174 // Otherwise select a new test and start that. 10174 // Otherwise select a new test and start that.
10175 NextThread(); 10175 NextThread();
10176 } 10176 }
10177 } 10177 }
10178 10178
10179 10179
10180 static unsigned linear_congruential_generator; 10180 static unsigned linear_congruential_generator;
10181 10181
10182 10182
10183 void ApiTestFuzzer::Setup(PartOfTest part) { 10183 void ApiTestFuzzer::SetUp(PartOfTest part) {
10184 linear_congruential_generator = i::FLAG_testing_prng_seed; 10184 linear_congruential_generator = i::FLAG_testing_prng_seed;
10185 fuzzing_ = true; 10185 fuzzing_ = true;
10186 int count = RegisterThreadedTest::count(); 10186 int count = RegisterThreadedTest::count();
10187 int start = count * part / (LAST_PART + 1); 10187 int start = count * part / (LAST_PART + 1);
10188 int end = (count * (part + 1) / (LAST_PART + 1)) - 1; 10188 int end = (count * (part + 1) / (LAST_PART + 1)) - 1;
10189 active_tests_ = tests_being_run_ = end - start + 1; 10189 active_tests_ = tests_being_run_ = end - start + 1;
10190 for (int i = 0; i < tests_being_run_; i++) { 10190 for (int i = 0; i < tests_being_run_; i++) {
10191 RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer(i + start); 10191 RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer(i + start);
10192 } 10192 }
10193 for (int i = 0; i < active_tests_; i++) { 10193 for (int i = 0; i < active_tests_; i++) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
10237 fuzzing_ = false; 10237 fuzzing_ = false;
10238 for (int i = 0; i < RegisterThreadedTest::count(); i++) { 10238 for (int i = 0; i < RegisterThreadedTest::count(); i++) {
10239 ApiTestFuzzer *fuzzer = RegisterThreadedTest::nth(i)->fuzzer_; 10239 ApiTestFuzzer *fuzzer = RegisterThreadedTest::nth(i)->fuzzer_;
10240 if (fuzzer != NULL) fuzzer->Join(); 10240 if (fuzzer != NULL) fuzzer->Join();
10241 } 10241 }
10242 } 10242 }
10243 10243
10244 10244
10245 // Lets not be needlessly self-referential. 10245 // Lets not be needlessly self-referential.
10246 TEST(Threading) { 10246 TEST(Threading) {
10247 ApiTestFuzzer::Setup(ApiTestFuzzer::FIRST_PART); 10247 ApiTestFuzzer::SetUp(ApiTestFuzzer::FIRST_PART);
10248 ApiTestFuzzer::RunAllTests(); 10248 ApiTestFuzzer::RunAllTests();
10249 ApiTestFuzzer::TearDown(); 10249 ApiTestFuzzer::TearDown();
10250 } 10250 }
10251 10251
10252 TEST(Threading2) { 10252 TEST(Threading2) {
10253 ApiTestFuzzer::Setup(ApiTestFuzzer::SECOND_PART); 10253 ApiTestFuzzer::SetUp(ApiTestFuzzer::SECOND_PART);
10254 ApiTestFuzzer::RunAllTests(); 10254 ApiTestFuzzer::RunAllTests();
10255 ApiTestFuzzer::TearDown(); 10255 ApiTestFuzzer::TearDown();
10256 } 10256 }
10257 10257
10258 TEST(Threading3) { 10258 TEST(Threading3) {
10259 ApiTestFuzzer::Setup(ApiTestFuzzer::THIRD_PART); 10259 ApiTestFuzzer::SetUp(ApiTestFuzzer::THIRD_PART);
10260 ApiTestFuzzer::RunAllTests(); 10260 ApiTestFuzzer::RunAllTests();
10261 ApiTestFuzzer::TearDown(); 10261 ApiTestFuzzer::TearDown();
10262 } 10262 }
10263 10263
10264 TEST(Threading4) { 10264 TEST(Threading4) {
10265 ApiTestFuzzer::Setup(ApiTestFuzzer::FOURTH_PART); 10265 ApiTestFuzzer::SetUp(ApiTestFuzzer::FOURTH_PART);
10266 ApiTestFuzzer::RunAllTests(); 10266 ApiTestFuzzer::RunAllTests();
10267 ApiTestFuzzer::TearDown(); 10267 ApiTestFuzzer::TearDown();
10268 } 10268 }
10269 10269
10270 void ApiTestFuzzer::CallTest() { 10270 void ApiTestFuzzer::CallTest() {
10271 if (kLogThreading) 10271 if (kLogThreading)
10272 printf("Start test %d\n", test_number_); 10272 printf("Start test %d\n", test_number_);
10273 CallTestNumber(test_number_); 10273 CallTestNumber(test_number_);
10274 if (kLogThreading) 10274 if (kLogThreading)
10275 printf("End test %d\n", test_number_); 10275 printf("End test %d\n", test_number_);
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
12114 calling_context2->SetSecurityToken(token); 12114 calling_context2->SetSecurityToken(token);
12115 12115
12116 // Create an object with a C++ callback in context0. 12116 // Create an object with a C++ callback in context0.
12117 calling_context0->Enter(); 12117 calling_context0->Enter();
12118 Local<v8::FunctionTemplate> callback_templ = 12118 Local<v8::FunctionTemplate> callback_templ =
12119 v8::FunctionTemplate::New(GetCallingContextCallback); 12119 v8::FunctionTemplate::New(GetCallingContextCallback);
12120 calling_context0->Global()->Set(v8_str("callback"), 12120 calling_context0->Global()->Set(v8_str("callback"),
12121 callback_templ->GetFunction()); 12121 callback_templ->GetFunction());
12122 calling_context0->Exit(); 12122 calling_context0->Exit();
12123 12123
12124 // Expose context0 in context1 and setup a function that calls the 12124 // Expose context0 in context1 and set up a function that calls the
12125 // callback function. 12125 // callback function.
12126 calling_context1->Enter(); 12126 calling_context1->Enter();
12127 calling_context1->Global()->Set(v8_str("context0"), 12127 calling_context1->Global()->Set(v8_str("context0"),
12128 calling_context0->Global()); 12128 calling_context0->Global());
12129 CompileRun("function f() { context0.callback() }"); 12129 CompileRun("function f() { context0.callback() }");
12130 calling_context1->Exit(); 12130 calling_context1->Exit();
12131 12131
12132 // Expose context1 in context2 and call the callback function in 12132 // Expose context1 in context2 and call the callback function in
12133 // context0 indirectly through f in context1. 12133 // context0 indirectly through f in context1.
12134 calling_context2->Enter(); 12134 calling_context2->Enter();
(...skipping 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after
15824 CompileRun("throw 'exception';"); 15824 CompileRun("throw 'exception';");
15825 } 15825 }
15826 15826
15827 15827
15828 TEST(CallCompletedCallbackTwoExceptions) { 15828 TEST(CallCompletedCallbackTwoExceptions) {
15829 v8::HandleScope scope; 15829 v8::HandleScope scope;
15830 LocalContext env; 15830 LocalContext env;
15831 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); 15831 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException);
15832 CompileRun("throw 'first exception';"); 15832 CompileRun("throw 'first exception';");
15833 } 15833 }
OLDNEW
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698