Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/cellular.h" |
| 6 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 7 | #include <sys/socket.h> |
| 8 | #include <linux/if.h> |
| 9 | #include <linux/netlink.h> // Needs typedefs from sys/socket.h. |
| 10 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 11 | #include <base/bind.h> |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 12 | #include <chromeos/dbus/service_constants.h> |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 13 | #include <mm/mm-modem.h> |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 14 | #include <mobile_provider.h> |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 15 | |
Darin Petkov | ae0c64e | 2011-11-15 15:50:27 +0100 | [diff] [blame] | 16 | #include "shill/cellular_capability_cdma.h" |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 17 | #include "shill/cellular_capability_classic.h" |
Darin Petkov | 184c54e | 2011-11-15 12:44:39 +0100 | [diff] [blame] | 18 | #include "shill/cellular_capability_gsm.h" |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 19 | #include "shill/cellular_service.h" |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 20 | #include "shill/error.h" |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 21 | #include "shill/event_dispatcher.h" |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 22 | #include "shill/mock_cellular_service.h" |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 23 | #include "shill/mock_device_info.h" |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 24 | #include "shill/mock_dhcp_config.h" |
| 25 | #include "shill/mock_dhcp_provider.h" |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 26 | #include "shill/mock_manager.h" |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 27 | #include "shill/mock_metrics.h" |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 28 | #include "shill/mock_modem_cdma_proxy.h" |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 29 | #include "shill/mock_modem_gsm_card_proxy.h" |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 30 | #include "shill/mock_modem_gsm_network_proxy.h" |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 31 | #include "shill/mock_modem_proxy.h" |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 32 | #include "shill/mock_modem_simple_proxy.h" |
mukesh agrawal | 5c4dd0b | 2011-09-14 13:53:14 -0700 | [diff] [blame] | 33 | #include "shill/mock_rtnl_handler.h" |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 34 | #include "shill/nice_mock_control.h" |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 35 | #include "shill/property_store_unittest.h" |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 36 | #include "shill/proxy_factory.h" |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 37 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 38 | using base::Bind; |
| 39 | using base::Unretained; |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 40 | using std::map; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 41 | using std::string; |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 42 | using std::vector; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 43 | using testing::_; |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 44 | using testing::AnyNumber; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 45 | using testing::Invoke; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 46 | using testing::NiceMock; |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 47 | using testing::Return; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 48 | using testing::SetArgumentPointee; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 49 | using testing::Unused; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 50 | |
| 51 | namespace shill { |
| 52 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 53 | MATCHER(IsSuccess, "") { |
| 54 | return arg.IsSuccess(); |
| 55 | } |
| 56 | |
Gary Morain | baeefdf | 2012-04-30 14:53:35 -0700 | [diff] [blame] | 57 | MATCHER(IsFailure, "") { |
| 58 | return arg.IsFailure(); |
| 59 | } |
| 60 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 61 | class CellularPropertyTest : public PropertyStoreTest { |
| 62 | public: |
| 63 | CellularPropertyTest() |
Chris Masone | 2176a88 | 2011-09-14 22:29:15 -0700 | [diff] [blame] | 64 | : device_(new Cellular(control_interface(), |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 65 | NULL, |
| 66 | NULL, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 67 | NULL, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 68 | "usb0", |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 69 | "00:01:02:03:04:05", |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 70 | 3, |
| 71 | Cellular::kTypeGSM, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 72 | "", |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 73 | "", |
| 74 | NULL)) {} |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 75 | virtual ~CellularPropertyTest() {} |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 76 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 77 | protected: |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 78 | DeviceRefPtr device_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 79 | }; |
| 80 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 81 | TEST_F(CellularPropertyTest, Contains) { |
mukesh agrawal | de29fa8 | 2011-09-16 16:16:36 -0700 | [diff] [blame] | 82 | EXPECT_TRUE(device_->store().Contains(flimflam::kNameProperty)); |
| 83 | EXPECT_FALSE(device_->store().Contains("")); |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 84 | } |
| 85 | |
mukesh agrawal | 6bb9e7c | 2012-01-30 14:57:54 -0800 | [diff] [blame] | 86 | TEST_F(CellularPropertyTest, SetProperty) { |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 87 | { |
| 88 | ::DBus::Error error; |
mukesh agrawal | 6bb9e7c | 2012-01-30 14:57:54 -0800 | [diff] [blame] | 89 | EXPECT_TRUE(DBusAdaptor::SetProperty( |
mukesh agrawal | de29fa8 | 2011-09-16 16:16:36 -0700 | [diff] [blame] | 90 | device_->mutable_store(), |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 91 | flimflam::kCellularAllowRoamingProperty, |
| 92 | PropertyStoreTest::kBoolV, |
| 93 | &error)); |
| 94 | } |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 95 | // Ensure that attempting to write a R/O property returns InvalidArgs error. |
| 96 | { |
| 97 | ::DBus::Error error; |
mukesh agrawal | 6bb9e7c | 2012-01-30 14:57:54 -0800 | [diff] [blame] | 98 | EXPECT_FALSE(DBusAdaptor::SetProperty(device_->mutable_store(), |
| 99 | flimflam::kAddressProperty, |
| 100 | PropertyStoreTest::kStringV, |
| 101 | &error)); |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 102 | EXPECT_EQ(invalid_args(), error.name()); |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 103 | } |
| 104 | { |
| 105 | ::DBus::Error error; |
mukesh agrawal | 6bb9e7c | 2012-01-30 14:57:54 -0800 | [diff] [blame] | 106 | EXPECT_FALSE(DBusAdaptor::SetProperty(device_->mutable_store(), |
| 107 | flimflam::kCarrierProperty, |
| 108 | PropertyStoreTest::kStringV, |
| 109 | &error)); |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 110 | EXPECT_EQ(invalid_args(), error.name()); |
Chris Masone | a8a2c25 | 2011-06-27 22:16:30 -0700 | [diff] [blame] | 111 | } |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 112 | } |
| 113 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 114 | class CellularTest : public testing::Test { |
| 115 | public: |
| 116 | CellularTest() |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 117 | : manager_(&control_interface_, &dispatcher_, &metrics_, &glib_), |
| 118 | device_info_(&control_interface_, &dispatcher_, &metrics_, &manager_), |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 119 | dhcp_config_(new MockDHCPConfig(&control_interface_, |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 120 | kTestDeviceName)), |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 121 | device_(new Cellular(&control_interface_, |
| 122 | &dispatcher_, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 123 | &metrics_, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 124 | &manager_, |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 125 | kTestDeviceName, |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 126 | kTestDeviceAddress, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 127 | 3, |
| 128 | Cellular::kTypeGSM, |
| 129 | kDBusOwner, |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 130 | kDBusPath, |
| 131 | NULL)), |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 132 | proxy_(new MockModemProxy()), |
| 133 | simple_proxy_(new MockModemSimpleProxy()), |
| 134 | cdma_proxy_(new MockModemCDMAProxy()), |
| 135 | gsm_card_proxy_(new MockModemGSMCardProxy()), |
| 136 | gsm_network_proxy_(new MockModemGSMNetworkProxy()), |
| 137 | proxy_factory_(this), |
| 138 | provider_db_(NULL) { |
| 139 | device_->capability_->proxy_factory_ = &proxy_factory_; |
| 140 | } |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 141 | |
| 142 | virtual ~CellularTest() { |
| 143 | mobile_provider_close_db(provider_db_); |
| 144 | provider_db_ = NULL; |
| 145 | } |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 146 | |
| 147 | virtual void SetUp() { |
mukesh agrawal | 5c4dd0b | 2011-09-14 13:53:14 -0700 | [diff] [blame] | 148 | static_cast<Device *>(device_)->rtnl_handler_ = &rtnl_handler_; |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 149 | device_->set_dhcp_provider(&dhcp_provider_); |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 150 | EXPECT_CALL(manager_, device_info()).WillRepeatedly(Return(&device_info_)); |
Chris Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame] | 151 | EXPECT_CALL(manager_, DeregisterService(_)).Times(AnyNumber()); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | virtual void TearDown() { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 155 | device_->DestroyIPConfig(); |
Darin Petkov | fb0625e | 2012-01-16 13:05:56 +0100 | [diff] [blame] | 156 | device_->state_ = Cellular::kStateDisabled; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 157 | device_->capability_->ReleaseProxies(); |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 158 | device_->set_dhcp_provider(NULL); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 159 | } |
| 160 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 161 | void InvokeEnable(bool enable, Error *error, |
| 162 | const ResultCallback &callback, int timeout) { |
| 163 | callback.Run(Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 164 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 165 | void InvokeGetSignalQuality(Error *error, |
| 166 | const SignalQualityCallback &callback, |
| 167 | int timeout) { |
| 168 | callback.Run(kStrength, Error()); |
| 169 | } |
| 170 | void InvokeGetModemStatus(Error *error, |
| 171 | const DBusPropertyMapCallback &callback, |
| 172 | int timeout) { |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 173 | DBusPropertiesMap props; |
| 174 | props["carrier"].writer().append_string(kTestCarrier); |
| 175 | props["unknown-property"].writer().append_string("irrelevant-value"); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 176 | callback.Run(props, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 177 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 178 | void InvokeGetModemInfo(Error *error, const ModemInfoCallback &callback, |
| 179 | int timeout) { |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 180 | static const char kManufacturer[] = "Company"; |
| 181 | static const char kModelID[] = "Gobi 2000"; |
| 182 | static const char kHWRev[] = "A00B1234"; |
| 183 | ModemHardwareInfo info; |
| 184 | info._1 = kManufacturer; |
| 185 | info._2 = kModelID; |
| 186 | info._3 = kHWRev; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 187 | callback.Run(info, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 188 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 189 | void InvokeGetRegistrationState1X(Error *error, |
| 190 | const RegistrationStateCallback &callback, |
| 191 | int timeout) { |
| 192 | callback.Run(MM_MODEM_CDMA_REGISTRATION_STATE_HOME, |
| 193 | MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, |
| 194 | Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 195 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 196 | void InvokeGetIMEI(Error *error, const GSMIdentifierCallback &callback, |
| 197 | int timeout) { |
| 198 | callback.Run(kIMEI, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 199 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 200 | void InvokeGetIMSI(Error *error, const GSMIdentifierCallback &callback, |
| 201 | int timeout) { |
| 202 | callback.Run(kIMSI, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 203 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 204 | void InvokeGetMSISDN(Error *error, const GSMIdentifierCallback &callback, |
| 205 | int timeout) { |
| 206 | callback.Run(kMSISDN, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 207 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 208 | void InvokeGetSPN(Error *error, const GSMIdentifierCallback &callback, |
| 209 | int timeout) { |
| 210 | callback.Run(kTestCarrier, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 211 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 212 | void InvokeGetRegistrationInfo(Error *error, |
| 213 | const RegistrationInfoCallback &callback, |
| 214 | int timeout) { |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 215 | static const char kNetworkID[] = "22803"; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 216 | callback.Run(MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING, |
| 217 | kNetworkID, kTestCarrier, Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 218 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 219 | void InvokeRegister(const string &network_id, |
| 220 | Error *error, |
| 221 | const ResultCallback &callback, |
| 222 | int timeout) { |
| 223 | callback.Run(Error()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 224 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 225 | void InvokeGetRegistrationState(Error *error, |
| 226 | const RegistrationStateCallback &callback, |
| 227 | int timeout) { |
| 228 | callback.Run(MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED, |
| 229 | MM_MODEM_CDMA_REGISTRATION_STATE_HOME, |
| 230 | Error()); |
| 231 | } |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 232 | void InvokeGetRegistrationStateUnregistered( |
| 233 | Error *error, |
| 234 | const RegistrationStateCallback &callback, |
| 235 | int timeout) { |
| 236 | callback.Run(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, |
| 237 | MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, |
| 238 | Error()); |
| 239 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 240 | void InvokeConnect(DBusPropertiesMap props, Error *error, |
| 241 | const ResultCallback &callback, int timeout) { |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 242 | EXPECT_EQ(Service::kStateAssociating, device_->service_->state()); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 243 | callback.Run(Error()); |
| 244 | } |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 245 | void InvokeConnectFail(DBusPropertiesMap props, Error *error, |
| 246 | const ResultCallback &callback, int timeout) { |
| 247 | EXPECT_EQ(Service::kStateAssociating, device_->service_->state()); |
| 248 | callback.Run(Error(Error::kNotOnHomeNetwork)); |
| 249 | } |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 250 | void InvokeDisconnect(Error *error, const ResultCallback &callback, |
| 251 | int timeout) { |
| 252 | if (!callback.is_null()) |
| 253 | callback.Run(Error()); |
| 254 | } |
| 255 | |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 256 | void ExpectCdmaStartModem(string network_technology) { |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 257 | if (!device_->IsUnderlyingDeviceEnabled()) |
| 258 | EXPECT_CALL(*proxy_, |
| 259 | Enable(true, _, _, CellularCapability::kTimeoutEnable)) |
| 260 | .WillOnce(Invoke(this, &CellularTest::InvokeEnable)); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 261 | EXPECT_CALL(*simple_proxy_, |
| 262 | GetModemStatus(_, _, CellularCapability::kTimeoutDefault)) |
| 263 | .WillOnce(Invoke(this, &CellularTest::InvokeGetModemStatus)); |
| 264 | EXPECT_CALL(*proxy_, |
| 265 | GetModemInfo(_, _, CellularCapability::kTimeoutDefault)) |
| 266 | .WillOnce(Invoke(this, &CellularTest::InvokeGetModemInfo)); |
| 267 | if (network_technology == flimflam::kNetworkTechnology1Xrtt) |
| 268 | EXPECT_CALL(*cdma_proxy_, GetRegistrationState(NULL, _, _)) |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 269 | .WillOnce(Invoke(this, &CellularTest::InvokeGetRegistrationState1X)); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 270 | else |
| 271 | EXPECT_CALL(*cdma_proxy_, GetRegistrationState(NULL, _, _)) |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 272 | .WillOnce(Invoke(this, &CellularTest::InvokeGetRegistrationState)); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 273 | EXPECT_CALL(*cdma_proxy_, GetSignalQuality(NULL, _, _)) |
| 274 | .Times(2) |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 275 | .WillRepeatedly(Invoke(this, &CellularTest::InvokeGetSignalQuality)); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 276 | EXPECT_CALL(*this, TestCallback(IsSuccess())); |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 277 | EXPECT_CALL(manager_, RegisterService(_)); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 278 | } |
| 279 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 280 | MOCK_METHOD1(TestCallback, void(const Error &error)); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 281 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 282 | protected: |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 283 | static const char kTestDeviceName[]; |
| 284 | static const char kTestDeviceAddress[]; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 285 | static const char kDBusOwner[]; |
| 286 | static const char kDBusPath[]; |
| 287 | static const char kTestCarrier[]; |
| 288 | static const char kMEID[]; |
| 289 | static const char kIMEI[]; |
| 290 | static const char kIMSI[]; |
| 291 | static const char kMSISDN[]; |
| 292 | static const char kTestMobileProviderDBPath[]; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 293 | static const int kStrength; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 294 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 295 | class TestProxyFactory : public ProxyFactory { |
| 296 | public: |
Paul Stewart | 7355ce1 | 2011-09-02 10:47:01 -0700 | [diff] [blame] | 297 | explicit TestProxyFactory(CellularTest *test) : test_(test) {} |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 298 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 299 | virtual ModemProxyInterface *CreateModemProxy( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 300 | const string &/*path*/, |
| 301 | const string &/*service*/) { |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 302 | return test_->proxy_.release(); |
| 303 | } |
| 304 | |
| 305 | virtual ModemSimpleProxyInterface *CreateModemSimpleProxy( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 306 | const string &/*path*/, |
| 307 | const string &/*service*/) { |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 308 | return test_->simple_proxy_.release(); |
| 309 | } |
| 310 | |
| 311 | virtual ModemCDMAProxyInterface *CreateModemCDMAProxy( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 312 | const string &/*path*/, |
| 313 | const string &/*service*/) { |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 314 | return test_->cdma_proxy_.release(); |
| 315 | } |
| 316 | |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 317 | virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 318 | const string &/*path*/, |
| 319 | const string &/*service*/) { |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 320 | return test_->gsm_card_proxy_.release(); |
| 321 | } |
| 322 | |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 323 | virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 324 | const string &/*path*/, |
| 325 | const string &/*service*/) { |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 326 | return test_->gsm_network_proxy_.release(); |
| 327 | } |
| 328 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 329 | private: |
| 330 | CellularTest *test_; |
| 331 | }; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 332 | void StartRTNLHandler(); |
| 333 | void StopRTNLHandler(); |
| 334 | |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 335 | void SetCellularType(Cellular::Type type) { |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 336 | device_->InitCapability(type, &proxy_factory_); |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 337 | } |
| 338 | |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 339 | CellularCapabilityClassic *GetCapabilityClassic() { |
| 340 | return dynamic_cast<CellularCapabilityClassic *>( |
| 341 | device_->capability_.get()); |
| 342 | } |
| 343 | |
Darin Petkov | ae0c64e | 2011-11-15 15:50:27 +0100 | [diff] [blame] | 344 | CellularCapabilityCDMA *GetCapabilityCDMA() { |
| 345 | return dynamic_cast<CellularCapabilityCDMA *>(device_->capability_.get()); |
| 346 | } |
| 347 | |
| 348 | CellularCapabilityGSM *GetCapabilityGSM() { |
| 349 | return dynamic_cast<CellularCapabilityGSM *>(device_->capability_.get()); |
| 350 | } |
| 351 | |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 352 | NiceMockControl control_interface_; |
mukesh agrawal | 5c4dd0b | 2011-09-14 13:53:14 -0700 | [diff] [blame] | 353 | EventDispatcher dispatcher_; |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 354 | MockMetrics metrics_; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 355 | MockGLib glib_; |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 356 | MockManager manager_; |
| 357 | MockDeviceInfo device_info_; |
mukesh agrawal | 5c4dd0b | 2011-09-14 13:53:14 -0700 | [diff] [blame] | 358 | NiceMock<MockRTNLHandler> rtnl_handler_; |
| 359 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 360 | MockDHCPProvider dhcp_provider_; |
| 361 | scoped_refptr<MockDHCPConfig> dhcp_config_; |
| 362 | |
| 363 | CellularRefPtr device_; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 364 | scoped_ptr<MockModemProxy> proxy_; |
| 365 | scoped_ptr<MockModemSimpleProxy> simple_proxy_; |
| 366 | scoped_ptr<MockModemCDMAProxy> cdma_proxy_; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 367 | scoped_ptr<MockModemGSMCardProxy> gsm_card_proxy_; |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 368 | scoped_ptr<MockModemGSMNetworkProxy> gsm_network_proxy_; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 369 | TestProxyFactory proxy_factory_; |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 370 | mobile_provider_db *provider_db_; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 371 | }; |
| 372 | |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 373 | const char CellularTest::kTestDeviceName[] = "usb0"; |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 374 | const char CellularTest::kTestDeviceAddress[] = "00:01:02:03:04:05"; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 375 | const char CellularTest::kDBusOwner[] = ":1.19"; |
| 376 | const char CellularTest::kDBusPath[] = "/org/chromium/ModemManager/Gobi/0"; |
Darin Petkov | 5148900 | 2011-08-18 13:13:20 -0700 | [diff] [blame] | 377 | const char CellularTest::kTestCarrier[] = "The Cellular Carrier"; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 378 | const char CellularTest::kMEID[] = "01234567EF8901"; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 379 | const char CellularTest::kIMEI[] = "987654321098765"; |
| 380 | const char CellularTest::kIMSI[] = "123456789012345"; |
| 381 | const char CellularTest::kMSISDN[] = "12345678901"; |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 382 | const char CellularTest::kTestMobileProviderDBPath[] = |
| 383 | "provider_db_unittest.bfd"; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 384 | const int CellularTest::kStrength = 90; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 385 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 386 | TEST_F(CellularTest, GetStateString) { |
Darin Petkov | cc04442 | 2011-08-17 13:30:06 -0700 | [diff] [blame] | 387 | EXPECT_EQ("CellularStateDisabled", |
| 388 | device_->GetStateString(Cellular::kStateDisabled)); |
| 389 | EXPECT_EQ("CellularStateEnabled", |
| 390 | device_->GetStateString(Cellular::kStateEnabled)); |
| 391 | EXPECT_EQ("CellularStateRegistered", |
| 392 | device_->GetStateString(Cellular::kStateRegistered)); |
| 393 | EXPECT_EQ("CellularStateConnected", |
| 394 | device_->GetStateString(Cellular::kStateConnected)); |
| 395 | EXPECT_EQ("CellularStateLinked", |
| 396 | device_->GetStateString(Cellular::kStateLinked)); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 397 | } |
| 398 | |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 399 | TEST_F(CellularTest, StartCDMARegister) { |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 400 | SetCellularType(Cellular::kTypeCDMA); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 401 | ExpectCdmaStartModem(flimflam::kNetworkTechnology1Xrtt); |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 402 | EXPECT_CALL(*cdma_proxy_, MEID()).WillOnce(Return(kMEID)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 403 | Error error; |
| 404 | device_->Start(&error, Bind(&CellularTest::TestCallback, Unretained(this))); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 405 | dispatcher_.DispatchPendingEvents(); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 406 | EXPECT_EQ(kMEID, GetCapabilityClassic()->meid_); |
| 407 | EXPECT_EQ(kTestCarrier, GetCapabilityClassic()->carrier_); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 408 | EXPECT_EQ(Cellular::kStateRegistered, device_->state_); |
Darin Petkov | d204580 | 2011-08-23 11:09:25 -0700 | [diff] [blame] | 409 | ASSERT_TRUE(device_->service_.get()); |
| 410 | EXPECT_EQ(flimflam::kNetworkTechnology1Xrtt, |
Darin Petkov | b72cf40 | 2011-11-22 14:51:39 +0100 | [diff] [blame] | 411 | device_->service_->network_technology()); |
Darin Petkov | 22b72bf | 2011-08-29 14:01:20 -0700 | [diff] [blame] | 412 | EXPECT_EQ(kStrength, device_->service_->strength()); |
Darin Petkov | d204580 | 2011-08-23 11:09:25 -0700 | [diff] [blame] | 413 | EXPECT_EQ(flimflam::kRoamingStateHome, device_->service_->roaming_state()); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 414 | } |
| 415 | |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 416 | TEST_F(CellularTest, StartGSMRegister) { |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 417 | provider_db_ = mobile_provider_open_db(kTestMobileProviderDBPath); |
| 418 | ASSERT_TRUE(provider_db_); |
| 419 | device_->provider_db_ = provider_db_; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 420 | EXPECT_CALL(*proxy_, Enable(true, _, _, CellularCapability::kTimeoutEnable)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 421 | .WillOnce(Invoke(this, &CellularTest::InvokeEnable)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 422 | EXPECT_CALL(*gsm_card_proxy_, |
| 423 | GetIMEI(_, _, CellularCapability::kTimeoutDefault)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 424 | .WillOnce(Invoke(this, &CellularTest::InvokeGetIMEI)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 425 | EXPECT_CALL(*gsm_card_proxy_, |
| 426 | GetIMSI(_, _, CellularCapability::kTimeoutDefault)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 427 | .WillOnce(Invoke(this, &CellularTest::InvokeGetIMSI)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 428 | EXPECT_CALL(*gsm_card_proxy_, |
| 429 | GetSPN(_, _, CellularCapability::kTimeoutDefault)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 430 | .WillOnce(Invoke(this, &CellularTest::InvokeGetSPN)); |
| 431 | EXPECT_CALL(*gsm_card_proxy_, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 432 | GetMSISDN(_, _, CellularCapability::kTimeoutDefault)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 433 | .WillOnce(Invoke(this, &CellularTest::InvokeGetMSISDN)); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 434 | EXPECT_CALL(*gsm_network_proxy_, AccessTechnology()) |
| 435 | .WillOnce(Return(MM_MODEM_GSM_ACCESS_TECH_EDGE)); |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 436 | EXPECT_CALL(*gsm_card_proxy_, EnabledFacilityLocks()) |
| 437 | .WillOnce(Return(MM_MODEM_GSM_FACILITY_SIM)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 438 | EXPECT_CALL(*proxy_, GetModemInfo(_, _, CellularCapability::kTimeoutDefault)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 439 | .WillOnce(Invoke(this, &CellularTest::InvokeGetModemInfo)); |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 440 | static const char kNetworkID[] = "22803"; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 441 | EXPECT_CALL(*gsm_network_proxy_, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 442 | GetRegistrationInfo(_, _, CellularCapability::kTimeoutDefault)) |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 443 | .WillOnce(Invoke(this, &CellularTest::InvokeGetRegistrationInfo)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 444 | EXPECT_CALL(*gsm_network_proxy_, GetSignalQuality(NULL, _, _)) |
| 445 | .Times(2) |
| 446 | .WillRepeatedly(Invoke(this, |
| 447 | &CellularTest::InvokeGetSignalQuality)); |
| 448 | EXPECT_CALL(*this, TestCallback(IsSuccess())); |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 449 | EXPECT_CALL(manager_, RegisterService(_)); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 450 | Error error; |
| 451 | device_->Start(&error, Bind(&CellularTest::TestCallback, Unretained(this))); |
| 452 | EXPECT_TRUE(error.IsSuccess()); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 453 | dispatcher_.DispatchPendingEvents(); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 454 | EXPECT_EQ(kIMEI, GetCapabilityGSM()->imei_); |
| 455 | EXPECT_EQ(kIMSI, GetCapabilityGSM()->imsi_); |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 456 | EXPECT_EQ(kTestCarrier, GetCapabilityGSM()->spn_); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 457 | EXPECT_EQ(kMSISDN, GetCapabilityGSM()->mdn_); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 458 | EXPECT_EQ(Cellular::kStateRegistered, device_->state_); |
| 459 | ASSERT_TRUE(device_->service_.get()); |
| 460 | EXPECT_EQ(flimflam::kNetworkTechnologyEdge, |
Darin Petkov | b72cf40 | 2011-11-22 14:51:39 +0100 | [diff] [blame] | 461 | device_->service_->network_technology()); |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 462 | EXPECT_TRUE(GetCapabilityGSM()->sim_lock_status_.enabled); |
Darin Petkov | 22b72bf | 2011-08-29 14:01:20 -0700 | [diff] [blame] | 463 | EXPECT_EQ(kStrength, device_->service_->strength()); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 464 | EXPECT_EQ(flimflam::kRoamingStateRoaming, device_->service_->roaming_state()); |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 465 | EXPECT_EQ(kNetworkID, device_->service_->serving_operator().GetCode()); |
| 466 | EXPECT_EQ("Orange", device_->service_->serving_operator().GetName()); |
| 467 | EXPECT_EQ("ch", device_->service_->serving_operator().GetCountry()); |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 468 | } |
| 469 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 470 | TEST_F(CellularTest, StartConnected) { |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 471 | EXPECT_CALL(device_info_, GetFlags(device_->interface_index(), _)) |
| 472 | .WillOnce(Return(true)); |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 473 | SetCellularType(Cellular::kTypeCDMA); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 474 | device_->set_modem_state(Cellular::kModemStateConnected); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 475 | GetCapabilityClassic()->meid_ = kMEID; |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 476 | ExpectCdmaStartModem(flimflam::kNetworkTechnologyEvdo); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 477 | Error error; |
| 478 | device_->Start(&error, Bind(&CellularTest::TestCallback, Unretained(this))); |
| 479 | EXPECT_TRUE(error.IsSuccess()); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 480 | dispatcher_.DispatchPendingEvents(); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 481 | EXPECT_EQ(Cellular::kStateConnected, device_->state_); |
| 482 | } |
| 483 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 484 | TEST_F(CellularTest, StartLinked) { |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 485 | EXPECT_CALL(device_info_, GetFlags(device_->interface_index(), _)) |
| 486 | .WillOnce(DoAll(SetArgumentPointee<1>(IFF_UP), Return(true))); |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 487 | SetCellularType(Cellular::kTypeCDMA); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 488 | device_->set_modem_state(Cellular::kModemStateConnected); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 489 | GetCapabilityClassic()->meid_ = kMEID; |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 490 | ExpectCdmaStartModem(flimflam::kNetworkTechnologyEvdo); |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 491 | EXPECT_CALL(dhcp_provider_, CreateConfig(kTestDeviceName, _, _, _)) |
Darin Petkov | 77cb681 | 2011-08-15 16:19:41 -0700 | [diff] [blame] | 492 | .WillOnce(Return(dhcp_config_)); |
| 493 | EXPECT_CALL(*dhcp_config_, RequestIP()).WillOnce(Return(true)); |
Darin Petkov | 60b8c3b | 2011-08-25 11:03:20 -0700 | [diff] [blame] | 494 | EXPECT_CALL(manager_, UpdateService(_)).Times(2); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 495 | Error error; |
| 496 | device_->Start(&error, Bind(&CellularTest::TestCallback, Unretained(this))); |
| 497 | EXPECT_TRUE(error.IsSuccess()); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 498 | dispatcher_.DispatchPendingEvents(); |
| 499 | EXPECT_EQ(Cellular::kStateLinked, device_->state_); |
Darin Petkov | 60b8c3b | 2011-08-25 11:03:20 -0700 | [diff] [blame] | 500 | EXPECT_EQ(Service::kStateConfiguring, device_->service_->state()); |
| 501 | device_->SelectService(NULL); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 502 | } |
| 503 | |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 504 | TEST_F(CellularTest, CreateService) { |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 505 | SetCellularType(Cellular::kTypeCDMA); |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 506 | static const char kPaymentURL[] = "https://payment.url"; |
| 507 | static const char kUsageURL[] = "https://usage.url"; |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 508 | device_->home_provider_.SetName(kTestCarrier); |
Darin Petkov | 381928f | 2012-02-02 23:00:12 +0100 | [diff] [blame] | 509 | GetCapabilityCDMA()->olp_.SetURL(kPaymentURL); |
Darin Petkov | ae0c64e | 2011-11-15 15:50:27 +0100 | [diff] [blame] | 510 | GetCapabilityCDMA()->usage_url_ = kUsageURL; |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 511 | device_->CreateService(); |
| 512 | ASSERT_TRUE(device_->service_.get()); |
Darin Petkov | 381928f | 2012-02-02 23:00:12 +0100 | [diff] [blame] | 513 | EXPECT_EQ(kPaymentURL, device_->service_->olp().GetURL()); |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 514 | EXPECT_EQ(kUsageURL, device_->service_->usage_url()); |
| 515 | EXPECT_EQ(kTestCarrier, device_->service_->serving_operator().GetName()); |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 516 | EXPECT_TRUE(device_->service_->TechnologyIs(Technology::kCellular)); |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 517 | } |
| 518 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 519 | namespace { |
| 520 | |
| 521 | MATCHER(ContainsPhoneNumber, "") { |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 522 | return ContainsKey(arg, |
| 523 | CellularCapabilityClassic::kConnectPropertyPhoneNumber); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 524 | } |
| 525 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 526 | } // namespace |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 527 | |
| 528 | TEST_F(CellularTest, Connect) { |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 529 | Error error; |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 530 | EXPECT_CALL(device_info_, GetFlags(device_->interface_index(), _)) |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 531 | .Times(2) |
| 532 | .WillRepeatedly(Return(true)); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 533 | device_->state_ = Cellular::kStateConnected; |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 534 | device_->Connect(&error); |
| 535 | EXPECT_EQ(Error::kAlreadyConnected, error.type()); |
| 536 | error.Populate(Error::kSuccess); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 537 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 538 | device_->state_ = Cellular::kStateLinked; |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 539 | device_->Connect(&error); |
| 540 | EXPECT_EQ(Error::kAlreadyConnected, error.type()); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 541 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 542 | device_->state_ = Cellular::kStateRegistered; |
Darin Petkov | d204580 | 2011-08-23 11:09:25 -0700 | [diff] [blame] | 543 | device_->service_ = new CellularService( |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 544 | &control_interface_, &dispatcher_, &metrics_, &manager_, device_); |
Darin Petkov | d204580 | 2011-08-23 11:09:25 -0700 | [diff] [blame] | 545 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 546 | device_->allow_roaming_ = false; |
Darin Petkov | b72cf40 | 2011-11-22 14:51:39 +0100 | [diff] [blame] | 547 | device_->service_->roaming_state_ = flimflam::kRoamingStateRoaming; |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 548 | device_->Connect(&error); |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 549 | EXPECT_EQ(Error::kNotOnHomeNetwork, error.type()); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 550 | |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 551 | error.Populate(Error::kSuccess); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 552 | EXPECT_CALL(*simple_proxy_, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 553 | Connect(ContainsPhoneNumber(), _, _, |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 554 | CellularCapability::kTimeoutConnect)) |
| 555 | .Times(2) |
| 556 | .WillRepeatedly(Invoke(this, &CellularTest::InvokeConnect)); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 557 | GetCapabilityClassic()->simple_proxy_.reset(simple_proxy_.release()); |
Darin Petkov | b72cf40 | 2011-11-22 14:51:39 +0100 | [diff] [blame] | 558 | device_->service_->roaming_state_ = flimflam::kRoamingStateHome; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 559 | device_->state_ = Cellular::kStateRegistered; |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 560 | device_->Connect(&error); |
| 561 | EXPECT_TRUE(error.IsSuccess()); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 562 | dispatcher_.DispatchPendingEvents(); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 563 | EXPECT_EQ(Cellular::kStateConnected, device_->state_); |
| 564 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 565 | device_->allow_roaming_ = true; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 566 | device_->service_->roaming_state_ = flimflam::kRoamingStateRoaming; |
| 567 | device_->state_ = Cellular::kStateRegistered; |
| 568 | device_->Connect(&error); |
| 569 | EXPECT_TRUE(error.IsSuccess()); |
| 570 | dispatcher_.DispatchPendingEvents(); |
| 571 | EXPECT_EQ(Cellular::kStateConnected, device_->state_); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 572 | } |
| 573 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 574 | TEST_F(CellularTest, Disconnect) { |
| 575 | Error error; |
| 576 | device_->state_ = Cellular::kStateRegistered; |
| 577 | device_->Disconnect(&error); |
| 578 | EXPECT_EQ(Error::kNotConnected, error.type()); |
| 579 | error.Reset(); |
| 580 | |
Darin Petkov | fb0625e | 2012-01-16 13:05:56 +0100 | [diff] [blame] | 581 | device_->state_ = Cellular::kStateConnected; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 582 | EXPECT_CALL(*proxy_, |
| 583 | Disconnect(_, _, CellularCapability::kTimeoutDefault)) |
| 584 | .WillOnce(Invoke(this, &CellularTest::InvokeDisconnect)); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 585 | GetCapabilityClassic()->proxy_.reset(proxy_.release()); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 586 | device_->Disconnect(&error); |
| 587 | EXPECT_TRUE(error.IsSuccess()); |
| 588 | EXPECT_EQ(Cellular::kStateRegistered, device_->state_); |
Darin Petkov | fb0625e | 2012-01-16 13:05:56 +0100 | [diff] [blame] | 589 | } |
| 590 | |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 591 | TEST_F(CellularTest, ConnectFailure) { |
| 592 | SetCellularType(Cellular::kTypeCDMA); |
| 593 | device_->state_ = Cellular::kStateRegistered; |
| 594 | device_->service_ = new CellularService( |
| 595 | &control_interface_, &dispatcher_, &metrics_, &manager_, device_); |
| 596 | ASSERT_EQ(Service::kStateIdle, device_->service_->state()); |
| 597 | EXPECT_CALL(*simple_proxy_, |
| 598 | Connect(_, _, _, CellularCapability::kTimeoutConnect)) |
| 599 | .WillOnce(Invoke(this, &CellularTest::InvokeConnectFail)); |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 600 | GetCapabilityClassic()->simple_proxy_.reset(simple_proxy_.release()); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 601 | Error error; |
| 602 | device_->Connect(&error); |
| 603 | EXPECT_EQ(Service::kStateFailure, device_->service_->state()); |
| 604 | } |
| 605 | |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 606 | TEST_F(CellularTest, ModemStateChangeEnable) { |
| 607 | EXPECT_CALL(*simple_proxy_, |
| 608 | GetModemStatus(_, _, CellularCapability::kTimeoutDefault)) |
| 609 | .WillOnce(Invoke(this, &CellularTest::InvokeGetModemStatus)); |
| 610 | EXPECT_CALL(*cdma_proxy_, MEID()).WillOnce(Return(kMEID)); |
| 611 | EXPECT_CALL(*proxy_, |
| 612 | GetModemInfo(_, _, CellularCapability::kTimeoutDefault)) |
| 613 | .WillOnce(Invoke(this, &CellularTest::InvokeGetModemInfo)); |
| 614 | EXPECT_CALL(*cdma_proxy_, GetRegistrationState(NULL, _, _)) |
| 615 | .WillOnce(Invoke(this, |
| 616 | &CellularTest::InvokeGetRegistrationStateUnregistered)); |
| 617 | EXPECT_CALL(*cdma_proxy_, GetSignalQuality(NULL, _, _)) |
| 618 | .WillOnce(Invoke(this, &CellularTest::InvokeGetSignalQuality)); |
| 619 | EXPECT_CALL(manager_, UpdateEnabledTechnologies()); |
| 620 | device_->state_ = Cellular::kStateDisabled; |
| 621 | device_->set_modem_state(Cellular::kModemStateDisabled); |
| 622 | SetCellularType(Cellular::kTypeCDMA); |
| 623 | |
| 624 | DBusPropertiesMap props; |
| 625 | props[CellularCapabilityClassic::kModemPropertyEnabled].writer(). |
| 626 | append_bool(true); |
| 627 | device_->OnDBusPropertiesChanged(MM_MODEM_INTERFACE, props, vector<string>()); |
| 628 | dispatcher_.DispatchPendingEvents(); |
| 629 | |
| 630 | EXPECT_EQ(Cellular::kModemStateEnabled, device_->modem_state()); |
| 631 | EXPECT_EQ(Cellular::kStateEnabled, device_->state()); |
| 632 | EXPECT_TRUE(device_->enabled()); |
| 633 | } |
| 634 | |
| 635 | TEST_F(CellularTest, ModemStateChangeDisable) { |
| 636 | EXPECT_CALL(*proxy_, |
| 637 | Disconnect(_, _, CellularCapability::kTimeoutDefault)) |
| 638 | .WillOnce(Invoke(this, &CellularTest::InvokeDisconnect)); |
| 639 | EXPECT_CALL(*proxy_, |
Thieu Le | c8d2d96 | 2012-05-15 14:31:18 -0700 | [diff] [blame] | 640 | Enable(false, _, _, CellularCapability::kTimeoutEnable)) |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 641 | .WillOnce(Invoke(this, &CellularTest::InvokeEnable)); |
| 642 | EXPECT_CALL(manager_, UpdateEnabledTechnologies()); |
| 643 | device_->enabled_ = true; |
| 644 | device_->enabled_pending_ = true; |
| 645 | device_->state_ = Cellular::kStateEnabled; |
| 646 | device_->set_modem_state(Cellular::kModemStateEnabled); |
| 647 | SetCellularType(Cellular::kTypeCDMA); |
| 648 | GetCapabilityClassic()->InitProxies(); |
| 649 | |
| 650 | GetCapabilityClassic()->OnModemStateChangedSignal(kModemClassicStateEnabled, |
| 651 | kModemClassicStateDisabled, |
| 652 | 0); |
| 653 | dispatcher_.DispatchPendingEvents(); |
| 654 | |
| 655 | EXPECT_EQ(Cellular::kModemStateDisabled, device_->modem_state()); |
| 656 | EXPECT_EQ(Cellular::kStateDisabled, device_->state()); |
| 657 | EXPECT_FALSE(device_->enabled()); |
| 658 | } |
| 659 | |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 660 | TEST_F(CellularTest, StartModemCallback) { |
Gary Morain | baeefdf | 2012-04-30 14:53:35 -0700 | [diff] [blame] | 661 | EXPECT_CALL(*this, TestCallback(IsSuccess())); |
| 662 | EXPECT_EQ(device_->state_, Cellular::kStateDisabled); |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 663 | device_->StartModemCallback(Bind(&CellularTest::TestCallback, |
| 664 | Unretained(this)), |
| 665 | Error(Error::kSuccess)); |
Gary Morain | baeefdf | 2012-04-30 14:53:35 -0700 | [diff] [blame] | 666 | EXPECT_EQ(device_->state_, Cellular::kStateEnabled); |
| 667 | } |
| 668 | |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 669 | TEST_F(CellularTest, StartModemCallbackFail) { |
Gary Morain | baeefdf | 2012-04-30 14:53:35 -0700 | [diff] [blame] | 670 | EXPECT_CALL(*this, TestCallback(IsFailure())); |
| 671 | EXPECT_EQ(device_->state_, Cellular::kStateDisabled); |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 672 | device_->StartModemCallback(Bind(&CellularTest::TestCallback, |
| 673 | Unretained(this)), |
| 674 | Error(Error::kOperationFailed)); |
Gary Morain | baeefdf | 2012-04-30 14:53:35 -0700 | [diff] [blame] | 675 | EXPECT_EQ(device_->state_, Cellular::kStateDisabled); |
| 676 | } |
| 677 | |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 678 | TEST_F(CellularTest, StopModemCallback) { |
| 679 | EXPECT_CALL(*this, TestCallback(IsSuccess())); |
| 680 | device_->service_ = new MockCellularService(&control_interface_, |
| 681 | &dispatcher_, |
| 682 | &metrics_, |
| 683 | &manager_, |
| 684 | device_); |
| 685 | device_->StopModemCallback(Bind(&CellularTest::TestCallback, |
| 686 | Unretained(this)), |
| 687 | Error(Error::kSuccess)); |
| 688 | EXPECT_EQ(device_->state_, Cellular::kStateDisabled); |
| 689 | EXPECT_FALSE(device_->service_.get()); |
| 690 | } |
| 691 | |
| 692 | TEST_F(CellularTest, StopModemCallbackFail) { |
| 693 | EXPECT_CALL(*this, TestCallback(IsFailure())); |
| 694 | device_->service_ = new MockCellularService(&control_interface_, |
| 695 | &dispatcher_, |
| 696 | &metrics_, |
| 697 | &manager_, |
| 698 | device_); |
| 699 | device_->StopModemCallback(Bind(&CellularTest::TestCallback, |
| 700 | Unretained(this)), |
| 701 | Error(Error::kOperationFailed)); |
| 702 | EXPECT_EQ(device_->state_, Cellular::kStateDisabled); |
| 703 | EXPECT_FALSE(device_->service_.get()); |
| 704 | } |
| 705 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 706 | } // namespace shill |