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

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

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Reload all the test classes here. 172 // Reload all the test classes here.
173 // 173 //
174 // TODO(turnidge): Use the create isolate callback instead? 174 // TODO(turnidge): Use the create isolate callback instead?
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, NewString("mainPort"), recv_port);
183 EXPECT_VALID(result); 183 EXPECT_VALID(result);
184 184
185 result = Dart_Invoke(lib, Dart_NewString(main_), 0, NULL); 185 result = Dart_Invoke(lib, NewString(main_), 0, NULL);
186 EXPECT_VALID(result); 186 EXPECT_VALID(result);
187 free(const_cast<char*>(main_)); 187 free(const_cast<char*>(main_));
188 main_ = NULL; 188 main_ = NULL;
189 189
190 Dart_ExitScope(); 190 Dart_ExitScope();
191 Dart_ExitIsolate(); 191 Dart_ExitIsolate();
192 } 192 }
193 193
194 194
195 // 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
310 Dart_SetMessageNotifyCallback(&NotifyMessage); 310 Dart_SetMessageNotifyCallback(&NotifyMessage);
311 Dart_EnterScope(); 311 Dart_EnterScope();
312 Dart_Handle result; 312 Dart_Handle result;
313 313
314 // Create a test library. 314 // Create a test library.
315 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars, 315 Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
316 NativeLookup); 316 NativeLookup);
317 EXPECT_VALID(lib); 317 EXPECT_VALID(lib);
318 318
319 // Run main. 319 // Run main.
320 result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL); 320 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
321 EXPECT_VALID(result); 321 EXPECT_VALID(result);
322 EXPECT(Dart_IsString(result)); 322 EXPECT(Dart_IsString(result));
323 const char* result_str = NULL; 323 const char* result_str = NULL;
324 EXPECT_VALID(Dart_StringToCString(result, &result_str)); 324 EXPECT_VALID(Dart_StringToCString(result, &result_str));
325 EXPECT_STREQ("success", result_str); 325 EXPECT_STREQ("success", result_str);
326 326
327 Dart_ExitScope(); 327 Dart_ExitScope();
328 Dart_ExitIsolate(); 328 Dart_ExitIsolate();
329 329
330 OS::Print("-- Starting event loop --\n"); 330 OS::Print("-- Starting event loop --\n");
331 Event* event = event_queue->Get(); 331 Event* event = event_queue->Get();
332 while (event) { 332 while (event) {
333 event->Process(); 333 event->Process();
334 delete event; 334 delete event;
335 event = event_queue->Get(); 335 event = event_queue->Get();
336 } 336 }
337 OS::Print("-- Finished event loop --\n"); 337 OS::Print("-- Finished event loop --\n");
338 EXPECT_STREQ("Received: 43", saved_echo); 338 EXPECT_STREQ("Received: 43", saved_echo);
339 free(const_cast<char*>(saved_echo)); 339 free(const_cast<char*>(saved_echo));
340 340
341 delete event_queue; 341 delete event_queue;
342 } 342 }
343 343
344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
345 345
346 } // namespace dart 346 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698