Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1426)

Unified Diff: pkg/intl/test/date_time_format_http_request_test.dart

Issue 10959002: Read locales over http in the browser (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/intl/test/date_time_format_http_request_test.dart
===================================================================
--- pkg/intl/test/date_time_format_http_request_test.dart (revision 0)
+++ pkg/intl/test/date_time_format_http_request_test.dart (revision 0)
@@ -0,0 +1,44 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// or details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * Test date formatting and parsing using locale data read via an http request
+ * to a server.
+ */
+
+// TODO(alanknight): It would be nice if there were a more general facility
+// than this and it could be replaced, possibly the things Graham is working on.
+// The following magical comments will cause the test code run via test.py
+// to add an extra command starting up a web server that will serve the
+// files we are looking for.
+// ExtraCommand=dart
+// ExtraCommandArgs=pkg/intl/test/start_web_server.dart
+#library('date_time_format_http_request_test');
+
+#import('../lib/date_format.dart');
+#import('../lib/date_symbol_data_http_request.dart');
+#import('date_time_format_test_core.dart');
+#import('dart:html');
+
+var url = "http://localhost:8000/dates/";
+
+main() {
+ // Initialize one locale just so we know what the list is.
+ initializeDateFormatting("en_US", url).then(runEverything);
+}
+
+void runEverything(_) {
+ // Initialize all locales and wait for them to finish before running tests.
+ var futures = DateFormat.allLocalesWithSymbols().map(
+ (locale) => initializeDateFormatting(locale, url));
+ Futures.wait(futures).then((results) {
+ runDateTests();
+ shutDown();});
+}
+
+void shutDown() {
+ // The tiny web server knows to use this request as a cue to terminate.
+ var source = '$url/terminate';
+ var request = new HttpRequest.get(source, (_) {});
+}

Powered by Google App Engine
This is Rietveld 408576698