Chromium Code Reviews| Index: components/offline_pages/client_policy_controller_unittest.cc |
| diff --git a/components/offline_pages/client_policy_controller_unittest.cc b/components/offline_pages/client_policy_controller_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b0a1b193c744a035d1950759a79738f59753d026 |
| --- /dev/null |
| +++ b/components/offline_pages/client_policy_controller_unittest.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/offline_pages/client_policy_controller.h" |
| + |
| +#include "base/bind.h" |
| +#include "base/time/time.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +using LifetimeType = offline_pages::LifetimePolicy::LifetimeType; |
| + |
| +namespace offline_pages { |
| + |
| +namespace { |
| +const char* kBookmarkNamespace = "bookmark"; |
| +const char* kUndefinedNamespace = "undefined"; |
| +const OfflinePageClientPolicy kExpectedBookmarkPolicy = {"bookmark", |
| + {LifetimeType::TEMPORARY, base::TimeDelta::FromDays(7), kUnlimitedPage}}; |
| +} |
| + |
| +TEST(ClientPolicyControllerTest, FallbackTest) { |
| + OfflinePageClientPolicy policy = |
| + ClientPolicyController::GetInstance().GetPolicy(kUndefinedNamespace); |
| + EXPECT_EQ(policy.name_space, kDefaultClientPolicy.name_space); |
| +} |
| + |
| +TEST(ClientPolicyControllerTest, GetPredefinedPolicy) { |
|
fgorski
2016/04/30 17:42:25
Add verification that a policy for last_n is prede
romax
2016/05/02 20:33:44
Done.
|
| + OfflinePageClientPolicy policy = |
| + ClientPolicyController::GetInstance().GetPolicy(kBookmarkNamespace); |
| + EXPECT_EQ(policy.name_space, "bookmark"); |
| +} |
| + |
| +} // namespace offline_pages |
| + |