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

Side by Side Diff: vm/custom_isolate_test.cc

Issue 10021072: Remove the deprecated method invocation and field access apis from the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | « include/dart_api.h ('k') | vm/dart_api_impl.cc » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 // Custom Isolate Test. 9 // Custom Isolate Test.
10 // 10 //
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars, 175 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
176 NativeLookup); 176 NativeLookup);
177 EXPECT_VALID(lib); 177 EXPECT_VALID(lib);
178 EXPECT_VALID(Dart_CompileAll()); 178 EXPECT_VALID(Dart_CompileAll());
179 179
180 Dart_Handle recv_port = Dart_GetReceivePort(Dart_GetMainPortId()); 180 Dart_Handle recv_port = Dart_GetReceivePort(Dart_GetMainPortId());
181 EXPECT_VALID(recv_port); 181 EXPECT_VALID(recv_port);
182 result = Dart_SetField(lib, Dart_NewString("mainPort"), recv_port); 182 result = Dart_SetField(lib, Dart_NewString("mainPort"), recv_port);
183 EXPECT_VALID(result); 183 EXPECT_VALID(result);
184 184
185 result = Dart_InvokeStatic(lib, 185 result = Dart_Invoke(lib, Dart_NewString(main_), 0, NULL);
186 Dart_NewString(""),
187 Dart_NewString(main_),
188 0,
189 NULL);
190 EXPECT_VALID(result); 186 EXPECT_VALID(result);
191 free(const_cast<char*>(main_)); 187 free(const_cast<char*>(main_));
192 main_ = NULL; 188 main_ = NULL;
193 189
194 Dart_ExitScope(); 190 Dart_ExitScope();
195 Dart_ExitIsolate(); 191 Dart_ExitIsolate();
196 } 192 }
197 193
198 194
199 // Notify an isolate of a pending message. 195 // Notify an isolate of a pending message.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 Dart_SetMessageNotifyCallback(&NotifyMessage); 310 Dart_SetMessageNotifyCallback(&NotifyMessage);
315 Dart_EnterScope(); 311 Dart_EnterScope();
316 Dart_Handle result; 312 Dart_Handle result;
317 313
318 // Create a test library. 314 // Create a test library.
319 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars, 315 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
320 NativeLookup); 316 NativeLookup);
321 EXPECT_VALID(lib); 317 EXPECT_VALID(lib);
322 318
323 // Run main. 319 // Run main.
324 result = Dart_InvokeStatic(lib, 320 result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL);
325 Dart_NewString(""),
326 Dart_NewString("main"),
327 0,
328 NULL);
329 EXPECT_VALID(result); 321 EXPECT_VALID(result);
330 EXPECT(Dart_IsString(result)); 322 EXPECT(Dart_IsString(result));
331 const char* result_str = NULL; 323 const char* result_str = NULL;
332 EXPECT_VALID(Dart_StringToCString(result, &result_str)); 324 EXPECT_VALID(Dart_StringToCString(result, &result_str));
333 EXPECT_STREQ("success", result_str); 325 EXPECT_STREQ("success", result_str);
334 326
335 Dart_ExitScope(); 327 Dart_ExitScope();
336 Dart_ExitIsolate(); 328 Dart_ExitIsolate();
337 329
338 OS::Print("-- Starting event loop --\n"); 330 OS::Print("-- Starting event loop --\n");
339 Event* event = event_queue->Get(); 331 Event* event = event_queue->Get();
340 while (event) { 332 while (event) {
341 event->Process(); 333 event->Process();
342 delete event; 334 delete event;
343 event = event_queue->Get(); 335 event = event_queue->Get();
344 } 336 }
345 OS::Print("-- Finished event loop --\n"); 337 OS::Print("-- Finished event loop --\n");
346 EXPECT_STREQ("Received: 43", saved_echo); 338 EXPECT_STREQ("Received: 43", saved_echo);
347 free(const_cast<char*>(saved_echo)); 339 free(const_cast<char*>(saved_echo));
348 340
349 delete event_queue; 341 delete event_queue;
350 } 342 }
351 343
352 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
353 345
354 } // namespace dart 346 } // namespace dart
OLDNEW
« no previous file with comments | « include/dart_api.h ('k') | vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698