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

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

Issue 23300004: Added Dart API methods: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | 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 "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 "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/json.h" 10 #include "platform/json.h"
(...skipping 6189 matching lines...) Expand 10 before | Expand all | Expand 10 after
6200 EXPECT_VALID(arg); 6200 EXPECT_VALID(arg);
6201 Dart_SetReturnValue(args, Dart_NewInteger(1)); 6201 Dart_SetReturnValue(args, Dart_NewInteger(1));
6202 Dart_ExitScope(); 6202 Dart_ExitScope();
6203 } 6203 }
6204 6204
6205 6205
6206 static void NativeFoo2(Dart_NativeArguments args) { 6206 static void NativeFoo2(Dart_NativeArguments args) {
6207 Dart_EnterScope(); 6207 Dart_EnterScope();
6208 intptr_t i = Dart_GetNativeArgumentCount(args); 6208 intptr_t i = Dart_GetNativeArgumentCount(args);
6209 EXPECT_EQ(2, i); 6209 EXPECT_EQ(2, i);
6210 Dart_Handle arg = Dart_GetNativeArgument(args, 1); 6210 Dart_Handle arg1 = Dart_GetNativeArgument(args, 1);
6211 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg))); 6211 EXPECT_VALID(arg1);
6212 int64_t value = 0;
6213 EXPECT_VALID(Dart_IntegerToInt64(arg1, &value));
6214 int64_t integer_value = 0;
6215 Dart_Handle result = Dart_GetNativeIntegerArgument(args,
6216 1,
6217 &integer_value);
6218 EXPECT_VALID(result);
6219 EXPECT_EQ(value, integer_value);
6220 double double_value;
6221 result = Dart_GetNativeDoubleArgument(args, 1, &double_value);
6222 EXPECT_VALID(result);
6223 bool bool_value;
6224 result = Dart_GetNativeBooleanArgument(args, 1, &bool_value);
6225 EXPECT(Dart_IsError(result));
6226 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg1)));
6212 Dart_ExitScope(); 6227 Dart_ExitScope();
6213 } 6228 }
6214 6229
6215 6230
6216 static void NativeFoo3(Dart_NativeArguments args) { 6231 static void NativeFoo3(Dart_NativeArguments args) {
6217 Dart_EnterScope(); 6232 Dart_EnterScope();
6218 intptr_t i = Dart_GetNativeArgumentCount(args); 6233 intptr_t i = Dart_GetNativeArgumentCount(args);
6219 EXPECT_EQ(3, i); 6234 EXPECT_EQ(3, i);
6220 Dart_Handle arg1 = Dart_GetNativeArgument(args, 1); 6235 Dart_Handle arg1 = Dart_GetNativeArgument(args, 1);
6221 Dart_Handle arg2 = Dart_GetNativeArgument(args, 2); 6236 Dart_Handle arg2 = Dart_GetNativeArgument(args, 2);
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
7294 NewString("main"), 7309 NewString("main"),
7295 0, 7310 0,
7296 NULL); 7311 NULL);
7297 int64_t value = 0; 7312 int64_t value = 0;
7298 result = Dart_IntegerToInt64(result, &value); 7313 result = Dart_IntegerToInt64(result, &value);
7299 EXPECT_VALID(result); 7314 EXPECT_VALID(result);
7300 EXPECT_EQ(8, value); 7315 EXPECT_EQ(8, value);
7301 } 7316 }
7302 7317
7303 } // namespace dart 7318 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698