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

Unified Diff: sdk/lib/_internal/pub/test/serve/missing_file_test.dart

Issue 22878002: Handle missing files more gracefully in pub serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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: sdk/lib/_internal/pub/test/serve/missing_file_test.dart
diff --git a/sdk/lib/_internal/pub/test/serve/missing_file_test.dart b/sdk/lib/_internal/pub/test/serve/missing_file_test.dart
index cfd7d07770f0a897041b63585fb774ef63a6f2e8..cb89a90a00b2120c955e76472ab79f68f818a627 100644
--- a/sdk/lib/_internal/pub/test/serve/missing_file_test.dart
+++ b/sdk/lib/_internal/pub/test/serve/missing_file_test.dart
@@ -4,8 +4,10 @@
library pub_tests;
-import 'dart:io';
+import 'package:path/path.dart' as path;
+import 'package:scheduled_test/scheduled_test.dart';
+import '../../lib/src/io.dart';
import '../descriptor.dart' as d;
import '../test_pub.dart';
import 'utils.dart';
@@ -14,10 +16,34 @@ main() {
initConfig();
integration("responds with a 404 for missing files", () {
d.dir(appPath, [
- d.appPubspec()
+ d.appPubspec(),
+ d.dir("asset", [
+ d.file("nope.png", "nope")
+ ]),
+ d.dir("lib", [
+ d.file("nope.dart", "nope")
+ ]),
+ d.dir("web", [
+ d.file("index.html", "<body>"),
+ ])
]).create();
+ // Start the server with the files present so that it creates barback
+ // assets for them.
startPubServe();
+
+ // TODO(rnystrom): When pub serve supports file watching, we'll have to do
+ // something here to specifically disable that so that we can get barback
+ // into the inconsistent state of thinking there is an asset but where the
+ // underlying file does not exist.
nweiz 2013/08/12 20:26:31 If you make the polling interval customizable, you
Bob Nystrom 2013/08/12 21:45:00 I was thinking the same thing. Updated the comment
+
+ // Now delete them.
+ schedule(() {
+ deleteEntry(path.join(sandboxDir, appPath, "asset", "nope.png"));
+ deleteEntry(path.join(sandboxDir, appPath, "lib", "nope.dart"));
+ deleteEntry(path.join(sandboxDir, appPath, "web", "index.html"));
+ }, "delete files");
+
requestShould404("index.html");
requestShould404("packages/myapp/nope.dart");
requestShould404("assets/myapp/nope.png");

Powered by Google App Engine
This is Rietveld 408576698