我有Linux Ubuntu 12.04LTS并且我试图对这样的客户端代码进行dart(sdk 1.17.1)测试(0.12.13。+ 5):
的test.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script type="application/dart" src="test.dart"></script>
<script src="packages/browser/dart.js"></script>
<script src="packages/test/dart.js"></script>
<link rel="x-dart-test" href="test.dart">
</head>
<body></body>
</html>
test.dart:
@TestOn('browser')
import 'package:http/browser_client.dart';
import 'package:test/test.dart';
void main() {
test('client.get', () {
var client = new BrowserClient();
return client.get('https://hacker-news.firebaseio.com')
.then((result) {
expect(result.statusCode, 200);
});
});
}
使用
pub run test -p dartium test/test.dart
测试通过OK,测试运行器和远程服务器(firebaseio.com)之间有数据交换。 但是
pub run test -p content-shell test/test.dart
超时测试失败,并且没有与远程服务器进行任何数据交换。为什么?如何解决这个问题呢?