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

Side by Side Diff: runtime/vm/debugger_api_impl_test.cc

Issue 2364923003: Fix vm/cc/Debug_StepInto test which relied on old defaults (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_mirrors_api.h" 5 #include "include/dart_mirrors_api.h"
6 #include "include/dart_tools_api.h" 6 #include "include/dart_tools_api.h"
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 20 matching lines...) Expand all
31 ASSERT(script_lib != NULL); 31 ASSERT(script_lib != NULL);
32 ASSERT(!Dart_IsError(script_lib)); 32 ASSERT(!Dart_IsError(script_lib));
33 ASSERT(Dart_IsLibrary(script_lib)); 33 ASSERT(Dart_IsLibrary(script_lib));
34 Dart_Handle res = Dart_SetBreakpointAtEntry(script_lib, 34 Dart_Handle res = Dart_SetBreakpointAtEntry(script_lib,
35 NewString(cname), 35 NewString(cname),
36 NewString(fname)); 36 NewString(fname));
37 EXPECT(Dart_IsInteger(res)); 37 EXPECT(Dart_IsInteger(res));
38 } 38 }
39 39
40 40
41 static void DisableDebuggabilityOfDartColonLibraries() {
42 const char* dart_colon = "dart:";
43 const intptr_t dart_colon_length = strlen(dart_colon);
44 // Disable debuggability of all dart: libraries.
45 Dart_Handle library_ids = Dart_GetLibraryIds();
46 intptr_t library_ids_length;
47 Dart_ListLength(library_ids, &library_ids_length);
48 for (intptr_t i = 0; i < library_ids_length; i++) {
49 Dart_Handle library_id_handle = Dart_ListGetAt(library_ids, i);
50 int64_t library_id;
51 Dart_IntegerToInt64(library_id_handle, &library_id);
52 Dart_Handle library_url_handle = Dart_GetLibraryURL(library_id);
53 const char* library_url;
54 Dart_StringToCString(library_url_handle, &library_url);
55 if (strncmp(library_url, dart_colon, dart_colon_length) == 0) {
56 Dart_SetLibraryDebuggable(library_id, false);
57 } else {
58 Dart_SetLibraryDebuggable(library_id, true);
59 }
60 }
61 }
62
63
41 static Dart_Handle Invoke(const char* func_name) { 64 static Dart_Handle Invoke(const char* func_name) {
42 ASSERT(script_lib != NULL); 65 ASSERT(script_lib != NULL);
43 ASSERT(!Dart_IsError(script_lib)); 66 ASSERT(!Dart_IsError(script_lib));
44 ASSERT(Dart_IsLibrary(script_lib)); 67 ASSERT(Dart_IsLibrary(script_lib));
45 return Dart_Invoke(script_lib, NewString(func_name), 0, NULL); 68 return Dart_Invoke(script_lib, NewString(func_name), 0, NULL);
46 } 69 }
47 70
48 71
49 static char const* ToCString(Dart_Handle str) { 72 static char const* ToCString(Dart_Handle str) {
50 EXPECT(Dart_IsString(str)); 73 EXPECT(Dart_IsString(str));
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 " return o.kvmk(3, c:5); \n" 757 " return o.kvmk(3, c:5); \n"
735 "} \n" 758 "} \n"
736 " \n" 759 " \n"
737 "main() { \n" 760 "main() { \n"
738 " return foo(); \n" 761 " return foo(); \n"
739 "} \n"; 762 "} \n";
740 763
741 LoadScript(kScriptChars); 764 LoadScript(kScriptChars);
742 Dart_SetPausedEventHandler(&TestStepIntoHandler); 765 Dart_SetPausedEventHandler(&TestStepIntoHandler);
743 766
767 DisableDebuggabilityOfDartColonLibraries();
768
744 SetBreakpointAtEntry("", "main"); 769 SetBreakpointAtEntry("", "main");
745 breakpoint_hit = false; 770 breakpoint_hit = false;
746 breakpoint_hit_counter = 0; 771 breakpoint_hit_counter = 0;
747 Dart_Handle retval = Invoke("main"); 772 Dart_Handle retval = Invoke("main");
748 EXPECT_VALID(retval); 773 EXPECT_VALID(retval);
749 EXPECT(Dart_IsInteger(retval)); 774 EXPECT(Dart_IsInteger(retval));
750 int64_t int_value = ToInt64(retval); 775 int64_t int_value = ToInt64(retval);
751 EXPECT_EQ(7, int_value); 776 EXPECT_EQ(7, int_value);
752 EXPECT(breakpoint_hit == true); 777 EXPECT(breakpoint_hit == true);
753 EXPECT(breakpoint_hit_counter == ARRAY_SIZE(step_into_expected_bpts)); 778 EXPECT(breakpoint_hit_counter == ARRAY_SIZE(step_into_expected_bpts));
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 " null, 5, 17, 5, 18, 9, 19, 12," 2360 " null, 5, 17, 5, 18, 9, 19, 12,"
2336 " null, 6, 21, 1," 2361 " null, 6, 21, 1,"
2337 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," 2362 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8,"
2338 " null, 9, 29, 1]", 2363 " null, 9, 29, 1]",
2339 tokens_cstr); 2364 tokens_cstr);
2340 } 2365 }
2341 2366
2342 #endif 2367 #endif
2343 2368
2344 } // namespace dart 2369 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698