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

Unified Diff: runtime/vm/debugger_api_impl_test.cc

Issue 9117015: Add functions to list library and script urls in an isolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/debugger_api_impl_test.cc
===================================================================
--- runtime/vm/debugger_api_impl_test.cc (revision 3502)
+++ runtime/vm/debugger_api_impl_test.cc (working copy)
@@ -192,6 +192,39 @@
EXPECT(func.IsNull());
func = test_lib.LookupFunctionInSource(script_url, 10);
EXPECT(func.IsNull());
+
+ Dart_Handle libs = Dart_GetLibraryURLs();
+ EXPECT(Dart_IsList(libs));
+ intptr_t num_libs;
+ Dart_ListLength(libs, &num_libs);
+ EXPECT(num_libs > 0);
+ for (intptr_t i = 0; i < num_libs; i++) {
+ Dart_Handle lib_url = Dart_ListGetAt(libs, i);
+ EXPECT(Dart_IsString(lib_url));
+ char const* chars;
+ Dart_StringToCString(lib_url, &chars);
+ printf("Lib %d: %s\n", i, chars);
siva 2012/01/24 18:37:14 instead of printf would it make sense to do an EXP
hausner 2012/01/24 21:34:42 Yes, if I knew what the expected library names are
+
+ Dart_Handle scripts = Dart_GetScriptURLs(lib_url);
+ EXPECT(Dart_IsList(scripts));
+ intptr_t num_scripts;
+ Dart_ListLength(scripts, &num_scripts);
+ EXPECT(num_scripts >= 0);
+ for (intptr_t i = 0; i < num_scripts; i++) {
+ Dart_Handle script_url = Dart_ListGetAt(scripts, i);
+ char const* chars;
+ Dart_StringToCString(script_url, &chars);
+ printf(" script %d: '%s'\n", i + 1, chars);
siva 2012/01/24 18:37:14 Ditto.
hausner 2012/01/24 21:34:42 Ditto regarding script urls.
+ }
+ }
+
+ Dart_Handle lib_url = Dart_NewString(TestCase::url());
+ Dart_Handle source = Dart_GetScriptSource(lib_url, lib_url);
+ EXPECT(Dart_IsString(source));
+ char const* source_chars;
+ Dart_StringToCString(source, &source_chars);
+ printf("\n=== source: ===\n%s", source_chars);
+ EXPECT_STREQ(kScriptChars, source_chars);
}
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).

Powered by Google App Engine
This is Rietveld 408576698