OLD | NEW |
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 7295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7306 | 7306 |
7307 // The second script uses forEach. | 7307 // The second script uses forEach. |
7308 const char* script_2 = "[0].forEach(function() { });"; | 7308 const char* script_2 = "[0].forEach(function() { });"; |
7309 CompileRun(script_2); | 7309 CompileRun(script_2); |
7310 | 7310 |
7311 v8::Debug::SetDebugEventListener(NULL); | 7311 v8::Debug::SetDebugEventListener(NULL); |
7312 } | 7312 } |
7313 | 7313 |
7314 | 7314 |
7315 // Import from test-heap.cc | 7315 // Import from test-heap.cc |
| 7316 namespace v8 { |
| 7317 namespace internal { |
| 7318 |
7316 int CountNativeContexts(); | 7319 int CountNativeContexts(); |
| 7320 } |
| 7321 } |
7317 | 7322 |
7318 | 7323 |
7319 static void NopListener(const v8::Debug::EventDetails& event_details) { | 7324 static void NopListener(const v8::Debug::EventDetails& event_details) { |
7320 } | 7325 } |
7321 | 7326 |
7322 | 7327 |
7323 TEST(DebuggerCreatesContextIffActive) { | 7328 TEST(DebuggerCreatesContextIffActive) { |
7324 DebugLocalContext env; | 7329 DebugLocalContext env; |
7325 v8::HandleScope scope(env->GetIsolate()); | 7330 v8::HandleScope scope(env->GetIsolate()); |
7326 CHECK_EQ(1, CountNativeContexts()); | 7331 CHECK_EQ(1, v8::internal::CountNativeContexts()); |
7327 | 7332 |
7328 v8::Debug::SetDebugEventListener(NULL); | 7333 v8::Debug::SetDebugEventListener(NULL); |
7329 CompileRun("debugger;"); | 7334 CompileRun("debugger;"); |
7330 CHECK_EQ(1, CountNativeContexts()); | 7335 CHECK_EQ(1, v8::internal::CountNativeContexts()); |
7331 | 7336 |
7332 v8::Debug::SetDebugEventListener(NopListener); | 7337 v8::Debug::SetDebugEventListener(NopListener); |
7333 CompileRun("debugger;"); | 7338 CompileRun("debugger;"); |
7334 CHECK_EQ(2, CountNativeContexts()); | 7339 CHECK_EQ(2, v8::internal::CountNativeContexts()); |
7335 | 7340 |
7336 v8::Debug::SetDebugEventListener(NULL); | 7341 v8::Debug::SetDebugEventListener(NULL); |
7337 } | 7342 } |
7338 | 7343 |
7339 | 7344 |
7340 TEST(LiveEditEnabled) { | 7345 TEST(LiveEditEnabled) { |
7341 v8::internal::FLAG_allow_natives_syntax = true; | 7346 v8::internal::FLAG_allow_natives_syntax = true; |
7342 LocalContext env; | 7347 LocalContext env; |
7343 v8::HandleScope scope(env->GetIsolate()); | 7348 v8::HandleScope scope(env->GetIsolate()); |
7344 v8::Debug::SetLiveEditEnabled(env->GetIsolate(), true); | 7349 v8::Debug::SetLiveEditEnabled(env->GetIsolate(), true); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7612 "let y = 2; \n" | 7617 "let y = 2; \n" |
7613 "debugger; \n" | 7618 "debugger; \n" |
7614 "x * y", | 7619 "x * y", |
7615 30); | 7620 30); |
7616 ExpectInt32( | 7621 ExpectInt32( |
7617 "x = 1; y = 2; \n" | 7622 "x = 1; y = 2; \n" |
7618 "debugger;" | 7623 "debugger;" |
7619 "x * y", | 7624 "x * y", |
7620 30); | 7625 30); |
7621 } | 7626 } |
OLD | NEW |