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

Side by Side Diff: mojo/dart/test/core_test.dart

Issue 851173002: Dart: Encode/Decode handle and interface types. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix Interface encode parameters Created 5 years, 11 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
« no previous file with comments | « mojo/dart/embedder/test/run_dart_tests.cc ('k') | mojo/dart/test/sample_service_test.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:mojo_core'; 5 import 'dart:mojo_core';
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 7
8 import 'package:mojo/dart/testing/expect.dart'; 8 import 'package:mojo/dart/testing/expect.dart';
9 9
10 invalidHandleTest() { 10 invalidHandleTest() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 int read = dataPipe.consumer.read(bd); 53 int read = dataPipe.consumer.read(bd);
54 Expect.isTrue(dataPipe.consumer.status.isInvalidArgument); 54 Expect.isTrue(dataPipe.consumer.status.isInvalidArgument);
55 55
56 ByteData readData = dataPipe.consumer.beginRead(10); 56 ByteData readData = dataPipe.consumer.beginRead(10);
57 Expect.isNull(readData); 57 Expect.isNull(readData);
58 Expect.isTrue(dataPipe.consumer.status.isInvalidArgument); 58 Expect.isTrue(dataPipe.consumer.status.isInvalidArgument);
59 dataPipe.consumer.endRead(10); 59 dataPipe.consumer.endRead(10);
60 Expect.isTrue(dataPipe.consumer.status.isInvalidArgument); 60 Expect.isTrue(dataPipe.consumer.status.isInvalidArgument);
61 61
62 // Shared buffer. 62 // Shared buffer.
63 MojoSharedBuffer sharedBuffer = new MojoSharedBuffer(10); 63 MojoSharedBuffer sharedBuffer = new MojoSharedBuffer.create(10);
64 Expect.isNotNull(sharedBuffer); 64 Expect.isNotNull(sharedBuffer);
65 sharedBuffer.close(); 65 sharedBuffer.close();
66 MojoSharedBuffer duplicate = new MojoSharedBuffer.duplicate(sharedBuffer); 66 MojoSharedBuffer duplicate = new MojoSharedBuffer.duplicate(sharedBuffer);
67 Expect.isNull(duplicate); 67 Expect.isNull(duplicate);
68 68
69 sharedBuffer = new MojoSharedBuffer(10); 69 sharedBuffer = new MojoSharedBuffer.create(10);
70 Expect.isNotNull(sharedBuffer); 70 Expect.isNotNull(sharedBuffer);
71 sharedBuffer.close(); 71 sharedBuffer.close();
72 result = sharedBuffer.map(0, 10); 72 result = sharedBuffer.map(0, 10);
73 Expect.isTrue(result.isInvalidArgument); 73 Expect.isTrue(result.isInvalidArgument);
74 } 74 }
75 75
76 76
77 basicMessagePipeTest() { 77 basicMessagePipeTest() {
78 MojoMessagePipe pipe = new MojoMessagePipe(); 78 MojoMessagePipe pipe = new MojoMessagePipe();
79 Expect.isNotNull(pipe); 79 Expect.isNotNull(pipe);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 String helloWorld = new String.fromCharCodes( 232 String helloWorld = new String.fromCharCodes(
233 uint8_list.toList()); 233 uint8_list.toList());
234 Expect.equals("hello world", helloWorld); 234 Expect.equals("hello world", helloWorld);
235 235
236 result = consumer.handle.close(); 236 result = consumer.handle.close();
237 Expect.isTrue(result.isOk); 237 Expect.isTrue(result.isOk);
238 } 238 }
239 239
240 240
241 basicSharedBufferTest() { 241 basicSharedBufferTest() {
242 MojoSharedBuffer mojoBuffer = new MojoSharedBuffer( 242 MojoSharedBuffer mojoBuffer = new MojoSharedBuffer.create(
243 100, MojoSharedBuffer.CREATE_FLAG_NONE); 243 100, MojoSharedBuffer.CREATE_FLAG_NONE);
244 Expect.isNotNull(mojoBuffer); 244 Expect.isNotNull(mojoBuffer);
245 Expect.isNotNull(mojoBuffer.status); 245 Expect.isNotNull(mojoBuffer.status);
246 Expect.isTrue(mojoBuffer.status.isOk); 246 Expect.isTrue(mojoBuffer.status.isOk);
247 Expect.isNotNull(mojoBuffer.handle); 247 Expect.isNotNull(mojoBuffer.handle);
248 Expect.isTrue(mojoBuffer.handle is MojoHandle); 248 Expect.isTrue(mojoBuffer.handle is MojoHandle);
249 Expect.isTrue(mojoBuffer.handle.isValid); 249 Expect.isTrue(mojoBuffer.handle.isValid);
250 250
251 mojoBuffer.map(0, 100, MojoSharedBuffer.MAP_FLAG_NONE); 251 mojoBuffer.map(0, 100, MojoSharedBuffer.MAP_FLAG_NONE);
252 Expect.isNotNull(mojoBuffer.status); 252 Expect.isNotNull(mojoBuffer.status);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 duplicate = null; 297 duplicate = null;
298 } 298 }
299 299
300 300
301 main() { 301 main() {
302 invalidHandleTest(); 302 invalidHandleTest();
303 basicMessagePipeTest(); 303 basicMessagePipeTest();
304 basicDataPipeTest(); 304 basicDataPipeTest();
305 basicSharedBufferTest(); 305 basicSharedBufferTest();
306 } 306 }
OLDNEW
« no previous file with comments | « mojo/dart/embedder/test/run_dart_tests.cc ('k') | mojo/dart/test/sample_service_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698