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

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

Issue 2589203002: [debugger] deprecate v8::Debug:GetDebugContext. (Closed)
Patch Set: remove deprecated use Created 3 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
« no previous file with comments | « src/inspector/v8-debugger.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 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 5645 matching lines...) Expand 10 before | Expand all | Expand 10 after
5656 foo->Call(debugee_context, env->Global(), 0, NULL).ToLocalChecked(); 5656 foo->Call(debugee_context, env->Global(), 0, NULL).ToLocalChecked();
5657 CHECK_EQ(1, break_point_hit_count); 5657 CHECK_EQ(1, break_point_hit_count);
5658 5658
5659 v8::Debug::SetDebugEventListener(isolate, nullptr); 5659 v8::Debug::SetDebugEventListener(isolate, nullptr);
5660 debugee_context = v8::Local<v8::Context>(); 5660 debugee_context = v8::Local<v8::Context>();
5661 debugger_context = v8::Local<v8::Context>(); 5661 debugger_context = v8::Local<v8::Context>();
5662 CheckDebuggerUnloaded(isolate); 5662 CheckDebuggerUnloaded(isolate);
5663 } 5663 }
5664 5664
5665 5665
5666 TEST(DebugContextIsPreservedBetweenAccesses) {
5667 v8::HandleScope scope(CcTest::isolate());
5668 v8::Debug::SetDebugEventListener(CcTest::isolate(),
5669 DebugEventBreakPointHitCount);
5670 v8::Local<v8::Context> context1 =
5671 v8::Debug::GetDebugContext(CcTest::isolate());
5672 v8::Local<v8::Context> context2 =
5673 v8::Debug::GetDebugContext(CcTest::isolate());
5674 CHECK(v8::Utils::OpenHandle(*context1).is_identical_to(
5675 v8::Utils::OpenHandle(*context2)));
5676 v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr);
5677 }
5678
5679
5680 TEST(NoDebugContextWhenDebuggerDisabled) {
5681 v8::HandleScope scope(CcTest::isolate());
5682 v8::Local<v8::Context> context =
5683 v8::Debug::GetDebugContext(CcTest::isolate());
5684 CHECK(context.IsEmpty());
5685 }
5686
5687 static v8::Local<v8::Value> expected_callback_data; 5666 static v8::Local<v8::Value> expected_callback_data;
5688 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { 5667 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
5689 CHECK(details.GetEventContext() == expected_context); 5668 CHECK(details.GetEventContext() == expected_context);
5690 CHECK(expected_callback_data->Equals(details.GetEventContext(), 5669 CHECK(expected_callback_data->Equals(details.GetEventContext(),
5691 details.GetCallbackData()) 5670 details.GetCallbackData())
5692 .FromJust()); 5671 .FromJust());
5693 } 5672 }
5694 5673
5695 5674
5696 // Check that event details contain context where debug event occured. 5675 // Check that event details contain context where debug event occured.
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
6658 "function foo() {\n" 6637 "function foo() {\n"
6659 " try { throw new Error(); } catch (e) {}\n" 6638 " try { throw new Error(); } catch (e) {}\n"
6660 "}\n" 6639 "}\n"
6661 "debugger;\n" 6640 "debugger;\n"
6662 "foo();\n" 6641 "foo();\n"
6663 "foo();\n"); 6642 "foo();\n");
6664 6643
6665 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 6644 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
6666 CHECK_EQ(break_point_hit_count, 4); 6645 CHECK_EQ(break_point_hit_count, 4);
6667 } 6646 }
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698