Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * Test date formatting and parsing using locale data read via an http request | |
| 7 * to a server. | |
| 8 */ | |
| 9 | |
| 10 // The following magical comments will cause the test code run via test.py | |
| 11 // to add an extra command starting up a web server that will serve the | |
| 12 // files we are looking for. | |
| 13 // ExtraCommand=dart | |
| 14 // ExtraCommandArgs=pkg/intl/test/start_web_server.dart | |
|
Emily Fortuna
2012/09/20 23:07:19
will this be removed after Graham has implemented
Alan Knight
2012/09/20 23:29:59
I would love to be able to remove it. It seems lik
| |
| 15 #library('date_time_format_http_request_test'); | |
| 16 | |
| 17 #import('../lib/date_format.dart'); | |
| 18 #import('../lib/date_symbol_data_http_request.dart'); | |
| 19 #import('date_time_format_test_core.dart'); | |
| 20 #import('dart:html'); | |
| 21 | |
| 22 var url = "http://localhost:8000/dates/"; | |
| 23 | |
| 24 main() { | |
| 25 // Initialize one locale just so we know what the list is. | |
| 26 initializeDateFormatting("en_US", url).then(runEverything); | |
| 27 } | |
| 28 | |
| 29 void runEverything(_) { | |
| 30 // Initialize all locales and wait for them to finish before running tests. | |
| 31 var futures = DateFormat.allLocalesWithSymbols().map( | |
| 32 (locale) => initializeDateFormatting(locale, url)); | |
| 33 Futures.wait(futures).then((results) { | |
| 34 runDateTests(); | |
| 35 shutDown();}); | |
| 36 } | |
| 37 | |
| 38 void shutDown() { | |
| 39 // The tiny web server knows to use this request as a cue to terminate. | |
| 40 var source = '$url/terminate'; | |
| 41 var request = new HttpRequest.get(source, (_) {}); | |
| 42 } | |
| OLD | NEW |