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

Side by Side Diff: chrome/common/time_format_browsertest.cc

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tony's comments Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | ui/base/l10n/formatter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This whole test runs as a separate browser_test because it depends on a 5 // This whole test runs as a separate browser_test because it depends on a
6 // static initialization inside third_party/icu (gDecimal in digitlst.cpp). 6 // static initialization inside third_party/icu (gDecimal in digitlst.cpp).
7 // 7 //
8 // That initialization depends on the current locale, and on certain locales 8 // That initialization depends on the current locale, and on certain locales
9 // will lead to wrong behavior. To make sure that the locale is set before 9 // will lead to wrong behavior. To make sure that the locale is set before
10 // icu is used, and that the "wrong" static value doesn't affect other tests, 10 // icu is used, and that the "wrong" static value doesn't affect other tests,
(...skipping 17 matching lines...) Expand all
28 }; 28 };
29 29
30 IN_PROC_BROWSER_TEST_F(TimeFormatBrowserTest, DecimalPointNotDot) { 30 IN_PROC_BROWSER_TEST_F(TimeFormatBrowserTest, DecimalPointNotDot) {
31 // Some locales use a comma ',' instead of a dot '.' as the separator for 31 // Some locales use a comma ',' instead of a dot '.' as the separator for
32 // decimal digits. The icu library wasn't handling this, leading to "1" 32 // decimal digits. The icu library wasn't handling this, leading to "1"
33 // being internally converted to "+1,0e00" and ultimately leading to "NaN". 33 // being internally converted to "+1,0e00" and ultimately leading to "NaN".
34 // This showed up on the browser on estimated download time, for example. 34 // This showed up on the browser on estimated download time, for example.
35 // http://crbug.com/60476 35 // http://crbug.com/60476
36 36
37 base::string16 one_min = 37 base::string16 one_min =
38 ui::TimeFormat::TimeDurationShort(TimeDelta::FromMinutes(1)); 38 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION,
39 ui::TimeFormat::LENGTH_SHORT,
40 TimeDelta::FromMinutes(1));
39 EXPECT_EQ(base::ASCIIToUTF16("1 min"), one_min); 41 EXPECT_EQ(base::ASCIIToUTF16("1 min"), one_min);
40 } 42 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | ui/base/l10n/formatter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698