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

Side by Side Diff: test/debugger/debug/debug-return-value.js

Issue 2566093002: [debug-wrapper] migrate some scope related tests (Closed)
Patch Set: address comments 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Flags: --expose-debug-as debug
29 // Get the Debug object exposed from the debug context global object.
30 Debug = debug.Debug 28 Debug = debug.Debug
31 29
32 listener_complete = false; 30 listener_complete = false;
33 exception = false; 31 exception = false;
34 break_count = 0; 32 break_count = 0;
35 expected_return_value = 0; 33 expected_return_value = 0;
36 debugger_source_position = 0; 34 debugger_source_position = 0;
37 35
38 // Listener which expects to do four steps to reach returning from the function. 36 // Listener which expects to do four steps to reach returning from the function.
39 function listener(event, exec_state, event_data, data) { 37 function listener(event, exec_state, event_data, data) {
40 try { 38 try {
41 if (event == Debug.DebugEvent.Break) 39 if (event == Debug.DebugEvent.Break)
42 { 40 {
43 break_count++; 41 break_count++;
44 if (break_count < 4) { 42 if (break_count < 4) {
45 assertFalse(exec_state.frame(0).isAtReturn())
46 switch (break_count) { 43 switch (break_count) {
47 case 1: 44 case 1:
48 // Collect the position of the debugger statement. 45 // Collect the position of the debugger statement.
49 debugger_source_position = exec_state.frame(0).sourcePosition(); 46 debugger_source_position = exec_state.frame(0).sourcePosition();
50 break; 47 break;
51 case 2: 48 case 2:
52 // Position now at the if statement. 49 // Position now at the if statement.
53 assertEquals(debugger_source_position + 10, 50 assertEquals(debugger_source_position + 10,
54 exec_state.frame(0).sourcePosition()); 51 exec_state.frame(0).sourcePosition());
55 break; 52 break;
(...skipping 10 matching lines...) Expand all
66 default: 63 default:
67 fail("Unexpected"); 64 fail("Unexpected");
68 } 65 }
69 exec_state.prepareStep(Debug.StepAction.StepIn); 66 exec_state.prepareStep(Debug.StepAction.StepIn);
70 } else { 67 } else {
71 // Position at the end of the function. 68 // Position at the end of the function.
72 assertEquals(debugger_source_position + 50, 69 assertEquals(debugger_source_position + 50,
73 exec_state.frame(0).sourcePosition()); 70 exec_state.frame(0).sourcePosition());
74 71
75 // Just about to return from the function. 72 // Just about to return from the function.
76 assertTrue(exec_state.frame(0).isAtReturn())
77 assertEquals(expected_return_value, 73 assertEquals(expected_return_value,
78 exec_state.frame(0).returnValue().value()); 74 exec_state.frame(0).returnValue().value());
79 75
80 listener_complete = true; 76 listener_complete = true;
81 } 77 }
82 } 78 }
83 } catch (e) { 79 } catch (e) {
84 exception = e 80 exception = e
85 print(e + e.stack) 81 print(e + e.stack)
86 }; 82 };
(...skipping 26 matching lines...) Expand all
113 assertTrue(listener_complete); 109 assertTrue(listener_complete);
114 assertEquals(4, break_count); 110 assertEquals(4, break_count);
115 111
116 break_count = 0; 112 break_count = 0;
117 expected_return_value = 2; 113 expected_return_value = 2;
118 listener_complete = false; 114 listener_complete = false;
119 f(false); 115 f(false);
120 assertFalse(exception, "exception in listener") 116 assertFalse(exception, "exception in listener")
121 assertTrue(listener_complete); 117 assertTrue(listener_complete);
122 assertEquals(4, break_count); 118 assertEquals(4, break_count);
OLDNEW
« no previous file with comments | « test/debugger/debug/debug-evaluate-bool-constructor.js ('k') | test/debugger/debug/debug-scopes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698