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

Unified Diff: src/default_policy_unittest.cc

Issue 4201001: cashew: default policy: reduce request timer frequency (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git
Patch Set: Created 10 years, 2 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
« no previous file with comments | « src/default_policy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/default_policy_unittest.cc
diff --git a/src/default_policy_unittest.cc b/src/default_policy_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b616d0a4129f2c3fda587d5fd15b5925e6717118
--- /dev/null
+++ b/src/default_policy_unittest.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2010 The Chromium OS 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 <gtest/gtest.h>
+
+#include "src/default_policy.h"
+
+namespace cashew {
+
+// test fixture for DefaultPolicy unit tests
+class DefaultPolicyTest: public ::testing::Test {
+ protected:
+ DefaultPolicyTest() : policy_(NULL) {}
+
+ virtual ~DefaultPolicyTest() {
+ EXPECT_TRUE(policy_ == NULL);
+ EXPECT_TRUE(old_plans_.empty());
+ EXPECT_TRUE(plans_.empty());
+ }
+
+ virtual void SetUp() {
+ EXPECT_TRUE(policy_ == NULL);
+ policy_ = new(std::nothrow) DefaultPolicy(kTestCarrierName);
+ ASSERT_TRUE(policy_ != NULL);
+ }
+
+ virtual void TearDown() {
+ delete policy_;
+ policy_ = NULL;
+ }
+
+ static const char *kTestCarrierName;
+
+ DefaultPolicy *policy_;
+ DataPlanList old_plans_;
+ DataPlanList plans_;
+};
+
+const char *DefaultPolicyTest::kTestCarrierName = "Test Carrier";
+
+TEST_F(DefaultPolicyTest, GetUpdateTimerIdleSecs) {
+ // we expect the default timer value to be 10 mins = 600 secs
+ // unconditionally (i.e., independent of value of |plans_|) for now
+ EXPECT_EQ(600, policy_->GetUpdateTimerIdleSecs(plans_));
+}
+
+TEST_F(DefaultPolicyTest, ShouldEmitDataPlansUpdate) {
+ // we expect the result to be true unconditionally (i.e., independent of the
+ // values of |old_plans_| and |plans_|) for now
+ EXPECT_TRUE(policy_->ShouldEmitDataPlansUpdate(old_plans_, plans_));
+}
+
+TEST_F(DefaultPolicyTest, UsageRequestsMustBeSentOTA) {
+ EXPECT_TRUE(policy_->UsageRequestsMustBeSentOTA());
+}
+
+TEST_F(DefaultPolicyTest, ZonelessTimeStringsAreLocal) {
+ EXPECT_TRUE(policy_->ZonelessTimeStringsAreLocal());
+}
+
+} // namespace cashew
« no previous file with comments | « src/default_policy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698