Chromium Code Reviews| Index: sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_invalid_assets_test.dart |
| diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_invalid_assets_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_invalid_assets_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c17fe21bdebccb5874c447a4bb3ddfda3ba86ed0 |
| --- /dev/null |
| +++ b/sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_invalid_assets_test.dart |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.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. |
| + |
| +library pub_tests; |
| + |
| +import 'package:scheduled_test/scheduled_test.dart'; |
| +import '../../descriptor.dart' as d; |
| +import '../../test_pub.dart'; |
| +import '../utils.dart'; |
| + |
| +main() { |
| + initConfig(); |
| + integration("converts uris to matching asset ids", () { |
|
nweiz
2013/10/09 19:16:37
Change this to match the filename.
Bob Nystrom
2013/10/11 20:50:10
Done.
|
| + d.dir("foo", [ |
| + d.libPubspec("foo", "0.0.1"), |
| + d.dir("asset", [ |
| + d.file("foo.txt", "foo"), |
| + d.dir("sub", [ |
| + d.file("bar.txt", "bar"), |
| + ]) |
| + ]), |
| + d.dir("lib", [ |
| + d.file("foo.dart", "foo") |
| + ]) |
| + ]).create(); |
| + |
| + d.dir(appPath, [ |
| + d.appPubspec({ |
| + "foo": {"path": "../foo"} |
| + }), |
| + d.dir("lib", [ |
| + d.file("myapp.dart", "myapp"), |
| + ]), |
| + d.dir("web", [ |
| + d.file("index.html", "<body>"), |
| + d.dir("sub", [ |
| + d.file("bar.html", "bar"), |
| + ]) |
| + ]) |
| + ]).create(); |
| + |
| + startPubServe(shouldGetFirst: true); |
| + |
| + webSocketShouldReply({ |
| + "command": "assetToUri", |
| + "package": "myapp", "path": "top.txt" |
| + }, equals({"error": "Can not serve asset from top-level directory."})); |
| + |
| + webSocketShouldReply({ |
| + "command": "assetToUri", |
| + "package": "foo", "path": "web/foo.dart" |
| + }, equals({"error": 'Can only access "web" directory of root package.'})); |
| + |
| + webSocketShouldReply({ |
| + "command": "assetToUri", |
| + "package": "myapp", "path": "blah/index.html" |
| + }, equals({"error": 'Cannot serve assets from "blah".'})); |
| + |
| + endPubServe(); |
| + }); |
| +} |