From 49acd886b912d716c5c22043857526295b30c3a1 Mon Sep 17 00:00:00 2001 From: "whesse@google.com" Date: Tue, 4 Nov 2014 15:00:00 +0000 Subject: [PATCH] Improve handling of intentionally broken links in test scripts. BUG= Review URL: https://codereview.chromium.org//702673002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41492 260f80e4-7a28-3924-810f-c04153c831b5 --- tests/_chrome/sample_test.dart | 2 +- tests/html/audioelement_test.dart | 4 ++-- tools/testing/dart/http_server.dart | 16 +++------------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/_chrome/sample_test.dart b/tests/_chrome/sample_test.dart index 85448ff4376..b25a94b9b3f 100644 --- a/tests/_chrome/sample_test.dart +++ b/tests/_chrome/sample_test.dart @@ -17,7 +17,7 @@ main() { test('fails from browser', () { // APIs should not work in standard browser apps. expect(() { - _chrome.app.window.create('foo.html'); + _chrome.app.window.create('IntentionallyMissingFile.html'); }, throws); }); } diff --git a/tests/html/audioelement_test.dart b/tests/html/audioelement_test.dart index 28285962f84..02c89359bb1 100644 --- a/tests/html/audioelement_test.dart +++ b/tests/html/audioelement_test.dart @@ -13,9 +13,9 @@ main() { }); test('constructorTest2', () { - var audio = new AudioElement('hahaURL'); + var audio = new AudioElement('IntentionallyMissingFileURL'); expect(audio, isNotNull); expect(audio is AudioElement, isTrue); - expect(audio.src, contains('hahaURL')); + expect(audio.src, contains('IntentionallyMissingFileURL')); }); } diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart index 14cb0ff8dbe..a5e7b8eba15 100644 --- a/tools/testing/dart/http_server.dart +++ b/tools/testing/dart/http_server.dart @@ -126,17 +126,7 @@ class TestingServers { "/foo", "/bar", "/NonExistingFile", - "/NonExistingFile.js", - "/hahaURL", - "/IntentionallyMissingFile", - "/IntentionallyMissingFile.dart", - "/IntentionallyMissingFile.html", - "/IntentionallyMissingFile.png", - "/IntentionallyMissingFile.css", - "/IntentionallyMissingFile.jpg", - "/IntentionallyMissingFile.ttf", - "/IntentionallyMissingFile.otf", - "/IntentionallyMissingFile.jpeg" + "IntentionallyMissingFile", ]; List _serverList = []; @@ -419,8 +409,8 @@ class TestingServers { void _sendNotFound(HttpRequest request) { bool isHarmlessPath(String path) { - return _HARMLESS_REQUEST_PATH_ENDINGS.any((ending) { - return path.endsWith(ending); + return _HARMLESS_REQUEST_PATH_ENDINGS.any((pattern) { + return path.contains(pattern); }); } if (!isHarmlessPath(request.uri.path)) {