shill: cellular: Obtain IMSI when a GSM device is constructed.

This CL modifies CellularCapabilityGSM to obtain the IMSI value at
construction instead of when the modem is enabled. The IMSI value is
checked by Chrome to determine if a SIM is present before the device can
be enabled.

BUG=chromium-os:31651
TEST=Tested the following:
1. Build and run unit tests.
2. Verify that Gobi and Icera modems can be enabled as follows:
   a. Configure the modem in GSM and insert a SIM with no PIN lock.
   b. Disable the cellular device from UI.
   c. Reboot the Chromebook.
   d. Enable the cellular device from UI and it works.
   e. Repeat with a PIN-locked SIM.
3. Verify that Gobi and Icera modems cannot be enabled as follows:
   a. Configure the modem in GSM with no SIM inserted.
   b. Disable the cellular device from UI.
   c. Reboot the Chromebook.
   d. Enable the cellular device from UI and it does not work.

Change-Id: Iff21f972661cedb383b9a6820fdc7ba3160fd01a
Reviewed-on: https://gerrit.chromium.org/gerrit/29313
Commit-Ready: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/cellular_capability_universal_unittest.cc b/cellular_capability_universal_unittest.cc
index a8eb207..a696172 100644
--- a/cellular_capability_universal_unittest.cc
+++ b/cellular_capability_universal_unittest.cc
@@ -64,6 +64,16 @@
  public:
   CellularCapabilityUniversalTest()
       : manager_(&control_, &dispatcher_, &metrics_, &glib_),
+        modem_3gpp_proxy_(new mm1::MockModemModem3gppProxy()),
+        modem_cdma_proxy_(new mm1::MockModemModemCdmaProxy()),
+        modem_proxy_(new mm1::MockModemProxy()),
+        modem_simple_proxy_(new mm1::MockModemSimpleProxy()),
+        sim_proxy_(new mm1::MockSimProxy()),
+        properties_proxy_(new MockDBusPropertiesProxy()),
+        proxy_factory_(this),
+        capability_(NULL),
+        device_adaptor_(NULL),
+        provider_db_(NULL),
         cellular_(new Cellular(&control_,
                                &dispatcher_,
                                NULL,
@@ -75,21 +85,13 @@
                                "",
                                "",
                                "",
-                               NULL)),
+                               NULL,
+                               &proxy_factory_)),
         service_(new MockCellularService(&control_,
                                          &dispatcher_,
                                          &metrics_,
                                          &manager_,
-                                         cellular_)),
-        modem_3gpp_proxy_(new mm1::MockModemModem3gppProxy()),
-        modem_cdma_proxy_(new mm1::MockModemModemCdmaProxy()),
-        modem_proxy_(new mm1::MockModemProxy()),
-        modem_simple_proxy_(new mm1::MockModemSimpleProxy()),
-        sim_proxy_(new mm1::MockSimProxy()),
-        properties_proxy_(new MockDBusPropertiesProxy()),
-        proxy_factory_(this),
-        capability_(NULL),
-        device_adaptor_(NULL) {}
+                                         cellular_)) {}
 
   virtual ~CellularCapabilityUniversalTest() {
     cellular_->service_ = NULL;
@@ -100,7 +102,6 @@
   virtual void SetUp() {
     capability_ = dynamic_cast<CellularCapabilityUniversal *>(
         cellular_->capability_.get());
-    capability_->proxy_factory_ = &proxy_factory_;
     device_adaptor_ =
         dynamic_cast<NiceMock<DeviceMockAdaptor> *>(cellular_->adaptor());
     cellular_->service_ = service_;
@@ -208,8 +209,6 @@
   MockMetrics metrics_;
   MockGLib glib_;
   MockManager manager_;
-  CellularRefPtr cellular_;
-  MockCellularService *service_;  // owned by cellular_
   scoped_ptr<mm1::MockModemModem3gppProxy> modem_3gpp_proxy_;
   scoped_ptr<mm1::MockModemModemCdmaProxy> modem_cdma_proxy_;
   scoped_ptr<mm1::MockModemProxy> modem_proxy_;
@@ -220,6 +219,8 @@
   CellularCapabilityUniversal *capability_;  // Owned by |cellular_|.
   NiceMock<DeviceMockAdaptor> *device_adaptor_;  // Owned by |cellular_|.
   mobile_provider_db *provider_db_;
+  CellularRefPtr cellular_;
+  MockCellularService *service_;  // owned by cellular_
   DBusPropertyMapsCallback scan_callback_;  // saved for testing scan operations
   DBusPathCallback connect_callback_;  // saved for testing connect operations
 };