shill: cellular: Simplify modem enabling operation.
Instead of first checking the current modem state, this CL changes
CellularCapabilityUniversal::StartModem() to always try to issue the
org.freedesktop.ModemManager1.Modem.Enable DBus call to enable the
modem, regardless of the current modem state. If the Enable call fails
with an org.freedesktop.ModemManager1.Error.Core.WrongState DBus error,
the Enable call is deferred until the modem goes into the Disabled
state.
BUG=chromium:287667
TEST=Tested the following:
1. Build and run unit tests.
2. Run network_3GSmokeTest and network_3GStressEnable tests with E362,
ALT3100 and MU736.
Change-Id: I20349e9ef923473274a0abe2b1b61a3d8223e6af
Reviewed-on: https://chromium-review.googlesource.com/168663
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/cellular_error_unittest.cc b/cellular_error_unittest.cc
index ee8e56a..436ec14 100644
--- a/cellular_error_unittest.cc
+++ b/cellular_error_unittest.cc
@@ -39,6 +39,10 @@
"org.freedesktop.ModemManager1.Error.MobileEquipment."
"GprsServiceOptionNotSubscribed";
+const char kErrorWrongStateMM1[] =
+ "org.freedesktop.ModemManager1.Error.Core.WrongState";
+
+
const char kErrorMessage[] = "Some error message.";
} // namespace
@@ -113,6 +117,11 @@
EXPECT_EQ(Error::kInvalidApn, shill_error.type());
CellularError::FromMM1DBusError(
+ DBus::Error(kErrorWrongStateMM1, kErrorMessage),
+ &shill_error);
+ EXPECT_EQ(Error::kWrongState, shill_error.type());
+
+ CellularError::FromMM1DBusError(
DBus::Error(kErrorIncorrectPasswordMM, kErrorMessage),
&shill_error);
EXPECT_EQ(Error::kOperationFailed, shill_error.type());