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 6907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6918 v8::HandleScope scope(CcTest::isolate()); | 6918 v8::HandleScope scope(CcTest::isolate()); |
6919 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); | 6919 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); |
6920 v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext(); | 6920 v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext(); |
6921 v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext(); | 6921 v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext(); |
6922 CHECK(v8::Utils::OpenHandle(*context1).is_identical_to( | 6922 CHECK(v8::Utils::OpenHandle(*context1).is_identical_to( |
6923 v8::Utils::OpenHandle(*context2))); | 6923 v8::Utils::OpenHandle(*context2))); |
6924 v8::Debug::SetDebugEventListener(NULL); | 6924 v8::Debug::SetDebugEventListener(NULL); |
6925 } | 6925 } |
6926 | 6926 |
6927 | 6927 |
| 6928 TEST(NoDebugContextWhenDebuggerDisabled) { |
| 6929 v8::HandleScope scope(CcTest::isolate()); |
| 6930 v8::Local<v8::Context> context = v8::Debug::GetDebugContext(); |
| 6931 CHECK(context.IsEmpty()); |
| 6932 } |
| 6933 |
| 6934 |
6928 static v8::Handle<v8::Value> expected_callback_data; | 6935 static v8::Handle<v8::Value> expected_callback_data; |
6929 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { | 6936 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { |
6930 CHECK(details.GetEventContext() == expected_context); | 6937 CHECK(details.GetEventContext() == expected_context); |
6931 CHECK(expected_callback_data->Equals(details.GetCallbackData())); | 6938 CHECK(expected_callback_data->Equals(details.GetCallbackData())); |
6932 } | 6939 } |
6933 | 6940 |
6934 | 6941 |
6935 // Check that event details contain context where debug event occured. | 6942 // Check that event details contain context where debug event occured. |
6936 TEST(DebugEventContext) { | 6943 TEST(DebugEventContext) { |
6937 v8::Isolate* isolate = CcTest::isolate(); | 6944 v8::Isolate* isolate = CcTest::isolate(); |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7593 "let y = 2; \n" | 7600 "let y = 2; \n" |
7594 "debugger; \n" | 7601 "debugger; \n" |
7595 "x * y", | 7602 "x * y", |
7596 30); | 7603 30); |
7597 ExpectInt32( | 7604 ExpectInt32( |
7598 "x = 1; y = 2; \n" | 7605 "x = 1; y = 2; \n" |
7599 "debugger;" | 7606 "debugger;" |
7600 "x * y", | 7607 "x * y", |
7601 30); | 7608 30); |
7602 } | 7609 } |
OLD | NEW |