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

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

Issue 359673002: - Remove Dart_ReceivePortGetId, Dart_GetReceivePort and Dart_PostMessage. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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') | sdk/lib/_internal/lib/io_patch.dart » ('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) 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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_debugger_api.h" 7 #include "include/dart_debugger_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 2624
2625 UNIT_TEST_CASE(PostCObject) { 2625 UNIT_TEST_CASE(PostCObject) {
2626 // Create a native port for posting from C to Dart 2626 // Create a native port for posting from C to Dart
2627 TestIsolateScope __test_isolate__; 2627 TestIsolateScope __test_isolate__;
2628 const char* kScriptChars = 2628 const char* kScriptChars =
2629 "import 'dart:isolate';\n" 2629 "import 'dart:isolate';\n"
2630 "main() {\n" 2630 "main() {\n"
2631 " var messageCount = 0;\n" 2631 " var messageCount = 0;\n"
2632 " var exception = '';\n" 2632 " var exception = '';\n"
2633 " var port = new RawReceivePort();\n" 2633 " var port = new RawReceivePort();\n"
2634 " var sendPort = port.sendPort;\n"
2634 " port.handler = (message) {\n" 2635 " port.handler = (message) {\n"
2635 " if (messageCount < 8) {\n" 2636 " if (messageCount < 8) {\n"
2636 " exception = '$exception${message}';\n" 2637 " exception = '$exception${message}';\n"
2637 " } else {\n" 2638 " } else {\n"
2638 " exception = '$exception${message.length}';\n" 2639 " exception = '$exception${message.length}';\n"
2639 " for (int i = 0; i < message.length; i++) {\n" 2640 " for (int i = 0; i < message.length; i++) {\n"
2640 " exception = '$exception${message[i]}';\n" 2641 " exception = '$exception${message[i]}';\n"
2641 " }\n" 2642 " }\n"
2642 " }\n" 2643 " }\n"
2643 " messageCount++;\n" 2644 " messageCount++;\n"
2644 " if (messageCount == 9) throw new Exception(exception);\n" 2645 " if (messageCount == 9) throw new Exception(exception);\n"
2645 " };\n" 2646 " };\n"
2646 " return port;\n" 2647 " return sendPort;\n"
2647 "}\n"; 2648 "}\n";
2648 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 2649 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2649 Dart_EnterScope(); 2650 Dart_EnterScope();
2650 2651
2651 Dart_Handle recv_port = Dart_Invoke(lib, NewString("main"), 0, NULL); 2652 Dart_Handle send_port = Dart_Invoke(lib, NewString("main"), 0, NULL);
2652 EXPECT_VALID(recv_port); 2653 EXPECT_VALID(send_port);
2653 Dart_Port port_id; 2654 Dart_Port port_id;
2654 Dart_Handle result = Dart_ReceivePortGetId(recv_port, &port_id); 2655 Dart_Handle result = Dart_SendPortGetId(send_port, &port_id);
2655 ASSERT(!Dart_IsError(result)); 2656 ASSERT(!Dart_IsError(result));
2656 2657
2657 // Setup single object message. 2658 // Setup single object message.
2658 Dart_CObject object; 2659 Dart_CObject object;
2659 2660
2660 object.type = Dart_CObject_kNull; 2661 object.type = Dart_CObject_kNull;
2661 EXPECT(Dart_PostCObject(port_id, &object)); 2662 EXPECT(Dart_PostCObject(port_id, &object));
2662 2663
2663 object.type = Dart_CObject_kBool; 2664 object.type = Dart_CObject_kBool;
2664 object.value.as_bool = true; 2665 object.value.as_bool = true;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 result = Dart_RunLoop(); 2711 result = Dart_RunLoop();
2711 EXPECT(Dart_IsError(result)); 2712 EXPECT(Dart_IsError(result));
2712 EXPECT(Dart_ErrorHasException(result)); 2713 EXPECT(Dart_ErrorHasException(result));
2713 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2714 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2714 Dart_GetError(result)); 2715 Dart_GetError(result));
2715 2716
2716 Dart_ExitScope(); 2717 Dart_ExitScope();
2717 } 2718 }
2718 2719
2719 } // namespace dart 2720 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | sdk/lib/_internal/lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698