Merge pull request #231 from abarth/stocks_test

Don't try to access the network in Stocks test
This commit is contained in:
Adam Barth 2015-07-23 08:42:26 -07:00
commit 23064abc3d
2 changed files with 7 additions and 0 deletions

View File

@ -62,11 +62,15 @@ class StockDataFetcher {
int _nextChunk = 0;
final StockDataCallback callback;
static bool actuallyFetchData = true;
StockDataFetcher(this.callback) {
_fetchNextChunk();
}
void _fetchNextChunk() {
if (!actuallyFetchData)
return;
fetchBody(_urlToFetch(_nextChunk++)).then((Response response) {
String json = response.bodyAsString();
if (json == null) {

View File

@ -7,6 +7,7 @@ import 'dart:async';
import 'package:sky/widgets/widget.dart';
import '../../sdk/example/stocks/lib/main.dart';
import '../../sdk/example/stocks/lib/stock_data.dart';
import '../resources/display_list.dart';
class TestStocksApp extends StocksApp {
@ -21,6 +22,8 @@ class TestStocksApp extends StocksApp {
}
main() async {
StockDataFetcher.actuallyFetchData = false;
TestRenderView testRenderView = new TestRenderView();
TestStocksApp app = new TestStocksApp();
runApp(app, renderViewOverride: testRenderView);