| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 "vm/coverage.h" | 5 #include "vm/coverage.h" |
| 6 #include "vm/dart_api_impl.h" | 6 #include "vm/dart_api_impl.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| 11 #ifndef PRODUCT |
| 12 |
| 11 static RawObject* ExecuteScript(const char* script) { | 13 static RawObject* ExecuteScript(const char* script) { |
| 12 TransitionVMToNative transition(Thread::Current()); | 14 TransitionVMToNative transition(Thread::Current()); |
| 13 Dart_Handle h_lib = TestCase::LoadTestScript(script, NULL); | 15 Dart_Handle h_lib = TestCase::LoadTestScript(script, NULL); |
| 14 EXPECT_VALID(h_lib); | 16 EXPECT_VALID(h_lib); |
| 15 Library& lib = Library::Handle(); | 17 Library& lib = Library::Handle(); |
| 16 lib ^= Api::UnwrapHandle(h_lib); | 18 lib ^= Api::UnwrapHandle(h_lib); |
| 17 EXPECT(!lib.IsNull()); | 19 EXPECT(!lib.IsNull()); |
| 18 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); | 20 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
| 19 EXPECT_VALID(result); | 21 EXPECT_VALID(result); |
| 20 return Api::UnwrapHandle(h_lib); | 22 return Api::UnwrapHandle(h_lib); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Only expect coverage data for Foo.yetAnother() on line 6. | 132 // Only expect coverage data for Foo.yetAnother() on line 6. |
| 131 char buf[1024]; | 133 char buf[1024]; |
| 132 OS::SNPrint(buf, sizeof(buf), | 134 OS::SNPrint(buf, sizeof(buf), |
| 133 "{\"source\":\"test-lib\",\"script\":{\"type\":\"@Script\"," | 135 "{\"source\":\"test-lib\",\"script\":{\"type\":\"@Script\"," |
| 134 "\"fixedId\":true,\"id\":\"libraries\\/%" Pd "\\/scripts\\/test-lib\"," | 136 "\"fixedId\":true,\"id\":\"libraries\\/%" Pd "\\/scripts\\/test-lib\"," |
| 135 "\"uri\":\"test-lib\"," | 137 "\"uri\":\"test-lib\"," |
| 136 "\"_kind\":\"script\"},\"hits\":[6,0]}", lib.index()); | 138 "\"_kind\":\"script\"},\"hits\":[6,0]}", lib.index()); |
| 137 EXPECT_SUBSTRING(buf, js.ToCString()); | 139 EXPECT_SUBSTRING(buf, js.ToCString()); |
| 138 } | 140 } |
| 139 | 141 |
| 142 #endif // !PRODUCT |
| 143 |
| 140 } // namespace dart | 144 } // namespace dart |
| OLD | NEW |