| Index: components/precache/core/precache_session_table_unittest.cc
|
| diff --git a/components/precache/core/precache_session_table_unittest.cc b/components/precache/core/precache_session_table_unittest.cc
|
| index a354032a5574613e459d4fab2e024c2533b4b938..313ce40f1fceeb2b2c9ebde50206d51ffd9b7840 100644
|
| --- a/components/precache/core/precache_session_table_unittest.cc
|
| +++ b/components/precache/core/precache_session_table_unittest.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/time/time.h"
|
| #include "components/precache/core/precache_session_table.h"
|
| +#include "components/precache/core/proto/quota.pb.h"
|
| #include "components/precache/core/proto/unfinished_work.pb.h"
|
| #include "sql/connection.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -153,6 +154,27 @@ TEST_F(PrecacheSessionTableTest, SaveDeleteGet) {
|
| EXPECT_EQ(0, unfinished_work2->top_host_size());
|
| }
|
|
|
| +TEST_F(PrecacheSessionTableTest, SaveAndGetQuota) {
|
| + // Initial quota, should have expired.
|
| + EXPECT_LT(base::Time::FromInternalValue(
|
| + precache_session_table_->GetQuota().start_time()),
|
| + base::Time::Now());
|
| +
|
| + PrecacheQuota quota;
|
| + quota.set_start_time(base::Time::Now().ToInternalValue());
|
| + quota.set_expiry_hours(1);
|
| + quota.set_remaining(1000U);
|
| +
|
| + PrecacheQuota expected_quota = quota;
|
| + precache_session_table_->SaveQuota(quota);
|
| + EXPECT_EQ(expected_quota.start_time(),
|
| + precache_session_table_->GetQuota().start_time());
|
| + EXPECT_EQ(expected_quota.expiry_hours(),
|
| + precache_session_table_->GetQuota().expiry_hours());
|
| + EXPECT_EQ(expected_quota.remaining(),
|
| + precache_session_table_->GetQuota().remaining());
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace precache
|
|
|