diff options
author | michaeln <michaeln@chromium.org> | 2015-02-20 14:22:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-20 22:23:26 +0000 |
commit | 770daec923bb61392afbf9ca16ee0dad147e154f (patch) | |
tree | 583692ea0389f4b05d08f8c22a1a9c855aedf4a6 /base/time/time_unittest.cc | |
parent | caa8fc58bce415a672cbda87115645abeb543cbd (diff) | |
download | chromium_src-770daec923bb61392afbf9ca16ee0dad147e154f.zip chromium_src-770daec923bb61392afbf9ca16ee0dad147e154f.tar.gz chromium_src-770daec923bb61392afbf9ca16ee0dad147e154f.tar.bz2 |
[DOMStorage] Rate limiting writes to disk.
Given access patterns that are just wrong, local & session storage can write many gigabytes per day or keep the disk perpetually spun up. To avoid excessive IO, we apply limits to the amount of data being written and the frequency of writes to address both kinds of 'bad' behaviors.
TBR=rvargas
BUG=176727
Review URL: https://codereview.chromium.org/896643002
Cr-Commit-Position: refs/heads/master@{#317424}
Diffstat (limited to 'base/time/time_unittest.cc')
-rw-r--r-- | base/time/time_unittest.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc index fdac59d..6387ec7 100644 --- a/base/time/time_unittest.cc +++ b/base/time/time_unittest.cc @@ -867,6 +867,15 @@ TEST(TimeDelta, Magnitude) { TimeDelta::FromMicroseconds(min_int64_plus_two).magnitude()); } + +TEST(TimeDelta, multiply_by) { + double d = 0.5; + EXPECT_EQ(TimeDelta::FromMilliseconds(500), + TimeDelta::FromMilliseconds(1000).multiply_by(d)); + EXPECT_EQ(TimeDelta::FromMilliseconds(2000), + TimeDelta::FromMilliseconds(1000).divide_by(d)); +} + TEST(TimeDeltaLogging, DCheckEqCompiles) { DCHECK_EQ(TimeDelta(), TimeDelta()); } |