OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 | 6 |
7 #include <time.h> | 7 #include <time.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Specialized test fixture allowing time strings without timezones to be | 22 // Specialized test fixture allowing time strings without timezones to be |
23 // tested by comparing them to a known time in the local zone. | 23 // tested by comparing them to a known time in the local zone. |
24 // See also pr_time_unittests.cc | 24 // See also pr_time_unittests.cc |
25 class TimeTest : public testing::Test { | 25 class TimeTest : public testing::Test { |
26 protected: | 26 protected: |
27 virtual void SetUp() override { | 27 void SetUp() override { |
28 // Use mktime to get a time_t, and turn it into a PRTime by converting | 28 // Use mktime to get a time_t, and turn it into a PRTime by converting |
29 // seconds to microseconds. Use 15th Oct 2007 12:45:00 local. This | 29 // seconds to microseconds. Use 15th Oct 2007 12:45:00 local. This |
30 // must be a time guaranteed to be outside of a DST fallback hour in | 30 // must be a time guaranteed to be outside of a DST fallback hour in |
31 // any timezone. | 31 // any timezone. |
32 struct tm local_comparison_tm = { | 32 struct tm local_comparison_tm = { |
33 0, // second | 33 0, // second |
34 45, // minute | 34 45, // minute |
35 12, // hour | 35 12, // hour |
36 15, // day of month | 36 15, // day of month |
37 10 - 1, // month | 37 10 - 1, // month |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 | 872 |
873 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { | 873 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { |
874 std::ostringstream oss; | 874 std::ostringstream oss; |
875 oss << TimeTicks(); | 875 oss << TimeTicks(); |
876 EXPECT_TRUE(oss.good()); | 876 EXPECT_TRUE(oss.good()); |
877 } | 877 } |
878 | 878 |
879 } // namespace | 879 } // namespace |
880 | 880 |
881 } // namespace base | 881 } // namespace base |
OLD | NEW |