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

Side by Side 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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/default_policy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <gtest/gtest.h>
6
7 #include "src/default_policy.h"
8
9 namespace cashew {
10
11 // test fixture for DefaultPolicy unit tests
12 class DefaultPolicyTest: public ::testing::Test {
13 protected:
14 DefaultPolicyTest() : policy_(NULL) {}
15
16 virtual ~DefaultPolicyTest() {
17 EXPECT_TRUE(policy_ == NULL);
18 EXPECT_TRUE(old_plans_.empty());
19 EXPECT_TRUE(plans_.empty());
20 }
21
22 virtual void SetUp() {
23 EXPECT_TRUE(policy_ == NULL);
24 policy_ = new(std::nothrow) DefaultPolicy(kTestCarrierName);
25 ASSERT_TRUE(policy_ != NULL);
26 }
27
28 virtual void TearDown() {
29 delete policy_;
30 policy_ = NULL;
31 }
32
33 static const char *kTestCarrierName;
34
35 DefaultPolicy *policy_;
36 DataPlanList old_plans_;
37 DataPlanList plans_;
38 };
39
40 const char *DefaultPolicyTest::kTestCarrierName = "Test Carrier";
41
42 TEST_F(DefaultPolicyTest, GetUpdateTimerIdleSecs) {
43 // we expect the default timer value to be 10 mins = 600 secs
44 // unconditionally (i.e., independent of value of |plans_|) for now
45 EXPECT_EQ(600, policy_->GetUpdateTimerIdleSecs(plans_));
46 }
47
48 TEST_F(DefaultPolicyTest, ShouldEmitDataPlansUpdate) {
49 // we expect the result to be true unconditionally (i.e., independent of the
50 // values of |old_plans_| and |plans_|) for now
51 EXPECT_TRUE(policy_->ShouldEmitDataPlansUpdate(old_plans_, plans_));
52 }
53
54 TEST_F(DefaultPolicyTest, UsageRequestsMustBeSentOTA) {
55 EXPECT_TRUE(policy_->UsageRequestsMustBeSentOTA());
56 }
57
58 TEST_F(DefaultPolicyTest, ZonelessTimeStringsAreLocal) {
59 EXPECT_TRUE(policy_->ZonelessTimeStringsAreLocal());
60 }
61
62 } // namespace cashew
OLDNEW
« 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