OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library pub_tests; | 5 library pub_tests; |
6 | 6 |
7 import 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
8 | 8 |
9 import '../../descriptor.dart' as d; | 9 import '../../descriptor.dart' as d; |
10 import '../../test_pub.dart'; | 10 import '../../test_pub.dart'; |
11 import '../utils.dart'; | 11 import '../utils.dart'; |
12 | 12 |
13 main() { | 13 main() { |
14 integration("binds a directory to a new port", () { | 14 integration("binds a directory to a new port", () { |
15 d.dir(appPath, [ | 15 d.dir(appPath, [ |
16 d.appPubspec(), | 16 d.appPubspec(), |
17 d.dir("test", [ | 17 d.dir("test", [ |
18 d.file("index.html", "<test body>") | 18 d.file("index.html", "<test body>") |
19 ]), | 19 ]), |
20 d.dir("web", [ | 20 d.dir("web", [ |
21 d.file("index.html", "<body>") | 21 d.file("index.html", "<body>") |
22 ]) | 22 ]) |
23 ]).create(); | 23 ]).create(); |
24 | 24 |
25 pubServe(args: ["web"], shouldGetFirst: true); | 25 pubGet(); |
| 26 pubServe(args: ["web"]); |
26 | 27 |
27 // Bind the new directory. | 28 // Bind the new directory. |
28 schedule(() async { | 29 schedule(() async { |
29 var response = await expectWebSocketResult( | 30 var response = await expectWebSocketResult( |
30 "serveDirectory", {"path": "test"}, | 31 "serveDirectory", {"path": "test"}, |
31 {"url": matches(r"http://localhost:\d+")}); | 32 {"url": matches(r"http://localhost:\d+")}); |
32 | 33 |
33 var url = Uri.parse(response["url"]); | 34 var url = Uri.parse(response["url"]); |
34 registerServerPort("test", url.port); | 35 registerServerPort("test", url.port); |
35 }); | 36 }); |
36 | 37 |
37 // It should be served now. | 38 // It should be served now. |
38 requestShouldSucceed("index.html", "<test body>", root: "test"); | 39 requestShouldSucceed("index.html", "<test body>", root: "test"); |
39 | 40 |
40 // And watched. | 41 // And watched. |
41 d.dir(appPath, [ | 42 d.dir(appPath, [ |
42 d.dir("test", [ | 43 d.dir("test", [ |
43 d.file("index.html", "after") | 44 d.file("index.html", "after") |
44 ]) | 45 ]) |
45 ]).create(); | 46 ]).create(); |
46 | 47 |
47 waitForBuildSuccess(); | 48 waitForBuildSuccess(); |
48 requestShouldSucceed("index.html", "after", root: "test"); | 49 requestShouldSucceed("index.html", "after", root: "test"); |
49 | 50 |
50 endPubServe(); | 51 endPubServe(); |
51 }); | 52 }); |
52 } | 53 } |
OLD | NEW |