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

Side by Side Diff: src/default_policy_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698