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

Side by Side Diff: content/renderer/date_time_formatter_unittest.cc

Issue 17574002: When using the week-of-year syntax, don't construct an intermediate time value when formatting; use… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-enable test Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/date_time_formatter.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include <map> 5 #include <map>
6 6
7 #include "content/renderer/date_time_formatter.h" 7 #include "content/renderer/date_time_formatter.h"
8 #include "content/renderer/renderer_date_time_picker.h" 8 #include "content/renderer/renderer_date_time_picker.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" 10 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 TEST(RendererDateTimePickerTest, TestParserValidDateInputs) { 132 TEST(RendererDateTimePickerTest, TestParserValidDateInputs) {
133 DateTimeFormatter sut(ui::TEXT_INPUT_TYPE_MONTH, 2012, 11, 1, 0, 0, 0, 0, 0); 133 DateTimeFormatter sut(ui::TEXT_INPUT_TYPE_MONTH, 2012, 11, 1, 0, 0, 0, 0, 0);
134 EXPECT_EQ("2012-12", sut.GetFormattedValue()); 134 EXPECT_EQ("2012-12", sut.GetFormattedValue());
135 135
136 136
137 DateTimeFormatter sut2(ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL, 137 DateTimeFormatter sut2(ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL,
138 2013, 3, 23, 15, 47, 0, 0, 0); 138 2013, 3, 23, 15, 47, 0, 0, 0);
139 EXPECT_EQ("2013-04-23T15:47", sut2.GetFormattedValue()); 139 EXPECT_EQ("2013-04-23T15:47", sut2.GetFormattedValue());
140 140
141 // Disabling this case due to crbug.com/253231 141 DateTimeFormatter sut3(ui::TEXT_INPUT_TYPE_WEEK, 0, 0, 0, 0, 0, 0, 2012, 2);
142 //DateTimeFormatter sut3(ui::TEXT_INPUT_TYPE_WEEK, 0, 0, 0, 0, 0, 0, 2012, 2); 142 EXPECT_EQ("2012-W02", sut3.GetFormattedValue());
143 //EXPECT_EQ("2012-W02", sut3.GetFormattedValue());
144 } 143 }
145 144
146 TEST(RendererDateTimePickerTest, TestParserInvalidDateInputs) { 145 TEST(RendererDateTimePickerTest, TestParserInvalidDateInputs) {
147 DateTimeFormatter sut(ui::TEXT_INPUT_TYPE_WEEK, 0, 0, 0, 0, 0, 0, 0, 0); 146 DateTimeFormatter sut(ui::TEXT_INPUT_TYPE_WEEK, 0, 0, 0, 0, 0, 0, 0, 0);
148 EXPECT_EQ("", sut.GetFormattedValue()); 147 EXPECT_EQ("", sut.GetFormattedValue());
149 148
150 DateTimeFormatter sut2(ui::TEXT_INPUT_TYPE_NONE, 2013, 3, 23, 0, 0, 0, 0, 0); 149 DateTimeFormatter sut2(ui::TEXT_INPUT_TYPE_NONE, 2013, 3, 23, 0, 0, 0, 0, 0);
151 EXPECT_EQ("", sut2.GetFormattedValue()); 150 EXPECT_EQ("", sut2.GetFormattedValue());
152 151
153 DateTimeFormatter sut3(ui::TEXT_INPUT_TYPE_NONE, 2013, 14, 32, 0, 0, 0, 0, 0); 152 DateTimeFormatter sut3(ui::TEXT_INPUT_TYPE_NONE, 2013, 14, 32, 0, 0, 0, 0, 0);
154 EXPECT_EQ("", sut3.GetFormattedValue()); 153 EXPECT_EQ("", sut3.GetFormattedValue());
155 154
156 DateTimeFormatter sut4(ui::TEXT_INPUT_TYPE_DATE, 0, 0, 0, 0, 0, 0, 0, 0); 155 DateTimeFormatter sut4(ui::TEXT_INPUT_TYPE_DATE, 0, 0, 0, 0, 0, 0, 0, 0);
157 EXPECT_EQ("", sut4.GetFormattedValue()); 156 EXPECT_EQ("", sut4.GetFormattedValue());
158 157
159 DateTimeFormatter sut5(ui::TEXT_INPUT_TYPE_TIME, 0, 0, 0, 0, 0, 0, 0, 0); 158 DateTimeFormatter sut5(ui::TEXT_INPUT_TYPE_TIME, 0, 0, 0, 0, 0, 0, 0, 0);
160 EXPECT_EQ("", sut5.GetFormattedValue()); 159 EXPECT_EQ("", sut5.GetFormattedValue());
161 160
162 DateTimeFormatter sut6(ui::TEXT_INPUT_TYPE_PASSWORD, 23, 0, 0, 0, 5, 0, 0, 0); 161 DateTimeFormatter sut6(ui::TEXT_INPUT_TYPE_PASSWORD, 23, 0, 0, 0, 5, 0, 0, 0);
163 EXPECT_EQ("", sut6.GetFormattedValue()); 162 EXPECT_EQ("", sut6.GetFormattedValue());
164 163
165 DateTimeFormatter sut7(ui::TEXT_INPUT_TYPE_MAX, 23, 0, 0, 0, 5, 0, 0, 0); 164 DateTimeFormatter sut7(ui::TEXT_INPUT_TYPE_MAX, 23, 0, 0, 0, 5, 0, 0, 0);
166 EXPECT_EQ("", sut7.GetFormattedValue()); 165 EXPECT_EQ("", sut7.GetFormattedValue());
167 166
168 DateTimeFormatter sut8( 167 DateTimeFormatter sut8(
169 static_cast<ui::TextInputType>(10000), 23, 0, 0, 0, 5, 0, 0, 0); 168 static_cast<ui::TextInputType>(10000), 23, 0, 0, 0, 5, 0, 0, 0);
170 EXPECT_EQ("", sut8.GetFormattedValue()); 169 EXPECT_EQ("", sut8.GetFormattedValue());
171 } 170 }
172 } // namespace content 171 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/date_time_formatter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698