shill: Support Cellular CDMA activation.
Still TODO is communicating the activation error codes to the Cellular service.
... And, of course, asynchronous calls throughout.
BUG=chromium-os:19305
TEST=unit tests
Change-Id: I3e0b4a5a8d3c4c74db35ce7f74b5d958677d8b66
Reviewed-on: http://gerrit.chromium.org/gerrit/6192
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
diff --git a/cellular_unittest.cc b/cellular_unittest.cc
index 8d551a7..4fb5a2b 100644
--- a/cellular_unittest.cc
+++ b/cellular_unittest.cc
@@ -229,6 +229,22 @@
device_->GetStateString(Cellular::kStateLinked));
}
+TEST_F(CellularTest, GetCDMAActivationStateString) {
+ EXPECT_EQ("activated",
+ device_->GetCDMAActivationStateString(
+ MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATED));
+ EXPECT_EQ("activating",
+ device_->GetCDMAActivationStateString(
+ MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING));
+ EXPECT_EQ("not-activated",
+ device_->GetCDMAActivationStateString(
+ MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED));
+ EXPECT_EQ("partially-activated",
+ device_->GetCDMAActivationStateString(
+ MM_MODEM_CDMA_ACTIVATION_STATE_PARTIALLY_ACTIVATED));
+ EXPECT_EQ("unknown", device_->GetCDMAActivationStateString(123));
+}
+
TEST_F(CellularTest, Start) {
EXPECT_CALL(*proxy_, Enable(true)).Times(1);
EXPECT_CALL(*simple_proxy_, GetStatus())
@@ -409,4 +425,17 @@
dispatcher_.DispatchPendingEvents();
}
+TEST_F(CellularTest, Activate) {
+ static const char kCarrier[] = "The Cellular Carrier";
+ device_->type_ = Cellular::kTypeCDMA;
+ EXPECT_CALL(*cdma_proxy_, Activate(kCarrier))
+ .WillOnce(Return(MM_MODEM_CDMA_ACTIVATION_ERROR_NO_ERROR));
+ device_->Activate(kCarrier);
+ device_->cdma_proxy_.reset(cdma_proxy_.release());
+ device_->state_ = Cellular::kStateEnabled;
+ dispatcher_.DispatchPendingEvents();
+ EXPECT_EQ(MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING,
+ device_->cdma_.activation_state);
+}
+
} // namespace shill