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

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

Issue 8588040: Add a mid-sized integration test for the Dart Embedding Api which (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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/assert.h" 7 #include "vm/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_api_state.h" 9 #include "vm/dart_api_state.h"
10 #include "vm/port.h"
10 #include "vm/unit_test.h" 11 #include "vm/unit_test.h"
11 #include "vm/utils.h" 12 #include "vm/utils.h"
12 #include "vm/verifier.h" 13 #include "vm/verifier.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 17
17 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. 18 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests.
18 19
19 UNIT_TEST_CASE(ErrorHandles) { 20 UNIT_TEST_CASE(ErrorHandles) {
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 Dart_EnterIsolate(iso_2); 782 Dart_EnterIsolate(iso_2);
782 EXPECT_EQ(iso_2, Isolate::Current()); 783 EXPECT_EQ(iso_2, Isolate::Current());
783 Dart_ShutdownIsolate(); 784 Dart_ShutdownIsolate();
784 EXPECT(NULL == Isolate::Current()); 785 EXPECT(NULL == Isolate::Current());
785 Dart_EnterIsolate(iso_1); 786 Dart_EnterIsolate(iso_1);
786 EXPECT_EQ(iso_1, Isolate::Current()); 787 EXPECT_EQ(iso_1, Isolate::Current());
787 Dart_ShutdownIsolate(); 788 Dart_ShutdownIsolate();
788 EXPECT(NULL == Isolate::Current()); 789 EXPECT(NULL == Isolate::Current());
789 } 790 }
790 791
792 static void MyCreatePortCallback(Dart_Isolate dest_isolate,
793 Dart_Port port) {
794 }
791 795
792 static bool MyPostMessageCallback(Dart_Isolate dest_isolate, 796 static bool MyPostMessageCallback(Dart_Isolate dest_isolate,
793 Dart_Port send_port, 797 Dart_Port send_port,
794 Dart_Port reply_port, 798 Dart_Port reply_port,
795 Dart_Message message) { 799 Dart_Message message) {
796 return true; 800 return true;
797 } 801 }
798 802
799 803
800 static void MyClosePortCallback(Dart_Isolate dest_isolate, 804 static void MyClosePortCallback(Dart_Isolate dest_isolate,
801 Dart_Port port) { 805 Dart_Port port) {
802 } 806 }
803 807
804 808
805 UNIT_TEST_CASE(SetMessageCallbacks) { 809 UNIT_TEST_CASE(SetMessageCallbacks) {
806 Dart_Isolate dart_isolate = Dart_CreateIsolate(NULL, NULL); 810 Dart_Isolate dart_isolate = Dart_CreateIsolate(NULL, NULL);
807 Dart_SetMessageCallbacks(&MyPostMessageCallback, &MyClosePortCallback); 811 Dart_SetMessageCallbacks(
812 &MyCreatePortCallback, &MyPostMessageCallback, &MyClosePortCallback);
808 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); 813 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
814 EXPECT_EQ(&MyCreatePortCallback, isolate->create_port_callback());
809 EXPECT_EQ(&MyPostMessageCallback, isolate->post_message_callback()); 815 EXPECT_EQ(&MyPostMessageCallback, isolate->post_message_callback());
810 EXPECT_EQ(&MyClosePortCallback, isolate->close_port_callback()); 816 EXPECT_EQ(&MyClosePortCallback, isolate->close_port_callback());
811 Dart_ShutdownIsolate(); 817 Dart_ShutdownIsolate();
812 } 818 }
813 819
814 820
815 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. 821 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests.
816 822
817 UNIT_TEST_CASE(FieldAccess) { 823 UNIT_TEST_CASE(FieldAccess) {
818 const char* kScriptChars = 824 const char* kScriptChars =
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 Dart_NewString(""), 2122 Dart_NewString(""),
2117 Dart_NewString("main"), 2123 Dart_NewString("main"),
2118 0, 2124 0,
2119 NULL); 2125 NULL);
2120 EXPECT_VALID(result); 2126 EXPECT_VALID(result);
2121 2127
2122 Dart_ExitScope(); // Exit the Dart API scope. 2128 Dart_ExitScope(); // Exit the Dart API scope.
2123 } 2129 }
2124 Dart_ShutdownIsolate(); 2130 Dart_ShutdownIsolate();
2125 } 2131 }
2132
2126 #endif // TARGET_ARCH_IA32. 2133 #endif // TARGET_ARCH_IA32.
2127 2134
2135
2128 } // namespace dart 2136 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698