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

Unified Diff: packages/intl/test/find_default_locale_browser_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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: packages/intl/test/find_default_locale_browser_test.dart
diff --git a/packages/intl/test/find_default_locale_browser_test.dart b/packages/intl/test/find_default_locale_browser_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f00b4c8e632055e118868435413d9672c6cae86e
--- /dev/null
+++ b/packages/intl/test/find_default_locale_browser_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library find_default_locale_browser_test;
+
+import 'package:intl/intl.dart';
+import 'package:intl/intl_browser.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ test("Find system locale in browser", () {
+ // TODO (alanknight): This only verifies that we found some locale. We
+ // should find a way to force the system locale before the test is run
+ // and then verify that it's actually the correct value.
+ Intl.systemLocale = 'xx_YY';
+ var callback = expectAsync(verifyLocale);
+ findSystemLocale().then(callback);
+ });
+}
+
+verifyLocale(_) {
+ expect(Intl.systemLocale, isNot(equals("xx_YY")));
+ // Allow either en_US or just en type locales. Windows in particular may
+ // give us just ru for ru_RU
+ var pattern = new RegExp(r"\w\w_[A-Z0-9]+");
+ var shortPattern = new RegExp(r"\w\w");
+ var match = pattern.hasMatch(Intl.systemLocale);
+ var shortMatch = shortPattern.hasMatch(Intl.systemLocale);
+ expect(match || shortMatch, isTrue);
+}
« no previous file with comments | « packages/intl/test/date_time_strict_test.dart ('k') | packages/intl/test/find_default_locale_standalone_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698