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

Unified Diff: mojo/dart/unittests/embedder_tests/core_test.dart

Issue 1694413003: Cleanups in the Mojo package. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments. Created 4 years, 10 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
« no previous file with comments | « mojo/dart/packages/mojo/sdk_ext_sources.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/unittests/embedder_tests/core_test.dart
diff --git a/mojo/dart/unittests/embedder_tests/core_test.dart b/mojo/dart/unittests/embedder_tests/core_test.dart
index e644235d46a3cd0916f991e0f837c80d65f83006..08f3c00c01ef0a6b9de49f11712d4bba645bf535 100644
--- a/mojo/dart/unittests/embedder_tests/core_test.dart
+++ b/mojo/dart/unittests/embedder_tests/core_test.dart
@@ -11,7 +11,7 @@ import 'package:_mojo_for_test_only/expect.dart';
import 'package:mojo/core.dart';
invalidHandleTest() {
- MojoHandle invalidHandle = new MojoHandle(MojoHandle.INVALID);
+ MojoHandle invalidHandle = new MojoHandle(MojoHandle.invalidHandle);
// Close.
int result = invalidHandle.close();
@@ -23,7 +23,7 @@ invalidHandleTest() {
Expect.isTrue(mwr.result == MojoResult.kInvalidArgument);
MojoWaitManyResult mwmr = MojoHandle.waitMany([invalidHandle.h],
- [MojoHandleSignals.kReadWrite], MojoHandle.DEADLINE_INDEFINITE);
+ [MojoHandleSignals.kReadWrite], MojoHandle.deadlineIndefinite);
Expect.isTrue(mwmr.result == MojoResult.kInvalidArgument);
// Message pipe.
@@ -47,7 +47,7 @@ invalidHandleTest() {
int bytesWritten = dataPipe.producer.write(bd);
Expect.isTrue(dataPipe.producer.status == MojoResult.kInvalidArgument);
- ByteData writeData = dataPipe.producer.beginWrite(10);
+ ByteData writeData = dataPipe.producer.beginWrite();
Expect.isNull(writeData);
Expect.isTrue(dataPipe.producer.status == MojoResult.kInvalidArgument);
dataPipe.producer.endWrite(10);
@@ -56,7 +56,7 @@ invalidHandleTest() {
int read = dataPipe.consumer.read(bd);
Expect.isTrue(dataPipe.consumer.status == MojoResult.kInvalidArgument);
- ByteData readData = dataPipe.consumer.beginRead(10);
+ ByteData readData = dataPipe.consumer.beginRead();
Expect.isNull(readData);
Expect.isTrue(dataPipe.consumer.status == MojoResult.kInvalidArgument);
dataPipe.consumer.endRead(10);
@@ -110,7 +110,7 @@ basicMessagePipeTest() {
// end0 should now be readable.
MojoWaitManyResult mwmr = MojoHandle.waitMany([end0.handle.h],
- [MojoHandleSignals.kReadable], MojoHandle.DEADLINE_INDEFINITE);
+ [MojoHandleSignals.kReadable], MojoHandle.deadlineIndefinite);
Expect.isTrue(mwmr.result == MojoResult.kOk);
// Read from end0.
@@ -162,11 +162,11 @@ basicDataPipeTest() {
// Try to read from consumer.
ByteData buffer = new ByteData(20);
- consumer.read(buffer, buffer.lengthInBytes, MojoDataPipeConsumer.FLAG_NONE);
+ consumer.read(buffer, buffer.lengthInBytes, MojoDataPipeConsumer.flagNone);
Expect.isTrue(consumer.status == MojoResult.kShouldWait);
// Try to begin a two-phase read from consumer.
- ByteData b = consumer.beginRead(20, MojoDataPipeConsumer.FLAG_NONE);
+ ByteData b = consumer.beginRead(MojoDataPipeConsumer.flagNone);
Expect.isNull(b);
Expect.isTrue(consumer.status == MojoResult.kShouldWait);
@@ -175,18 +175,17 @@ basicDataPipeTest() {
ByteData helloData =
new ByteData.view((new Uint8List.fromList(hello.codeUnits)).buffer);
int written = producer.write(
- helloData, helloData.lengthInBytes, MojoDataPipeProducer.FLAG_NONE);
+ helloData, helloData.lengthInBytes, MojoDataPipeProducer.flagNone);
Expect.isTrue(producer.status == MojoResult.kOk);
Expect.equals(written, helloData.lengthInBytes);
// Now that we have written, the consumer should be readable.
MojoWaitManyResult mwmr = MojoHandle.waitMany([consumer.handle.h],
- [MojoHandleSignals.kReadable], MojoHandle.DEADLINE_INDEFINITE);
+ [MojoHandleSignals.kReadable], MojoHandle.deadlineIndefinite);
Expect.isTrue(mwr.result == MojoResult.kOk);
// Do a two-phase write to the producer.
- ByteData twoPhaseWrite =
- producer.beginWrite(20, MojoDataPipeProducer.FLAG_NONE);
+ ByteData twoPhaseWrite = producer.beginWrite(MojoDataPipeProducer.flagNone);
Expect.isTrue(producer.status == MojoResult.kOk);
Expect.isNotNull(twoPhaseWrite);
Expect.isTrue(twoPhaseWrite.lengthInBytes >= 20);
@@ -197,7 +196,7 @@ basicDataPipeTest() {
Expect.isTrue(producer.status == MojoResult.kOk);
// Read one character from consumer.
- int read = consumer.read(buffer, 1, MojoDataPipeConsumer.FLAG_NONE);
+ int read = consumer.read(buffer, 1, MojoDataPipeConsumer.flagNone);
Expect.isTrue(consumer.status == MojoResult.kOk);
Expect.equals(read, 1);
@@ -210,13 +209,12 @@ basicDataPipeTest() {
Expect.isTrue(mwr.result == MojoResult.kOk);
// Get the number of remaining bytes.
- int remaining = consumer.read(null, 0, MojoDataPipeConsumer.FLAG_QUERY);
+ int remaining = consumer.read(null, 0, MojoDataPipeConsumer.flagQuery);
Expect.isTrue(consumer.status == MojoResult.kOk);
Expect.equals(remaining, "hello world".length - 1);
// Do a two-phase read.
- ByteData twoPhaseRead =
- consumer.beginRead(remaining, MojoDataPipeConsumer.FLAG_NONE);
+ ByteData twoPhaseRead = consumer.beginRead(MojoDataPipeConsumer.flagNone);
Expect.isTrue(consumer.status == MojoResult.kOk);
Expect.isNotNull(twoPhaseRead);
Expect.isTrue(twoPhaseRead.lengthInBytes <= remaining);
« no previous file with comments | « mojo/dart/packages/mojo/sdk_ext_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698