OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "chrome/browser/chromeos/mobile/mobile_activator.h" | 5 #include "chrome/browser/chromeos/mobile/mobile_activator.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "chrome/browser/chromeos/cros/network_library.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "chromeos/network/network_handler.h" |
| 10 #include "chromeos/network/network_state.h" |
9 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
12 | 15 |
13 using std::string; | 16 using std::string; |
14 | 17 |
15 using content::BrowserThread; | 18 using content::BrowserThread; |
16 using testing::_; | 19 using testing::_; |
17 using testing::Eq; | 20 using testing::Eq; |
18 using testing::Return; | 21 using testing::Return; |
19 | 22 |
20 namespace { | 23 namespace { |
21 | 24 |
22 const char kTestServicePath[] = "/a/service/path"; | 25 const char kTestServicePath[] = "/a/service/path"; |
23 | 26 |
24 const size_t kNumOTASPStates = 3; | 27 const size_t kNumOTASPStates = 3; |
25 | 28 |
26 chromeos::MobileActivator::PlanActivationState kOTASPStates[kNumOTASPStates] = { | 29 chromeos::MobileActivator::PlanActivationState kOTASPStates[kNumOTASPStates] = { |
27 chromeos::MobileActivator::PLAN_ACTIVATION_TRYING_OTASP, | 30 chromeos::MobileActivator::PLAN_ACTIVATION_TRYING_OTASP, |
28 chromeos::MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, | 31 chromeos::MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, |
29 chromeos::MobileActivator::PLAN_ACTIVATION_OTASP, | 32 chromeos::MobileActivator::PLAN_ACTIVATION_OTASP, |
30 }; | 33 }; |
31 | 34 |
32 } // namespace | 35 } // namespace |
33 namespace chromeos { | 36 namespace chromeos { |
34 | 37 |
35 class TestMobileActivator : public MobileActivator { | 38 class TestMobileActivator : public MobileActivator { |
36 public: | 39 public: |
37 TestMobileActivator(MockNetworkLibrary* mock_network_library, | 40 explicit TestMobileActivator(NetworkState* cellular_network) : |
38 CellularNetwork* cellular_network) | |
39 : mock_network_library_(mock_network_library), | |
40 cellular_network_(cellular_network) { | 41 cellular_network_(cellular_network) { |
41 // Provide reasonable defaults for basic things we're usually not testing. | 42 // Provide reasonable defaults for basic things we're usually not testing. |
42 ON_CALL(*this, DCheckOnThread(_)) | 43 ON_CALL(*this, DCheckOnThread(_)) |
43 .WillByDefault(Return()); | 44 .WillByDefault(Return()); |
44 ON_CALL(*this, FindMatchingCellularNetwork(_)) | 45 ON_CALL(*this, FindMatchingCellularNetwork(_)) |
45 .WillByDefault(Return(cellular_network)); | 46 .WillByDefault(Return(cellular_network)); |
46 ON_CALL(*this, GetNetworkLibrary()) | |
47 .WillByDefault(Return(mock_network_library_)); | |
48 } | 47 } |
49 virtual ~TestMobileActivator() {} | 48 virtual ~TestMobileActivator() {} |
50 | 49 |
51 MOCK_METHOD3(ChangeState, void(CellularNetwork*, | 50 MOCK_METHOD3(ChangeState, void(const NetworkState*, |
52 MobileActivator::PlanActivationState, | 51 MobileActivator::PlanActivationState, |
53 const std::string&)); | 52 const std::string&)); |
54 MOCK_METHOD1(EvaluateCellularNetwork, void(CellularNetwork*)); | 53 MOCK_METHOD1(EvaluateCellularNetwork, void(const NetworkState*)); |
55 MOCK_METHOD1(FindMatchingCellularNetwork, CellularNetwork*(bool)); | 54 MOCK_METHOD1(FindMatchingCellularNetwork, const NetworkState*(bool)); |
| 55 MOCK_METHOD0(SignalCellularPlanPayment, void(void)); |
56 MOCK_METHOD0(StartOTASPTimer, void(void)); | 56 MOCK_METHOD0(StartOTASPTimer, void(void)); |
| 57 MOCK_CONST_METHOD0(HasRecentCellularPlanPayment, bool(void)); |
| 58 MOCK_METHOD1(ActivateCellularModem, bool(const std::string&)); |
57 | 59 |
58 void InvokeChangeState(CellularNetwork* network, | 60 void InvokeChangeState(const NetworkState* network, |
59 MobileActivator::PlanActivationState new_state, | 61 MobileActivator::PlanActivationState new_state, |
60 const std::string& error_description) { | 62 const std::string& error_description) { |
61 MobileActivator::ChangeState(network, new_state, error_description); | 63 MobileActivator::ChangeState(network, new_state, error_description); |
62 } | 64 } |
63 | 65 |
64 private: | 66 private: |
65 MOCK_CONST_METHOD0(GetNetworkLibrary, NetworkLibrary*(void)); | |
66 MOCK_CONST_METHOD1(DCheckOnThread, void(const BrowserThread::ID id)); | 67 MOCK_CONST_METHOD1(DCheckOnThread, void(const BrowserThread::ID id)); |
67 | 68 |
68 MockNetworkLibrary* mock_network_library_; | 69 NetworkState* cellular_network_; |
69 CellularNetwork* cellular_network_; | |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(TestMobileActivator); | 71 DISALLOW_COPY_AND_ASSIGN(TestMobileActivator); |
72 }; | 72 }; |
73 | 73 |
74 class MobileActivatorTest : public testing::Test { | 74 class MobileActivatorTest : public testing::Test { |
75 public: | 75 public: |
76 MobileActivatorTest() | 76 MobileActivatorTest() |
77 : network_library_(), | 77 : cellular_network_(string(kTestServicePath)), |
78 cellular_network_(string(kTestServicePath)), | 78 mobile_activator_(&cellular_network_) { |
79 mobile_activator_(&network_library_, &cellular_network_) {} | 79 } |
80 virtual ~MobileActivatorTest() {} | 80 virtual ~MobileActivatorTest() {} |
81 | 81 |
82 protected: | 82 protected: |
83 virtual void SetUp() {} | 83 virtual void SetUp() { |
84 virtual void TearDown() {} | 84 DBusThreadManager::InitializeWithStub(); |
| 85 NetworkHandler::Initialize(); |
| 86 } |
| 87 virtual void TearDown() { |
| 88 NetworkHandler::Shutdown(); |
| 89 DBusThreadManager::Shutdown(); |
| 90 } |
85 | 91 |
86 void set_activator_state(const MobileActivator::PlanActivationState state) { | 92 void set_activator_state(const MobileActivator::PlanActivationState state) { |
87 mobile_activator_.state_ = state; | 93 mobile_activator_.state_ = state; |
88 } | 94 } |
89 void set_network_activation_state(ActivationState state) { | 95 void set_network_activation_state(const std::string& activation_state) { |
90 cellular_network_.activation_state_ = state; | 96 cellular_network_.activation_state_ = activation_state; |
91 } | 97 } |
92 void set_connection_state(ConnectionState state) { | 98 void set_connection_state(const std::string& state) { |
93 cellular_network_.state_ = state; | 99 cellular_network_.connection_state_ = state; |
94 } | 100 } |
95 | 101 |
96 MockNetworkLibrary network_library_; | 102 base::MessageLoop message_loop_; |
97 MockCellularNetwork cellular_network_; | 103 NetworkState cellular_network_; |
98 TestMobileActivator mobile_activator_; | 104 TestMobileActivator mobile_activator_; |
99 private: | 105 private: |
100 DISALLOW_COPY_AND_ASSIGN(MobileActivatorTest); | 106 DISALLOW_COPY_AND_ASSIGN(MobileActivatorTest); |
101 }; | 107 }; |
102 | 108 |
103 TEST_F(MobileActivatorTest, BasicFlowForNewDevices) { | 109 TEST_F(MobileActivatorTest, BasicFlowForNewDevices) { |
104 // In a new device, we aren't connected to Verizon, we start at START | 110 // In a new device, we aren't connected to Verizon, we start at START |
105 // because we haven't paid Verizon (ever), and the modem isn't even partially | 111 // because we haven't paid Verizon (ever), and the modem isn't even partially |
106 // activated. | 112 // activated. |
107 std::string error_description; | 113 std::string error_description; |
108 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); | 114 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); |
109 set_connection_state(STATE_IDLE); | 115 set_connection_state(flimflam::kStateIdle); |
110 set_network_activation_state(ACTIVATION_STATE_NOT_ACTIVATED); | 116 set_network_activation_state(flimflam::kActivationStateNotActivated); |
111 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, | 117 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, |
112 mobile_activator_.PickNextState(&cellular_network_, | 118 mobile_activator_.PickNextState(&cellular_network_, |
113 &error_description)); | 119 &error_description)); |
114 // Now behave as if ChangeState() has initiated an activation. | 120 // Now behave as if ChangeState() has initiated an activation. |
115 set_activator_state(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION); | 121 set_activator_state(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION); |
116 set_network_activation_state(ACTIVATION_STATE_ACTIVATING); | 122 set_network_activation_state(flimflam::kActivationStateActivating); |
117 // We'll sit in this state while we wait for the OTASP to finish. | 123 // We'll sit in this state while we wait for the OTASP to finish. |
118 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, | 124 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, |
119 mobile_activator_.PickNextState(&cellular_network_, | 125 mobile_activator_.PickNextState(&cellular_network_, |
120 &error_description)); | 126 &error_description)); |
121 set_network_activation_state(ACTIVATION_STATE_PARTIALLY_ACTIVATED); | 127 set_network_activation_state(flimflam::kActivationStatePartiallyActivated); |
122 // We'll sit in this state until we go online as well. | 128 // We'll sit in this state until we go online as well. |
123 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, | 129 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_INITIATING_ACTIVATION, |
124 mobile_activator_.PickNextState(&cellular_network_, | 130 mobile_activator_.PickNextState(&cellular_network_, |
125 &error_description)); | 131 &error_description)); |
126 set_connection_state(STATE_PORTAL); | 132 set_connection_state(flimflam::kStatePortal); |
127 // After we go online, we go back to START, which acts as a jumping off | 133 // After we go online, we go back to START, which acts as a jumping off |
128 // point for the two types of initial OTASP. | 134 // point for the two types of initial OTASP. |
129 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_START, | 135 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_START, |
130 mobile_activator_.PickNextState(&cellular_network_, | 136 mobile_activator_.PickNextState(&cellular_network_, |
131 &error_description)); | 137 &error_description)); |
132 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); | 138 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); |
133 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_TRYING_OTASP, | 139 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_TRYING_OTASP, |
134 mobile_activator_.PickNextState(&cellular_network_, | 140 mobile_activator_.PickNextState(&cellular_network_, |
135 &error_description)); | 141 &error_description)); |
136 // Very similar things happen while we're trying OTASP. | 142 // Very similar things happen while we're trying OTASP. |
137 set_activator_state(MobileActivator::PLAN_ACTIVATION_TRYING_OTASP); | 143 set_activator_state(MobileActivator::PLAN_ACTIVATION_TRYING_OTASP); |
138 set_network_activation_state(ACTIVATION_STATE_ACTIVATING); | 144 set_network_activation_state(flimflam::kActivationStateActivating); |
139 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_TRYING_OTASP, | 145 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_TRYING_OTASP, |
140 mobile_activator_.PickNextState(&cellular_network_, | 146 mobile_activator_.PickNextState(&cellular_network_, |
141 &error_description)); | 147 &error_description)); |
142 set_network_activation_state(ACTIVATION_STATE_PARTIALLY_ACTIVATED); | 148 set_network_activation_state(flimflam::kActivationStatePartiallyActivated); |
143 set_connection_state(STATE_PORTAL); | 149 set_connection_state(flimflam::kStatePortal); |
144 // And when we come back online again and aren't activating, load the portal. | 150 // And when we come back online again and aren't activating, load the portal. |
145 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING, | 151 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING, |
146 mobile_activator_.PickNextState(&cellular_network_, | 152 mobile_activator_.PickNextState(&cellular_network_, |
147 &error_description)); | 153 &error_description)); |
148 // The JS drives us through the payment portal. | 154 // The JS drives us through the payment portal. |
149 set_activator_state(MobileActivator::PLAN_ACTIVATION_SHOWING_PAYMENT); | 155 set_activator_state(MobileActivator::PLAN_ACTIVATION_SHOWING_PAYMENT); |
150 // The JS also calls us to signal that the portal is done. This triggers us | 156 // The JS also calls us to signal that the portal is done. This triggers us |
151 // to start our final OTASP via the aptly named StartOTASP(). | 157 // to start our final OTASP via the aptly named StartOTASP(). |
152 EXPECT_CALL(network_library_, SignalCellularPlanPayment()); | 158 EXPECT_CALL(mobile_activator_, SignalCellularPlanPayment()); |
153 EXPECT_CALL(mobile_activator_, | 159 EXPECT_CALL(mobile_activator_, |
154 ChangeState(Eq(&cellular_network_), | 160 ChangeState(Eq(&cellular_network_), |
155 Eq(MobileActivator::PLAN_ACTIVATION_START_OTASP), | 161 Eq(MobileActivator::PLAN_ACTIVATION_START_OTASP), |
156 _)); | 162 _)); |
157 EXPECT_CALL(mobile_activator_, | 163 EXPECT_CALL(mobile_activator_, |
158 EvaluateCellularNetwork(Eq(&cellular_network_))); | 164 EvaluateCellularNetwork(Eq(&cellular_network_))); |
159 mobile_activator_.HandleSetTransactionStatus(true); | 165 mobile_activator_.HandleSetTransactionStatus(true); |
160 // Evaluate state will defer to PickNextState to select what to do now that | 166 // Evaluate state will defer to PickNextState to select what to do now that |
161 // we're in START_ACTIVATION. PickNextState should decide to start a final | 167 // we're in START_ACTIVATION. PickNextState should decide to start a final |
162 // OTASP. | 168 // OTASP. |
163 set_activator_state(MobileActivator::PLAN_ACTIVATION_START_OTASP); | 169 set_activator_state(MobileActivator::PLAN_ACTIVATION_START_OTASP); |
164 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_OTASP, | 170 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_OTASP, |
165 mobile_activator_.PickNextState(&cellular_network_, | 171 mobile_activator_.PickNextState(&cellular_network_, |
166 &error_description)); | 172 &error_description)); |
167 // Similarly to TRYING_OTASP and INITIATING_OTASP above... | 173 // Similarly to TRYING_OTASP and INITIATING_OTASP above... |
168 set_activator_state(MobileActivator::PLAN_ACTIVATION_OTASP); | 174 set_activator_state(MobileActivator::PLAN_ACTIVATION_OTASP); |
169 set_network_activation_state(ACTIVATION_STATE_ACTIVATING); | 175 set_network_activation_state(flimflam::kActivationStateActivating); |
170 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_OTASP, | 176 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_OTASP, |
171 mobile_activator_.PickNextState(&cellular_network_, | 177 mobile_activator_.PickNextState(&cellular_network_, |
172 &error_description)); | 178 &error_description)); |
173 set_network_activation_state(ACTIVATION_STATE_ACTIVATED); | 179 set_network_activation_state(flimflam::kActivationStateActivated); |
174 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_DONE, | 180 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_DONE, |
175 mobile_activator_.PickNextState(&cellular_network_, | 181 mobile_activator_.PickNextState(&cellular_network_, |
176 &error_description)); | 182 &error_description)); |
177 } | 183 } |
178 | 184 |
179 TEST_F(MobileActivatorTest, OTASPScheduling) { | 185 TEST_F(MobileActivatorTest, OTASPScheduling) { |
180 const std::string error; | 186 const std::string error; |
181 for (size_t i = 0; i < kNumOTASPStates; ++i) { | 187 for (size_t i = 0; i < kNumOTASPStates; ++i) { |
182 // When activation works, we start a timer to watch for success. | 188 // When activation works, we start a timer to watch for success. |
183 EXPECT_CALL(cellular_network_, StartActivation()) | 189 EXPECT_CALL(mobile_activator_, ActivateCellularModem(_)) |
184 .Times(1) | 190 .Times(1) |
185 .WillOnce(Return(true)); | 191 .WillOnce(Return(true)); |
186 EXPECT_CALL(mobile_activator_, StartOTASPTimer()) | 192 EXPECT_CALL(mobile_activator_, StartOTASPTimer()) |
187 .Times(1); | 193 .Times(1); |
188 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); | 194 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); |
189 mobile_activator_.InvokeChangeState(&cellular_network_, | 195 mobile_activator_.InvokeChangeState(&cellular_network_, |
190 kOTASPStates[i], | 196 kOTASPStates[i], |
191 error); | 197 error); |
192 // When activation fails, it's an error, unless we're trying for the final | 198 // When activation fails, it's an error, unless we're trying for the final |
193 // OTASP, in which case we try again via DELAY_OTASP. | 199 // OTASP, in which case we try again via DELAY_OTASP. |
194 EXPECT_CALL(cellular_network_, StartActivation()) | 200 EXPECT_CALL(mobile_activator_, ActivateCellularModem(_)) |
195 .Times(1) | 201 .Times(1) |
196 .WillOnce(Return(false)); | 202 .WillOnce(Return(false)); |
197 if (kOTASPStates[i] == MobileActivator::PLAN_ACTIVATION_OTASP) { | 203 if (kOTASPStates[i] == MobileActivator::PLAN_ACTIVATION_OTASP) { |
198 EXPECT_CALL(mobile_activator_, ChangeState( | 204 EXPECT_CALL(mobile_activator_, ChangeState( |
199 Eq(&cellular_network_), | 205 Eq(&cellular_network_), |
200 Eq(MobileActivator::PLAN_ACTIVATION_DELAY_OTASP), | 206 Eq(MobileActivator::PLAN_ACTIVATION_DELAY_OTASP), |
201 _)); | 207 _)); |
202 } else { | 208 } else { |
203 EXPECT_CALL(mobile_activator_, ChangeState( | 209 EXPECT_CALL(mobile_activator_, ChangeState( |
204 Eq(&cellular_network_), | 210 Eq(&cellular_network_), |
205 Eq(MobileActivator::PLAN_ACTIVATION_ERROR), | 211 Eq(MobileActivator::PLAN_ACTIVATION_ERROR), |
206 _)); | 212 _)); |
207 } | 213 } |
208 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); | 214 set_activator_state(MobileActivator::PLAN_ACTIVATION_START); |
209 mobile_activator_.InvokeChangeState(&cellular_network_, | 215 mobile_activator_.InvokeChangeState(&cellular_network_, |
210 kOTASPStates[i], | 216 kOTASPStates[i], |
211 error); | 217 error); |
212 } | 218 } |
213 } | 219 } |
214 | 220 |
215 TEST_F(MobileActivatorTest, ReconnectOnDisconnectFromPaymentPortal) { | 221 TEST_F(MobileActivatorTest, ReconnectOnDisconnectFromPaymentPortal) { |
216 // Most states either don't care if we're offline or expect to be offline at | 222 // Most states either don't care if we're offline or expect to be offline at |
217 // some point. For instance the OTASP states expect to go offline during | 223 // some point. For instance the OTASP states expect to go offline during |
218 // activation and eventually come back. There are a few transitions states | 224 // activation and eventually come back. There are a few transitions states |
219 // like START_OTASP and DELAY_OTASP which don't really depend on the state of | 225 // like START_OTASP and DELAY_OTASP which don't really depend on the state of |
220 // the modem (offline or online) to work correctly. A few places however, | 226 // the modem (offline or online) to work correctly. A few places however, |
221 // like when we're displaying the portal care quite a bit about going | 227 // like when we're displaying the portal care quite a bit about going |
222 // offline. Lets test for those cases. | 228 // offline. Lets test for those cases. |
223 std::string error_description; | 229 std::string error_description; |
224 set_connection_state(STATE_FAILURE); | 230 set_connection_state(flimflam::kStateFailure); |
225 set_network_activation_state(ACTIVATION_STATE_PARTIALLY_ACTIVATED); | 231 set_network_activation_state(flimflam::kActivationStatePartiallyActivated); |
226 set_activator_state(MobileActivator::PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING); | 232 set_activator_state(MobileActivator::PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING); |
227 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, | 233 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, |
228 mobile_activator_.PickNextState(&cellular_network_, | 234 mobile_activator_.PickNextState(&cellular_network_, |
229 &error_description)); | 235 &error_description)); |
230 set_activator_state(MobileActivator::PLAN_ACTIVATION_SHOWING_PAYMENT); | 236 set_activator_state(MobileActivator::PLAN_ACTIVATION_SHOWING_PAYMENT); |
231 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, | 237 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, |
232 mobile_activator_.PickNextState(&cellular_network_, | 238 mobile_activator_.PickNextState(&cellular_network_, |
233 &error_description)); | 239 &error_description)); |
234 } | 240 } |
235 | 241 |
236 TEST_F(MobileActivatorTest, StartAtStart) { | 242 TEST_F(MobileActivatorTest, StartAtStart) { |
237 EXPECT_CALL(network_library_, | 243 EXPECT_CALL(mobile_activator_, HasRecentCellularPlanPayment()) |
238 AddNetworkManagerObserver(Eq(&mobile_activator_))); | 244 .WillOnce(Return(false)); |
239 EXPECT_CALL(network_library_, HasRecentCellularPlanPayment()). | |
240 WillOnce(Return(false)); | |
241 EXPECT_CALL(mobile_activator_, | 245 EXPECT_CALL(mobile_activator_, |
242 EvaluateCellularNetwork(Eq(&cellular_network_))); | 246 EvaluateCellularNetwork(Eq(&cellular_network_))); |
243 mobile_activator_.StartActivation(); | 247 mobile_activator_.StartActivation(); |
244 EXPECT_EQ(mobile_activator_.state(), MobileActivator::PLAN_ACTIVATION_START); | 248 EXPECT_EQ(mobile_activator_.state(), MobileActivator::PLAN_ACTIVATION_START); |
245 } | 249 } |
246 | 250 |
247 } // namespace chromeos | 251 } // namespace chromeos |
OLD | NEW |