Index: mojo/dart/packages/mojo/test/standalone_test.dart |
diff --git a/mojo/dart/packages/mojo/test/standalone_test.dart b/mojo/dart/packages/mojo/test/standalone_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..62c983e48466444cab526d240e2719b8d319dc10 |
--- /dev/null |
+++ b/mojo/dart/packages/mojo/test/standalone_test.dart |
@@ -0,0 +1,27 @@ |
+// Copyright 2016 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. |
+ |
+// Test that an import of 'package:mojo' doesn't fail on the VM. |
+import 'package:mojo/core.dart'; |
+ |
+shouldThrowUnsupported(description, f) { |
+ try { |
+ f(); |
+ throw "$description did not throw as expected."; |
+ } catch (e) { |
+ if (e is! UnsupportedError) { |
+ throw "$description error is not an UnsupportedError $e."; |
+ } |
+ } |
+} |
+ |
+main() { |
+ var invalid = new MojoHandle.invalid(); |
+ shouldThrowUnsupported("getTimeTicksNow()", () => getTimeTicksNow()); |
+ shouldThrowUnsupported( |
+ "MojoMessagePipe allocation", () => new MojoMessagePipe()); |
+ shouldThrowUnsupported("MojoDataPipe allocation", () => new MojoDataPipe()); |
+ shouldThrowUnsupported( |
+ "MojoSharedBuffer allocation", () => new MojoSharedBuffer.create(1024)); |
+} |