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

Side by Side Diff: extensions/browser/quota_service_unittest.cc

Issue 1976703005: Allow constexpr variables of TimeDelta type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Generalize FromProduct a bit. Created 4 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 12 matching lines...) Expand all
23 typedef QuotaLimitHeuristic::Bucket Bucket; 23 typedef QuotaLimitHeuristic::Bucket Bucket;
24 typedef QuotaLimitHeuristic::Config Config; 24 typedef QuotaLimitHeuristic::Config Config;
25 typedef QuotaLimitHeuristic::BucketList BucketList; 25 typedef QuotaLimitHeuristic::BucketList BucketList;
26 typedef QuotaService::TimedLimit TimedLimit; 26 typedef QuotaService::TimedLimit TimedLimit;
27 27
28 namespace { 28 namespace {
29 29
30 const char kGenericName[] = "name"; 30 const char kGenericName[] = "name";
31 const Config kFrozenConfig = {0, TimeDelta::FromDays(0)}; 31 const Config kFrozenConfig = {0, TimeDelta::FromDays(0)};
32 const Config k2PerMinute = {2, TimeDelta::FromMinutes(1)}; 32 const Config k2PerMinute = {2, TimeDelta::FromMinutes(1)};
33 const Config k20PerHour = {20, TimeDelta::FromHours(1)};
34 const TimeTicks kStartTime = TimeTicks(); 33 const TimeTicks kStartTime = TimeTicks();
35 const TimeTicks k1MinuteAfterStart = kStartTime + TimeDelta::FromMinutes(1); 34 const TimeTicks k1MinuteAfterStart = kStartTime + TimeDelta::FromMinutes(1);
36 35
37 class Mapper : public QuotaLimitHeuristic::BucketMapper { 36 class Mapper : public QuotaLimitHeuristic::BucketMapper {
38 public: 37 public:
39 Mapper() {} 38 Mapper() {}
40 ~Mapper() override { STLDeleteValues(&buckets_); } 39 ~Mapper() override { STLDeleteValues(&buckets_); }
41 void GetBucketsForArgs(const base::ListValue* args, 40 void GetBucketsForArgs(const base::ListValue* args,
42 BucketList* buckets) override { 41 BucketList* buckets) override {
43 for (size_t i = 0; i < args->GetSize(); i++) { 42 for (size_t i = 0; i < args->GetSize(); i++) {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_NE("", service_->Assess(extension_a_, f.get(), &arg, 324 EXPECT_NE("", service_->Assess(extension_a_, f.get(), &arg,
326 kStartTime + TimeDelta::FromDays(1) + 325 kStartTime + TimeDelta::FromDays(1) +
327 TimeDelta::FromSeconds(25))); 326 TimeDelta::FromSeconds(25)));
328 327
329 // Like now. 328 // Like now.
330 EXPECT_EQ("", service_->Assess(extension_a_, f.get(), &arg, 329 EXPECT_EQ("", service_->Assess(extension_a_, f.get(), &arg,
331 kStartTime + TimeDelta::FromDays(2))); 330 kStartTime + TimeDelta::FromDays(2)));
332 } 331 }
333 332
334 } // namespace extensions 333 } // namespace extensions
OLDNEW
« base/time/time.h ('K') | « content/browser/download/base_file_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698