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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_usage_store_unittest.cc

Issue 2405453002: Fix Integer-overflow in base::Time::FromExploded. (Closed)
Patch Set: rebased and fixed net unittest Created 4 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/time/time_win.cc ('k') | media/ffmpeg/ffmpeg_common.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/core/browser/data_usage_store.h" 5 #include "components/data_reduction_proxy/core/browser/data_usage_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 // for 60 days. 22 // for 60 days.
23 const unsigned kNumExpectedBuckets = 60 * 24 * 60 / 15; 23 const unsigned kNumExpectedBuckets = 60 * 24 * 60 / 15;
24 const int kBucketsInHour = 60 / 15; 24 const int kBucketsInHour = 60 / 15;
25 const int kTestCurrentBucketIndex = 2880; 25 const int kTestCurrentBucketIndex = 2880;
26 26
27 base::Time::Exploded TestExplodedTime() { 27 base::Time::Exploded TestExplodedTime() {
28 base::Time::Exploded exploded; 28 base::Time::Exploded exploded;
29 exploded.year = 2001; 29 exploded.year = 2001;
30 exploded.month = 12; 30 exploded.month = 12;
31 exploded.day_of_month = 31; 31 exploded.day_of_month = 31;
32 exploded.day_of_week = 1;
32 exploded.hour = 12; 33 exploded.hour = 12;
33 exploded.minute = 1; 34 exploded.minute = 1;
34 exploded.second = 0; 35 exploded.second = 0;
35 exploded.millisecond = 0; 36 exploded.millisecond = 0;
36 37
37 return exploded; 38 return exploded;
38 } 39 }
39 } 40 }
40 41
41 namespace data_reduction_proxy { 42 namespace data_reduction_proxy {
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 ASSERT_TRUE(store()->map()->find(base::StringPrintf( 462 ASSERT_TRUE(store()->map()->find(base::StringPrintf(
462 "data_usage_bucket:%d", kNumExpectedBuckets - 2)) != 463 "data_usage_bucket:%d", kNumExpectedBuckets - 2)) !=
463 store()->map()->end()); 464 store()->map()->end());
464 465
465 data_usage_store()->DeleteBrowsingHistory(now - base::TimeDelta::FromDays(60), 466 data_usage_store()->DeleteBrowsingHistory(now - base::TimeDelta::FromDays(60),
466 now); 467 now);
467 ASSERT_EQ(1u, store()->map()->size()); 468 ASSERT_EQ(1u, store()->map()->size());
468 } 469 }
469 470
470 } // namespace data_reduction_proxy 471 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « base/time/time_win.cc ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698