diff --git a/sky/sdk/example/stocks/lib/stock_data.dart b/sky/sdk/example/stocks/lib/stock_data.dart index 5526a9c9cd4f0..7c1e046c21077 100644 --- a/sky/sdk/example/stocks/lib/stock_data.dart +++ b/sky/sdk/example/stocks/lib/stock_data.dart @@ -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) { diff --git a/sky/tests/examples/stocks.dart b/sky/tests/examples/stocks.dart index 4db95d2f005ff..bd0050fc6e79c 100644 --- a/sky/tests/examples/stocks.dart +++ b/sky/tests/examples/stocks.dart @@ -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);