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

Unified Diff: components/offline_pages/client_policy_controller_unittest.cc

Issue 1934743003: Implementing client policy and controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing build errors. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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
+

Powered by Google App Engine
This is Rietveld 408576698