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

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

Issue 726643002: harmony-scoping: Implement debugger support for script scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nit + rebased Created 6 years, 1 month 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/runtime/runtime-debug.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized.js » ('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 7612 matching lines...) Expand 10 before | Expand all | Expand 10 after
7623 static void DebugHarmonyScopingListener( 7623 static void DebugHarmonyScopingListener(
7624 const v8::Debug::EventDetails& event_details) { 7624 const v8::Debug::EventDetails& event_details) {
7625 v8::DebugEvent event = event_details.GetEvent(); 7625 v8::DebugEvent event = event_details.GetEvent();
7626 if (event != v8::Break) return; 7626 if (event != v8::Break) return;
7627 7627
7628 int break_id = CcTest::i_isolate()->debug()->break_id(); 7628 int break_id = CcTest::i_isolate()->debug()->break_id();
7629 7629
7630 char script[128]; 7630 char script[128];
7631 i::Vector<char> script_vector(script, sizeof(script)); 7631 i::Vector<char> script_vector(script, sizeof(script));
7632 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); 7632 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id);
7633 v8::Local<v8::Value> result = CompileRun(script); 7633 ExpectInt32(script, 1);
7634 7634
7635 CHECK_EQ(1, result->Int32Value()); 7635 SNPrintF(script_vector, "var frame = new FrameMirror(%d, 0);", break_id);
7636 CompileRun(script);
7637 ExpectInt32("frame.evaluate('x').value_", 1);
7638 ExpectInt32("frame.evaluate('y').value_", 2);
7639
7640 CompileRun("var allScopes = frame.allScopes()");
7641 ExpectInt32("allScopes.length", 2);
7642
7643 ExpectBoolean("allScopes[0].scopeType() === ScopeType.Script", true);
7644
7645 ExpectInt32("allScopes[0].scopeObject().value_.x", 1);
7646
7647 ExpectInt32("allScopes[0].scopeObject().value_.y", 2);
7648
7649 CompileRun("allScopes[0].setVariableValue('x', 5);");
7650 CompileRun("allScopes[0].setVariableValue('y', 6);");
7651 ExpectInt32("frame.evaluate('x + y').value_", 11);
7636 } 7652 }
7637 7653
7638 7654
7639 TEST(DebugBreakInLexicalScopes) { 7655 TEST(DebugBreakInLexicalScopes) {
7640 i::FLAG_harmony_scoping = true; 7656 i::FLAG_harmony_scoping = true;
7641 i::FLAG_allow_natives_syntax = true; 7657 i::FLAG_allow_natives_syntax = true;
7642 7658
7643 DebugLocalContext env; 7659 DebugLocalContext env;
7644 v8::Isolate* isolate = env->GetIsolate(); 7660 v8::Isolate* isolate = env->GetIsolate();
7645 v8::HandleScope scope(isolate); 7661 v8::HandleScope scope(isolate);
7646 v8::Debug::SetDebugEventListener(DebugHarmonyScopingListener); 7662 v8::Debug::SetDebugEventListener(DebugHarmonyScopingListener);
7647 7663
7648 CompileRun( 7664 CompileRun(
7649 "'use strict'; \n" 7665 "'use strict'; \n"
7650 "let x = 1; \n"); 7666 "let x = 1; \n");
7651 CompileRun( 7667 ExpectInt32(
7652 "'use strict'; \n" 7668 "'use strict'; \n"
7653 "let y = 1; \n" 7669 "let y = 2; \n"
7654 "debugger \n"); 7670 "debugger; \n"
7671 "x * y",
7672 30);
7673 ExpectInt32(
7674 "x = 1; y = 2; \n"
7675 "debugger;"
7676 "x * y",
7677 30);
7655 } 7678 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698