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

Unified Diff: base/time/time_unittest.cc

Issue 27472003: android: fix base::Time::FromLocalExploded() crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use new code paths on all platforms. Created 7 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
« no previous file with comments | « base/time/time_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time_unittest.cc
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc
index 7f3fde0c5eeac59621fd6fb5b9f4b7ce74424dcd..81a3358f08ca91a84af020dd2c646093a972bfd0 100644
--- a/base/time/time_unittest.cc
+++ b/base/time/time_unittest.cc
@@ -7,6 +7,8 @@
#include <time.h>
#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -541,6 +543,28 @@ TEST_F(TimeTest, TimeTOverflow) {
}
#endif
+#if defined(OS_ANDROID)
+TEST_F(TimeTest, FromLocalExplodedCrashOnAndroid) {
jar (doing other things) 2013/10/21 18:15:20 nit: IMO, you should have "similar" tests on all p
+ // This crashed inside Time:: FromLocalExploded() on Android 4.1.2.
+ // See http://crbug.com/287821
+ Time::Exploded midnight = {2013, // year
+ 10, // month
+ 0, // day_of_week
+ 13, // day_of_month
+ 0, // hour
+ 0, // minute
+ 0, // second
+ };
+ // The string passed to putenv() must be a char* and the documentation states
+ // that it 'becomes part of the environment', so use a static buffer.
+ static char buffer[] = "TZ=America/Santiago";
+ putenv(buffer);
+ tzset();
+ Time t = Time::FromLocalExploded(midnight);
+ EXPECT_EQ(1381633200, t.ToTimeT());
+}
+#endif // OS_ANDROID
+
TEST(TimeTicks, Deltas) {
for (int index = 0; index < 50; index++) {
TimeTicks ticks_start = TimeTicks::Now();
« no previous file with comments | « base/time/time_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698