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

Unified Diff: tests/isolate/typed_data_message_test.dart

Issue 23368003: Cleanup of isolate.status (first step) (Closed) Base URL: https://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 side-by-side diff with in-line comments
Download patch
Index: tests/isolate/typed_data_message_test.dart
diff --git a/tests/isolate/typed_data_message_test.dart b/tests/isolate/typed_data_message_test.dart
deleted file mode 100644
index b725b1c9a6c80360f96fea43bb6c78106ba31548..0000000000000000000000000000000000000000
--- a/tests/isolate/typed_data_message_test.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Dart test program for testing serialization of messages.
-// VMOptions=--enable_type_checks --enable_asserts
-
-library TypedDataMessageTest;
-import 'dart:isolate';
-import 'dart:typed_data';
-import '../../pkg/unittest/lib/unittest.dart';
-
-// ---------------------------------------------------------------------------
-// Message passing test.
-// ---------------------------------------------------------------------------
-
-List elements;
-
-void initializeList() {
- elements = new List(3);
- elements[0] = new Int8List(10);
- for (int j = 0; j < 10; j++) {
- elements[0][j] = j;
- }
- elements[1] = new ByteData.view(elements[0].buffer, 0, 10);
- for (int j = 0; j < 10; j++) {
- elements[1].setInt8(j, j + 100);
- }
- elements[2] = new Int8List.view(new Int8List(100).buffer, 50, 10);
- for (int j = 0; j < 10; j++) {
- elements[2][j] = j + 250;
- }
-}
-
-void VerifyList(List expected, List actual) {
- for (int i = 0; i < expected.length; i++) {
- expect(actual[i], expected[i]);
- }
-}
-
-void VerifyBytedata(ByteData expected, ByteData actual) {
- for (int i = 0; i < expected.length; i++) {
- expect(actual.getInt8(i), expected.getInt8(i));
- }
-}
-
-void VerifyObject(int index, var actual) {
- var expected = elements[index];
- if (expected is List) {
- expect(actual, isList);
- VerifyList(expected, actual);
- } else {
- expect(true, actual is ByteData);
- VerifyBytedata(expected, actual);
- }
- expect(actual.length, expected.length);
-}
-
-pingPong() {
- initializeList();
- int count = 0;
- port.receive((var message, SendPort replyTo) {
- if (message == -1) {
- port.close();
- replyTo.send(count, null);
- } else {
- // Check if the received object is correct.
- if (count < elements.length) {
- VerifyObject(count, message);
- }
- // Bounce the received object back so that the sender
- // can make sure that the object matches.
- replyTo.send(message, null);
- count++;
- }
- });
-}
-
-main() {
- initializeList();
- test("send objects and receive them back", () {
- SendPort remote = spawnFunction(pingPong);
- // Send objects and receive them back.
- for (int i = 0; i < elements.length; i++) {
- var sentObject = elements[i];
- var idx = i;
- remote.call(sentObject).then(expectAsync1((var receivedObject) {
- VerifyObject(idx, receivedObject);
- }));
- }
-
- // Shutdown the MessageServer.
- remote.call(-1).then(expectAsync1((int message) {
- expect(message, elements.length);
- }));
- });
-}

Powered by Google App Engine
This is Rietveld 408576698