| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 const base::Closure& success_callback, | 283 const base::Closure& success_callback, |
| 284 const network_handler::ErrorCallback& error_callback) { | 284 const network_handler::ErrorCallback& error_callback) { |
| 285 success_callback.Run(); | 285 success_callback.Run(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 // A fake for MobileActivator::RequestCellularActivation that always fails. | 288 // A fake for MobileActivator::RequestCellularActivation that always fails. |
| 289 void FakeRequestCellularActivationFailure( | 289 void FakeRequestCellularActivationFailure( |
| 290 const NetworkState* network, | 290 const NetworkState* network, |
| 291 const base::Closure& success_callback, | 291 const base::Closure& success_callback, |
| 292 const network_handler::ErrorCallback& error_callback) { | 292 const network_handler::ErrorCallback& error_callback) { |
| 293 scoped_ptr<base::DictionaryValue> value; | 293 std::unique_ptr<base::DictionaryValue> value; |
| 294 error_callback.Run("", std::move(value)); | 294 error_callback.Run("", std::move(value)); |
| 295 } | 295 } |
| 296 | 296 |
| 297 TEST_F(MobileActivatorTest, OTASPScheduling) { | 297 TEST_F(MobileActivatorTest, OTASPScheduling) { |
| 298 const std::string error; | 298 const std::string error; |
| 299 for (size_t i = 0; i < kNumOTASPStates; ++i) { | 299 for (size_t i = 0; i < kNumOTASPStates; ++i) { |
| 300 // When activation works, we start a timer to watch for success. | 300 // When activation works, we start a timer to watch for success. |
| 301 EXPECT_CALL(mobile_activator_, RequestCellularActivation(_, _, _)) | 301 EXPECT_CALL(mobile_activator_, RequestCellularActivation(_, _, _)) |
| 302 .Times(1) | 302 .Times(1) |
| 303 .WillOnce(Invoke(FakeRequestCellularActivationSuccess)); | 303 .WillOnce(Invoke(FakeRequestCellularActivationSuccess)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, | 356 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, |
| 357 mobile_activator_.InvokePickNextState(&cellular_network_, | 357 mobile_activator_.InvokePickNextState(&cellular_network_, |
| 358 &error_description)); | 358 &error_description)); |
| 359 set_activator_state(MobileActivator::PLAN_ACTIVATION_SHOWING_PAYMENT); | 359 set_activator_state(MobileActivator::PLAN_ACTIVATION_SHOWING_PAYMENT); |
| 360 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, | 360 EXPECT_EQ(MobileActivator::PLAN_ACTIVATION_RECONNECTING, |
| 361 mobile_activator_.InvokePickNextState(&cellular_network_, | 361 mobile_activator_.InvokePickNextState(&cellular_network_, |
| 362 &error_description)); | 362 &error_description)); |
| 363 } | 363 } |
| 364 | 364 |
| 365 } // namespace chromeos | 365 } // namespace chromeos |
| OLD | NEW |