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

Side by Side Diff: test/mjsunit/regress/regress-1853.js

Issue 2535733002: [debug] remove debug command processor from regress tests. (Closed)
Patch Set: Created 4 years 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 | « test/mjsunit/regress/regress-1639-2.js ('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 18 matching lines...) Expand all
29 29
30 // Test whether scripts compiled after setting the break point are 30 // Test whether scripts compiled after setting the break point are
31 // updated correctly. 31 // updated correctly.
32 32
33 Debug = debug.Debug; 33 Debug = debug.Debug;
34 34
35 var break_count = 0; 35 var break_count = 0;
36 var test_break_1 = false; 36 var test_break_1 = false;
37 var test_break_2 = false; 37 var test_break_2 = false;
38 38
39 function sendCommand(state, cmd) {
40 // Get the debug command processor in paused state.
41 var dcp = state.debugCommandProcessor(false);
42 var request = JSON.stringify(cmd);
43 var response = dcp.processDebugJSONRequest(request);
44 return JSON.parse(response);
45 }
46
47 function setBreakPointByName(state) { 39 function setBreakPointByName(state) {
48 sendCommand(state, { 40 var scripts = Debug.scripts();
49 seq: 0, 41 for (var script of scripts) {
50 type: "request", 42 if (script.source_url == "testScriptOne") {
51 command: "setbreakpoint", 43 Debug.setScriptBreakPointById(script.id, 2);
52 arguments: {
53 type: "script",
54 target: "testScriptOne",
55 line: 2
56 } 44 }
57 }); 45 }
58 } 46 }
59 47
60 function setBreakPointByRegExp(state) { 48 function setBreakPointByRegExp(state) {
61 sendCommand(state, { 49 var scripts = Debug.scripts();
62 seq: 0, 50 for (var script of scripts) {
63 type: "request", 51 if (/Scrip.Two/.test(script.source_url)) {
64 command: "setbreakpoint", 52 Debug.setScriptBreakPointById(script.id, 2);
65 arguments: {
66 type: "scriptRegExp",
67 target: "Scrip.Two",
68 line: 2
69 } 53 }
70 }); 54 }
71 } 55 }
72 56
73 function listener(event, exec_state, event_data, data) { 57 function listener(event, exec_state, event_data, data) {
74 try { 58 try {
75 if (event == Debug.DebugEvent.Break) { 59 if (event == Debug.DebugEvent.Break) {
76 switch (break_count) { 60 switch (break_count) {
77 case 0: 61 case 0:
78 // Set break points before the code has been compiled. 62 // Set break points before the code has been compiled.
79 setBreakPointByName(exec_state); 63 setBreakPointByName(exec_state);
80 setBreakPointByRegExp(exec_state); 64 setBreakPointByRegExp(exec_state);
81 break; 65 break;
82 case 1: 66 case 1:
83 // Set the flag to prove that we hit the first break point. 67 // Set the flag to prove that we hit the first break point.
84 test_break_1 = true; 68 test_break_1 = true;
85 break; 69 break;
86 case 2: 70 case 2:
87 // Set the flag to prove that we hit the second break point. 71 // Set the flag to prove that we hit the second break point.
88 test_break_2 = true; 72 test_break_2 = true;
89 break; 73 break;
90 } 74 }
91 break_count++; 75 break_count++;
92 } 76 }
93 } catch (e) { 77 } catch (e) {
94 print(e); 78 print(e);
95 } 79 }
96 } 80 }
97 81
98 Debug.setListener(listener); 82 Debug.setListener(listener);
99 debugger;
100 83
101 eval('function test1() { \n' + 84 eval('function test1() { \n' +
102 ' assertFalse(test_break_1); \n' + 85 ' assertFalse(test_break_1); \n' +
103 ' assertTrue(test_break_1); \n' + 86 ' assertTrue(test_break_1); \n' +
104 '} \n' + 87 '} \n' +
105 '//# sourceURL=testScriptOne'); 88 '//# sourceURL=testScriptOne');
106 89
107 eval('function test2() { \n' + 90 eval('function test2() { \n' +
108 ' assertFalse(test_break_2); \n' + 91 ' assertFalse(test_break_2); \n' +
109 ' assertTrue(test_break_2); \n' + 92 ' assertTrue(test_break_2); \n' +
110 '} \n' + 93 '} \n' +
111 '//# sourceURL=testScriptTwo'); 94 '//# sourceURL=testScriptTwo');
112 95
96 debugger;
97
113 test1(); 98 test1();
114 test2(); 99 test2();
115 assertEquals(3, break_count); 100 assertEquals(3, break_count);
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-1639-2.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698