OLD | NEW |
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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "include/dart_tools_api.h" | 9 #include "include/dart_tools_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 6230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6241 const char* name_cstr = ""; | 6241 const char* name_cstr = ""; |
6242 EXPECT_VALID(Dart_StringToCString(lib_name, &name_cstr)); | 6242 EXPECT_VALID(Dart_StringToCString(lib_name, &name_cstr)); |
6243 EXPECT_STREQ("testlib", name_cstr); | 6243 EXPECT_STREQ("testlib", name_cstr); |
6244 | 6244 |
6245 Dart_Handle lib_uri = Dart_LibraryUrl(root_lib); | 6245 Dart_Handle lib_uri = Dart_LibraryUrl(root_lib); |
6246 EXPECT_VALID(lib_uri); | 6246 EXPECT_VALID(lib_uri); |
6247 EXPECT(!Dart_IsNull(lib_uri)); | 6247 EXPECT(!Dart_IsNull(lib_uri)); |
6248 const char* uri_cstr = ""; | 6248 const char* uri_cstr = ""; |
6249 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr)); | 6249 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr)); |
6250 EXPECT_STREQ(TestCase::url(), uri_cstr); | 6250 EXPECT_STREQ(TestCase::url(), uri_cstr); |
| 6251 |
| 6252 |
| 6253 Dart_Handle core_uri = Dart_NewStringFromCString("dart:core"); |
| 6254 Dart_Handle core_lib = Dart_LookupLibrary(core_uri); |
| 6255 EXPECT_VALID(core_lib); |
| 6256 EXPECT(Dart_IsLibrary(core_lib)); |
| 6257 |
| 6258 Dart_Handle result = Dart_SetRootLibrary(core_uri); // Not a library. |
| 6259 EXPECT(Dart_IsError(result)); |
| 6260 root_lib = Dart_RootLibrary(); |
| 6261 lib_uri = Dart_LibraryUrl(root_lib); |
| 6262 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr)); |
| 6263 EXPECT_STREQ(TestCase::url(), uri_cstr); // Root library didn't change. |
| 6264 |
| 6265 result = Dart_SetRootLibrary(core_lib); |
| 6266 EXPECT_VALID(result); |
| 6267 root_lib = Dart_RootLibrary(); |
| 6268 lib_uri = Dart_LibraryUrl(root_lib); |
| 6269 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr)); |
| 6270 EXPECT_STREQ("dart:core", uri_cstr); // Root library did change. |
6251 } | 6271 } |
6252 | 6272 |
6253 | 6273 |
6254 static int index = 0; | 6274 static int index = 0; |
6255 | 6275 |
6256 | 6276 |
6257 static Dart_Handle import_library_handler(Dart_LibraryTag tag, | 6277 static Dart_Handle import_library_handler(Dart_LibraryTag tag, |
6258 Dart_Handle library, | 6278 Dart_Handle library, |
6259 Dart_Handle url) { | 6279 Dart_Handle url) { |
6260 if (tag == Dart_kCanonicalizeUrl) { | 6280 if (tag == Dart_kCanonicalizeUrl) { |
(...skipping 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9823 | 9843 |
9824 // Heartbeat test for new events. | 9844 // Heartbeat test for new events. |
9825 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer); | 9845 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer); |
9826 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer); | 9846 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer); |
9827 | 9847 |
9828 // Free buffer allocated by AppendStreamConsumer | 9848 // Free buffer allocated by AppendStreamConsumer |
9829 free(data.buffer); | 9849 free(data.buffer); |
9830 } | 9850 } |
9831 | 9851 |
9832 } // namespace dart | 9852 } // namespace dart |
OLD | NEW |