OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 | 70 |
71 // Check result of a test. | 71 // Check result of a test. |
72 function EndTest() { | 72 function EndTest() { |
73 assertTrue(listener_called, "listerner not called for " + test_name); | 73 assertTrue(listener_called, "listerner not called for " + test_name); |
74 assertNull(exception, test_name); | 74 assertNull(exception, test_name); |
75 end_test_count++; | 75 end_test_count++; |
76 } | 76 } |
77 | 77 |
78 | 78 |
| 79 // Check that two scope are the same. |
| 80 function CheckScopeMirrors(scope1, scope2) { |
| 81 assertEquals(scope1.scopeType(), scope2.scopeType()); |
| 82 assertEquals(scope1.frameIndex(), scope2.frameIndex()); |
| 83 assertEquals(scope1.scopeIndex(), scope2.scopeIndex()); |
| 84 } |
| 85 |
| 86 |
79 // Check that the scope chain contains the expected types of scopes. | 87 // Check that the scope chain contains the expected types of scopes. |
80 function CheckScopeChain(scopes, exec_state) { | 88 function CheckScopeChain(scopes, exec_state) { |
| 89 var all_scopes = exec_state.frame().allScopes(); |
81 assertEquals(scopes.length, exec_state.frame().scopeCount()); | 90 assertEquals(scopes.length, exec_state.frame().scopeCount()); |
| 91 assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length")
; |
82 for (var i = 0; i < scopes.length; i++) { | 92 for (var i = 0; i < scopes.length; i++) { |
83 var scope = exec_state.frame().scope(i); | 93 var scope = exec_state.frame().scope(i); |
84 assertTrue(scope.isScope()); | 94 assertTrue(scope.isScope()); |
85 assertEquals(scopes[i], scope.scopeType()); | 95 assertEquals(scopes[i], scope.scopeType()); |
| 96 CheckScopeMirrors(all_scopes[i], scope); |
86 | 97 |
87 // Check the global object when hitting the global scope. | 98 // Check the global object when hitting the global scope. |
88 if (scopes[i] == debug.ScopeType.Global) { | 99 if (scopes[i] == debug.ScopeType.Global) { |
89 // Objects don't have same class (one is "global", other is "Object", | 100 // Objects don't have same class (one is "global", other is "Object", |
90 // so just check the properties directly. | 101 // so just check the properties directly. |
91 assertPropertiesEqual(this, scope.scopeObject().value()); | 102 assertPropertiesEqual(this, scope.scopeObject().value()); |
92 } | 103 } |
93 } | 104 } |
94 | 105 |
95 // Get the debug command processor. | 106 // Get the debug command processor. |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 CheckScopeContent({e:'Exception'}, 0, exec_state); | 999 CheckScopeContent({e:'Exception'}, 0, exec_state); |
989 }; | 1000 }; |
990 catch_block_7(); | 1001 catch_block_7(); |
991 EndTest(); | 1002 EndTest(); |
992 | 1003 |
993 | 1004 |
994 assertEquals(begin_test_count, break_count, | 1005 assertEquals(begin_test_count, break_count, |
995 'one or more tests did not enter the debugger'); | 1006 'one or more tests did not enter the debugger'); |
996 assertEquals(begin_test_count, end_test_count, | 1007 assertEquals(begin_test_count, end_test_count, |
997 'one or more tests did not have its result checked'); | 1008 'one or more tests did not have its result checked'); |
OLD | NEW |