| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // or details. All rights reserved. Use of this source code is governed by a | 2 // or details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Test date formatting and parsing using locale data read via an http request | 6 * Test date formatting and parsing using locale data read via an http request |
| 7 * to a server. | 7 * to a server. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 library date_time_format_http_request_test; | 10 library date_time_format_http_request_test; |
| 11 | 11 |
| 12 import '../lib/intl.dart'; | 12 import 'package:intl/intl.dart'; |
| 13 import '../lib/date_symbol_data_http_request.dart'; | 13 import 'package:intl/date_symbol_data_http_request.dart'; |
| 14 import 'date_time_format_test_core.dart'; | 14 import 'date_time_format_test_core.dart'; |
| 15 import 'dart:html'; | 15 import 'dart:html'; |
| 16 import '../../../pkg/unittest/lib/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 17 import 'package:unittest/html_config.dart'; |
| 17 | 18 |
| 18 var url = "http://localhost:9876/pkg/intl/lib/src/data/dates/"; | 19 var url = ''; |
| 19 | 20 |
| 20 main() { | 21 main() { |
| 22 useHtmlConfiguration(); |
| 23 url = "http://localhost:${window.location.port}/pkg/intl/lib/src/data/dates/"; |
| 21 // Initialize one locale just so we know what the list is. | 24 // Initialize one locale just so we know what the list is. |
| 22 test('Run everything', () { | 25 test('Run everything', () { |
| 23 initializeDateFormatting("en_US", url).then(expectAsync1(runEverything));}); | 26 initializeDateFormatting("en_US", url).then(expectAsync1(runEverything));}); |
| 24 } | 27 } |
| 25 | 28 |
| 26 void runEverything(_) { | 29 void runEverything(_) { |
| 27 // Initialize all locales and wait for them to finish before running tests. | 30 // Initialize all locales and wait for them to finish before running tests. |
| 28 var futures = DateFormat.allLocalesWithSymbols().map( | 31 var futures = DateFormat.allLocalesWithSymbols().map( |
| 29 (locale) => initializeDateFormatting(locale, url)); | 32 (locale) => initializeDateFormatting(locale, url)); |
| 30 Futures.wait(futures).then(expectAsync1((_) { | 33 Futures.wait(futures).then(expectAsync1((_) { |
| 31 runDateTests(smallSetOfLocales()); | 34 runDateTests(smallSetOfLocales()); |
| 32 shutDown();})); | 35 })); |
| 33 } | 36 } |
| 34 | |
| 35 void shutDown() { | |
| 36 // The tiny web server knows to use this request as a cue to terminate. | |
| 37 var source = '${url}terminate'; | |
| 38 var request = new HttpRequest.get(source, (_) {}); | |
| 39 } | |
| OLD | NEW |