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

Side by Side Diff: base/time/pr_time_unittest.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 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
« no previous file with comments | « base/threading/worker_pool_win.cc ('k') | base/time/time.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) 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 <stdint.h> 5 #include <stdint.h>
6 #include <time.h> 6 #include <time.h>
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/third_party/nspr/prtime.h" 9 #include "base/third_party/nspr/prtime.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Tests the PR_ParseTimeString nspr helper function for 70 // Tests the PR_ParseTimeString nspr helper function for
71 // a variety of time strings. 71 // a variety of time strings.
72 TEST_F(PRTimeTest, ParseTimeTest1) { 72 TEST_F(PRTimeTest, ParseTimeTest1) {
73 time_t current_time = 0; 73 time_t current_time = 0;
74 time(&current_time); 74 time(&current_time);
75 75
76 const int BUFFER_SIZE = 64; 76 const int BUFFER_SIZE = 64;
77 struct tm local_time = {0}; 77 struct tm local_time = {0};
78 char time_buf[BUFFER_SIZE] = {0}; 78 char time_buf[BUFFER_SIZE] = {0};
79 #if defined(OS_WIN) 79 #if defined(OS_POSIX)
80 localtime_s(&local_time, &current_time);
81 asctime_s(time_buf, arraysize(time_buf), &local_time);
82 #elif defined(OS_POSIX)
83 localtime_r(&current_time, &local_time); 80 localtime_r(&current_time, &local_time);
84 asctime_r(&local_time, time_buf); 81 asctime_r(&local_time, time_buf);
85 #endif 82 #endif
86 83
87 PRTime current_time64 = static_cast<PRTime>(current_time) * PR_USEC_PER_SEC; 84 PRTime current_time64 = static_cast<PRTime>(current_time) * PR_USEC_PER_SEC;
88 85
89 PRTime parsed_time = 0; 86 PRTime parsed_time = 0;
90 PRStatus result = PR_ParseTimeString(time_buf, PR_FALSE, &parsed_time); 87 PRStatus result = PR_ParseTimeString(time_buf, PR_FALSE, &parsed_time);
91 EXPECT_EQ(PR_SUCCESS, result); 88 EXPECT_EQ(PR_SUCCESS, result);
92 EXPECT_EQ(current_time64, parsed_time); 89 EXPECT_EQ(current_time64, parsed_time);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 276
280 TEST_F(PRTimeTest, ParseTimeTestNotNormalized2) { 277 TEST_F(PRTimeTest, ParseTimeTestNotNormalized2) {
281 PRTime parsed_time = 0; 278 PRTime parsed_time = 0;
282 PRStatus result = PR_ParseTimeString("Sun Oct 14 36:45 PDT 2007", 279 PRStatus result = PR_ParseTimeString("Sun Oct 14 36:45 PDT 2007",
283 PR_FALSE, &parsed_time); 280 PR_FALSE, &parsed_time);
284 EXPECT_EQ(PR_SUCCESS, result); 281 EXPECT_EQ(PR_SUCCESS, result);
285 EXPECT_EQ(comparison_time_pdt, parsed_time); 282 EXPECT_EQ(comparison_time_pdt, parsed_time);
286 } 283 }
287 284
288 } // namespace 285 } // namespace
OLDNEW
« no previous file with comments | « base/threading/worker_pool_win.cc ('k') | base/time/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698