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

Side by Side Diff: Source/web/tests/LocaleWinTest.cpp

Issue 52553008: Eliminate the CALENDAR_PICKER compile time flag as only android uses this flag and the web facing p… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Fix winbot by eliminating last checks for CALENDAR_PICKER Created 7 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 { 83 {
84 return dateToDaysFrom1970(year, month, day) * msPerDay; 84 return dateToDaysFrom1970(year, month, day) * msPerDay;
85 } 85 }
86 86
87 String formatDate(LCID lcid, int year, int month, int day) 87 String formatDate(LCID lcid, int year, int month, int day)
88 { 88 {
89 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 89 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
90 return locale->formatDateTime(dateComponents(year, month, day)); 90 return locale->formatDateTime(dateComponents(year, month, day));
91 } 91 }
92 92
93 #if ENABLE(CALENDAR_PICKER)
94 unsigned firstDayOfWeek(LCID lcid) 93 unsigned firstDayOfWeek(LCID lcid)
95 { 94 {
96 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 95 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
97 return locale->firstDayOfWeek(); 96 return locale->firstDayOfWeek();
98 } 97 }
99 98
100 String monthLabel(LCID lcid, unsigned index) 99 String monthLabel(LCID lcid, unsigned index)
101 { 100 {
102 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 101 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
103 return locale->monthLabels()[index]; 102 return locale->monthLabels()[index];
104 } 103 }
105 104
106 String weekDayShortLabel(LCID lcid, unsigned index) 105 String weekDayShortLabel(LCID lcid, unsigned index)
107 { 106 {
108 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 107 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
109 return locale->weekDayShortLabels()[index]; 108 return locale->weekDayShortLabels()[index];
110 } 109 }
111 110
112 bool isRTL(LCID lcid) 111 bool isRTL(LCID lcid)
113 { 112 {
114 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 113 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
115 return locale->isRTL(); 114 return locale->isRTL();
116 } 115 }
117 #endif
118 116
119 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 117 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
120 String monthFormat(LCID lcid) 118 String monthFormat(LCID lcid)
121 { 119 {
122 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */); 120 OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLo cale */);
123 return locale->monthFormat(); 121 return locale->monthFormat();
124 } 122 }
125 123
126 String timeFormat(LCID lcid) 124 String timeFormat(LCID lcid)
127 { 125 {
(...skipping 27 matching lines...) Expand all
155 #endif 153 #endif
156 }; 154 };
157 155
158 TEST_F(LocaleWinTest, formatDate) 156 TEST_F(LocaleWinTest, formatDate)
159 { 157 {
160 EXPECT_STREQ("04/27/2005", formatDate(EnglishUS, 2005, April, 27).utf8().dat a()); 158 EXPECT_STREQ("04/27/2005", formatDate(EnglishUS, 2005, April, 27).utf8().dat a());
161 EXPECT_STREQ("27/04/2005", formatDate(FrenchFR, 2005, April, 27).utf8().data ()); 159 EXPECT_STREQ("27/04/2005", formatDate(FrenchFR, 2005, April, 27).utf8().data ());
162 EXPECT_STREQ("2005/04/27", formatDate(JapaneseJP, 2005, April, 27).utf8().da ta()); 160 EXPECT_STREQ("2005/04/27", formatDate(JapaneseJP, 2005, April, 27).utf8().da ta());
163 } 161 }
164 162
165 #if ENABLE(CALENDAR_PICKER)
166 TEST_F(LocaleWinTest, firstDayOfWeek) 163 TEST_F(LocaleWinTest, firstDayOfWeek)
167 { 164 {
168 EXPECT_EQ(Sunday, firstDayOfWeek(EnglishUS)); 165 EXPECT_EQ(Sunday, firstDayOfWeek(EnglishUS));
169 EXPECT_EQ(Monday, firstDayOfWeek(FrenchFR)); 166 EXPECT_EQ(Monday, firstDayOfWeek(FrenchFR));
170 EXPECT_EQ(Sunday, firstDayOfWeek(JapaneseJP)); 167 EXPECT_EQ(Sunday, firstDayOfWeek(JapaneseJP));
171 } 168 }
172 169
173 TEST_F(LocaleWinTest, monthLabels) 170 TEST_F(LocaleWinTest, monthLabels)
174 { 171 {
175 EXPECT_STREQ("January", monthLabel(EnglishUS, January).utf8().data()); 172 EXPECT_STREQ("January", monthLabel(EnglishUS, January).utf8().data());
(...skipping 23 matching lines...) Expand all
199 EXPECT_STREQ("\xE6\xB0\xB4", weekDayShortLabel(JapaneseJP, Wednesday).utf8() .data()); 196 EXPECT_STREQ("\xE6\xB0\xB4", weekDayShortLabel(JapaneseJP, Wednesday).utf8() .data());
200 EXPECT_STREQ("\xE5\x9C\x9F", weekDayShortLabel(JapaneseJP, Saturday).utf8(). data()); 197 EXPECT_STREQ("\xE5\x9C\x9F", weekDayShortLabel(JapaneseJP, Saturday).utf8(). data());
201 } 198 }
202 199
203 TEST_F(LocaleWinTest, isRTL) 200 TEST_F(LocaleWinTest, isRTL)
204 { 201 {
205 EXPECT_TRUE(isRTL(ArabicEG)); 202 EXPECT_TRUE(isRTL(ArabicEG));
206 EXPECT_FALSE(isRTL(EnglishUS)); 203 EXPECT_FALSE(isRTL(EnglishUS));
207 } 204 }
208 205
209 #endif
210
211 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 206 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
212 TEST_F(LocaleWinTest, dateFormat) 207 TEST_F(LocaleWinTest, dateFormat)
213 { 208 {
214 EXPECT_STREQ("y-M-d", LocaleWin::dateFormat("y-M-d").utf8().data()); 209 EXPECT_STREQ("y-M-d", LocaleWin::dateFormat("y-M-d").utf8().data());
215 EXPECT_STREQ("''yy'-'''MM'''-'dd", LocaleWin::dateFormat("''yy-''MM''-dd").u tf8().data()); 210 EXPECT_STREQ("''yy'-'''MM'''-'dd", LocaleWin::dateFormat("''yy-''MM''-dd").u tf8().data());
216 EXPECT_STREQ("yyyy'-''''-'MMM'''''-'dd", LocaleWin::dateFormat("yyyy-''''-MM M''''-dd").utf8().data()); 211 EXPECT_STREQ("yyyy'-''''-'MMM'''''-'dd", LocaleWin::dateFormat("yyyy-''''-MM M''''-dd").utf8().data());
217 EXPECT_STREQ("yyyy'-'''''MMMM-dd", LocaleWin::dateFormat("yyyy-''''MMMM-dd") .utf8().data()); 212 EXPECT_STREQ("yyyy'-'''''MMMM-dd", LocaleWin::dateFormat("yyyy-''''MMMM-dd") .utf8().data());
218 } 213 }
219 214
220 TEST_F(LocaleWinTest, monthFormat) 215 TEST_F(LocaleWinTest, monthFormat)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 testNumbers(ArabicEG); 296 testNumbers(ArabicEG);
302 testNumbers(German); 297 testNumbers(German);
303 testNumbers(Spanish); 298 testNumbers(Spanish);
304 testNumbers(Persian); 299 testNumbers(Persian);
305 testNumbers(JapaneseJP); 300 testNumbers(JapaneseJP);
306 testNumbers(KoreanKR); 301 testNumbers(KoreanKR);
307 testNumbers(ChineseCN); 302 testNumbers(ChineseCN);
308 testNumbers(ChineseHK); 303 testNumbers(ChineseHK);
309 testNumbers(ChineseTW); 304 testNumbers(ChineseTW);
310 } 305 }
OLDNEW
« no previous file with comments | « Source/web/tests/LocaleMacTest.cpp ('k') | Source/web/web.gyp » ('j') | Source/web/web.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698