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

Unified Diff: mojo/public/dart/third_party/test/test/backend/metadata_test.dart

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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: mojo/public/dart/third_party/test/test/backend/metadata_test.dart
diff --git a/mojo/public/dart/third_party/test/test/backend/metadata_test.dart b/mojo/public/dart/third_party/test/test/backend/metadata_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ab14a74bde550a52a9b895f5b73e4085b75c0a37
--- /dev/null
+++ b/mojo/public/dart/third_party/test/test/backend/metadata_test.dart
@@ -0,0 +1,65 @@
+// Copyright (c) 2015, 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.
+
+import 'package:test/src/backend/metadata.dart';
+import 'package:test/src/backend/test_platform.dart';
+import 'package:test/src/frontend/timeout.dart';
+import 'package:test/src/frontend/skip.dart';
+import 'package:test/test.dart';
+
+void main() {
+ group("onPlatform", () {
+ test("parses a valid map", () {
+ var metadata = new Metadata.parse(onPlatform: {
+ "chrome": new Timeout.factor(2),
+ "vm": [new Skip(), new Timeout.factor(3)]
+ });
+
+ var key = metadata.onPlatform.keys.first;
+ expect(key.evaluate(TestPlatform.chrome), isTrue);
+ expect(key.evaluate(TestPlatform.vm), isFalse);
+ var value = metadata.onPlatform.values.first;
+ expect(value.timeout.scaleFactor, equals(2));
+
+ key = metadata.onPlatform.keys.last;
+ expect(key.evaluate(TestPlatform.vm), isTrue);
+ expect(key.evaluate(TestPlatform.chrome), isFalse);
+ value = metadata.onPlatform.values.last;
+ expect(value.skip, isTrue);
+ expect(value.timeout.scaleFactor, equals(3));
+ });
+
+ test("refuses an invalid value", () {
+ expect(() {
+ new Metadata.parse(onPlatform: {"chrome": new TestOn("chrome")});
+ }, throwsArgumentError);
+ });
+
+ test("refuses an invalid value in a list", () {
+ expect(() {
+ new Metadata.parse(onPlatform: {"chrome": [new TestOn("chrome")]});
+ }, throwsArgumentError);
+ });
+
+ test("refuses an invalid platform selector", () {
+ expect(() {
+ new Metadata.parse(onPlatform: {"invalid": new Skip()});
+ }, throwsFormatException);
+ });
+
+ test("refuses multiple Timeouts", () {
+ expect(() {
+ new Metadata.parse(onPlatform: {
+ "chrome": [new Timeout.factor(2), new Timeout.factor(3)]
+ });
+ }, throwsArgumentError);
+ });
+
+ test("refuses multiple Skips", () {
+ expect(() {
+ new Metadata.parse(onPlatform: {"chrome": [new Skip(), new Skip()]});
+ }, throwsArgumentError);
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698