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

Unified Diff: mojo/dart/test/control_messages_test.dart

Issue 1545483003: Dart: Reorganize files (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix build file Created 5 years 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/test/compile_all_interfaces_test.dart ('k') | mojo/dart/test/core_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/test/control_messages_test.dart
diff --git a/mojo/dart/test/control_messages_test.dart b/mojo/dart/test/control_messages_test.dart
deleted file mode 100644
index 8653ce9041cad1e41dcab878f67abb1dfccf93c5..0000000000000000000000000000000000000000
--- a/mojo/dart/test/control_messages_test.dart
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:isolate';
-import 'dart:typed_data';
-
-import 'package:mojo/bindings.dart' as bindings;
-import 'package:mojo/core.dart' as core;
-import 'package:_mojo_for_test_only/expect.dart';
-import 'package:_mojo_for_test_only/sample/sample_interfaces.mojom.dart' as sample;
-
-// Bump this if sample_interfaces.mojom adds higher versions.
-const int maxVersion = 3;
-
-// Implementation of IntegerAccessor.
-class IntegerAccessorImpl implements sample.IntegerAccessor {
- // Some initial value.
- int _value = 0;
-
- dynamic getInteger([Function responseFactory = null]) =>
- responseFactory(_value, sample.Enum.value);
-
- void setInteger(int data, sample.Enum type) {
- Expect.equals(sample.Enum.value, type);
- // Update data.
- _value = data;
- }
-}
-
-// Returns [proxy, stub].
-List buildConnectedProxyAndStub() {
- var pipe = new core.MojoMessagePipe();
- var proxy = new sample.IntegerAccessorProxy.fromEndpoint(pipe.endpoints[0]);
- var impl = new IntegerAccessorImpl();
- var stub =
- new sample.IntegerAccessorStub.fromEndpoint(pipe.endpoints[1], impl);
- return [proxy, stub];
-}
-
-void closeProxyAndStub(List ps) {
- var proxy = ps[0];
- var stub = ps[1];
- proxy.close();
- stub.close();
-}
-
-testQueryVersion() async {
- var ps = buildConnectedProxyAndStub();
- var proxy = ps[0];
- // The version starts at 0.
- Expect.equals(0, proxy.version);
- // We are talking to an implementation that supports version maxVersion.
- var providedVersion = await proxy.queryVersion();
- Expect.equals(maxVersion, providedVersion);
- // The proxy's version has been updated.
- Expect.equals(providedVersion, proxy.version);
- closeProxyAndStub(ps);
-}
-
-testRequireVersionSuccess() async {
- var ps = buildConnectedProxyAndStub();
- var proxy = ps[0];
- Expect.equals(0, proxy.version);
- // Require version maxVersion.
- proxy.requireVersion(maxVersion);
- // Make a request and get a response.
- var response = await proxy.ptr.getInteger();
- Expect.equals(0, response.data);
- closeProxyAndStub(ps);
-}
-
-testRequireVersionDisconnect() async {
- var ps = buildConnectedProxyAndStub();
- var proxy = ps[0];
- Expect.equals(0, proxy.version);
- // Require version maxVersion.
- proxy.requireVersion(maxVersion);
- Expect.equals(maxVersion, proxy.version);
- // Set integer.
- proxy.ptr.setInteger(34, sample.Enum.value);
- // Get integer.
- var response = await proxy.ptr.getInteger();
- Expect.equals(34, response.data);
- // Require version maxVersion + 1
- proxy.requireVersion(maxVersion + 1);
- // Version number is updated synchronously.
- Expect.equals(maxVersion + 1, proxy.version);
- // Get integer, expect a failure.
- bool exceptionCaught = false;
- try {
- response = await proxy.ptr.getInteger();
- Expect.fail('Should have an exception.');
- } catch(e) {
- exceptionCaught = true;
- }
- Expect.isTrue(exceptionCaught);
- closeProxyAndStub(ps);
-}
-
-main() async {
- await testQueryVersion();
- await testRequireVersionSuccess();
- await testRequireVersionDisconnect();
-}
« no previous file with comments | « mojo/dart/test/compile_all_interfaces_test.dart ('k') | mojo/dart/test/core_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698