mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #231 from abarth/stocks_test
Don't try to access the network in Stocks test
This commit is contained in:
commit
23064abc3d
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user