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

Unified Diff: test/cctest/test-debug.cc

Issue 2108024: Provide access to the debuggee context from debug event listener (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« src/debug.cc ('K') | « src/debug.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
===================================================================
--- test/cctest/test-debug.cc (revision 4685)
+++ test/cctest/test-debug.cc (working copy)
@@ -6196,7 +6196,28 @@
v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext();
v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext();
CHECK_EQ(*context1, *context2);
- // Make sure debugger is unloaded before running other tests.
- v8::internal::ForceUnloadDebugger();
+}
+
+
+static v8::Handle<v8::Value> expected_callback_data;
+static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
+ CHECK(details.GetEventContext() == expected_context);
+ CHECK_EQ(expected_callback_data, details.GetCallbackData());
+}
+
+// Check that event details contain context where debug event occured.
+TEST(DebugEventContext) {
+ v8::HandleScope scope;
+ expected_callback_data = v8::Int32::New(2010);
+ v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
+ expected_callback_data);
+ expected_context = v8::Context::New();
+ v8::Context::Scope context_scope(expected_context);
+ v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
+ expected_context.Dispose();
+ expected_context.Clear();
+ v8::Debug::SetDebugEventListener(NULL);
+ expected_context_data = v8::Handle<v8::Value>();
CheckDebuggerUnloaded();
}
+
« src/debug.cc ('K') | « src/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698