shill: Move the remaining Gsm.Card interfaces to the GSM capability delegate.

This allowed ownership transfer of the Gsm.Card proxy from Cellular to the
delegate.

BUG=chromium-os:18735
TEST=unit tests

Change-Id: I55f56ffb09950002f2d3a50edac5a566cb35d14f
Reviewed-on: https://gerrit.chromium.org/gerrit/11375
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/Makefile b/Makefile
index cde5928..a572a1d 100644
--- a/Makefile
+++ b/Makefile
@@ -150,6 +150,7 @@
 TEST_BIN = shill_unittest
 TEST_OBJS = \
 	byte_string_unittest.o \
+	cellular_capability_cdma_unittest.o \
 	cellular_capability_gsm_unittest.o \
 	cellular_unittest.o \
 	crypto_des_cbc_unittest.o \
diff --git a/cellular.cc b/cellular.cc
index 6aeeae8..478db55 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -314,7 +314,7 @@
     RegisterGSMModem();
   }
   GetModemStatus();
-  GetModemIdentifiers();
+  capability_->GetIdentifiers();
   if (type_ == kTypeGSM) {
     GetGSMProperties();
   }
@@ -327,7 +327,6 @@
   proxy_.reset();
   simple_proxy_.reset();
   cdma_proxy_.reset();
-  gsm_card_proxy_.reset();
   gsm_network_proxy_.reset();
   manager()->DeregisterService(service_);
   service_ = NULL;  // Breaks a reference cycle.
@@ -402,57 +401,6 @@
   }
 }
 
-void Cellular::GetModemIdentifiers() {
-  VLOG(2) << __func__;
-  switch (type_) {
-    case kTypeGSM:
-      GetGSMIdentifiers();
-      break;
-    case kTypeCDMA:
-      GetCDMAIdentifiers();
-      break;
-    default: NOTREACHED();
-  }
-}
-
-void Cellular::GetCDMAIdentifiers() {
-  CHECK_EQ(kTypeCDMA, type_);
-  if (meid_.empty()) {
-    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-    meid_ = cdma_proxy_->MEID();
-    VLOG(2) << "MEID: " << imei_;
-  }
-}
-
-void Cellular::GetGSMIdentifiers() {
-  CHECK_EQ(kTypeGSM, type_);
-  if (imei_.empty()) {
-    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-    imei_ = gsm_card_proxy_->GetIMEI();
-    VLOG(2) << "IMEI: " << imei_;
-  }
-  if (imsi_.empty()) {
-    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-    imsi_ = gsm_card_proxy_->GetIMSI();
-    VLOG(2) << "IMSI: " << imsi_;
-  }
-  if (gsm_.spn.empty()) {
-    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-    try {
-      gsm_.spn = gsm_card_proxy_->GetSPN();
-      VLOG(2) << "SPN: " << gsm_.spn;
-    } catch (const DBus::Error e) {
-      // Some modems don't support this call so catch the exception explicitly.
-      LOG(WARNING) << "Unable to obtain SPN: " << e.what();
-    }
-  }
-  if (mdn_.empty()) {
-    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-    mdn_ = gsm_card_proxy_->GetMSISDN();
-    VLOG(2) << "MSISDN/MDN: " << mdn_;
-  }
-}
-
 void Cellular::GetGSMProperties() {
   CHECK_EQ(kTypeGSM, type_);
   // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
diff --git a/cellular.h b/cellular.h
index f611704..c70abef 100644
--- a/cellular.h
+++ b/cellular.h
@@ -15,7 +15,6 @@
 #include "shill/device.h"
 #include "shill/event_dispatcher.h"
 #include "shill/modem_cdma_proxy_interface.h"
-#include "shill/modem_gsm_card_proxy_interface.h"
 #include "shill/modem_gsm_network_proxy_interface.h"
 #include "shill/modem_proxy_interface.h"
 #include "shill/refptr_types.h"
@@ -31,7 +30,6 @@
 
 class Cellular : public Device,
                  public ModemCDMAProxyDelegate,
-                 public ModemGSMCardProxyDelegate,
                  public ModemGSMNetworkProxyDelegate,
                  public ModemProxyDelegate {
  public:
@@ -140,6 +138,21 @@
   const std::string &dbus_owner() const { return dbus_owner_; }
   const std::string &dbus_path() const { return dbus_path_; }
 
+  const std::string &meid() const { return meid_; }
+  void set_meid(const std::string &meid) { meid_ = meid; }
+
+  const std::string &imei() const { return imei_; }
+  void set_imei(const std::string &imei) { imei_ = imei; }
+
+  const std::string &imsi() const { return imsi_; }
+  void set_imsi(const std::string &imsi) { imsi_ = imsi; }
+
+  const std::string &spn() const { return gsm_.spn; }
+  void set_spn(const std::string &spn) { gsm_.spn = spn; }
+
+  const std::string &mdn() const { return mdn_; }
+  void set_mdn(const std::string &mdn) { mdn_ = mdn; }
+
   ProxyFactory *proxy_factory() const { return proxy_factory_; }
 
   ModemCDMAProxyInterface *modem_cdma_proxy() const {
@@ -148,12 +161,6 @@
   void set_modem_cdma_proxy(ModemCDMAProxyInterface *proxy) {
     cdma_proxy_.reset(proxy);
   }
-  ModemGSMCardProxyInterface *modem_gsm_card_proxy() const {
-    return gsm_card_proxy_.get();
-  }
-  void set_modem_gsm_card_proxy(ModemGSMCardProxyInterface *proxy) {
-    gsm_card_proxy_.reset(proxy);
-  }
   ModemGSMNetworkProxyInterface *modem_gsm_network_proxy() const {
     return gsm_network_proxy_.get();
   }
@@ -187,12 +194,10 @@
   FRIEND_TEST(CellularTest, Connect);
   FRIEND_TEST(CellularTest, GetCDMAActivationStateString);
   FRIEND_TEST(CellularTest, GetCDMAActivationErrorString);
-  FRIEND_TEST(CellularTest, GetCDMAIdentifiers);
   FRIEND_TEST(CellularTest, GetCDMANetworkTechnologyString);
   FRIEND_TEST(CellularTest, GetCDMARegistrationState);
   FRIEND_TEST(CellularTest, GetCDMARoamingStateString);
   FRIEND_TEST(CellularTest, GetCDMASignalQuality);
-  FRIEND_TEST(CellularTest, GetGSMIdentifiers);
   FRIEND_TEST(CellularTest, GetGSMNetworkTechnologyString);
   FRIEND_TEST(CellularTest, GetGSMRoamingStateString);
   FRIEND_TEST(CellularTest, GetGSMSignalQuality);
@@ -282,12 +287,6 @@
   void GetGSMProperties();
   void RegisterGSMModem();
 
-  // Obtains the modem identifiers: MEID for CDMA; IMEI, IMSI, SPN and MSISDN
-  // for GSM.
-  void GetModemIdentifiers();
-  void GetCDMAIdentifiers();
-  void GetGSMIdentifiers();
-
   // Obtains modem's manufacturer, model ID, and hardware revision.
   void GetModemInfo();
 
@@ -355,7 +354,6 @@
   scoped_ptr<ModemProxyInterface> proxy_;
   scoped_ptr<ModemSimpleProxyInterface> simple_proxy_;
   scoped_ptr<ModemCDMAProxyInterface> cdma_proxy_;
-  scoped_ptr<ModemGSMCardProxyInterface> gsm_card_proxy_;
   scoped_ptr<ModemGSMNetworkProxyInterface> gsm_network_proxy_;
 
   mobile_provider_db *provider_db_;
diff --git a/cellular_capability.h b/cellular_capability.h
index f12a4cf..e815a9b 100644
--- a/cellular_capability.h
+++ b/cellular_capability.h
@@ -31,6 +31,9 @@
   // Initialize RPC proxies.
   virtual void InitProxies() = 0;
 
+  // Retrieves identifiers associated with the modem and the capability.
+  virtual void GetIdentifiers() = 0;
+
   // PIN management. The default implementation fails by populating |error|.
   virtual void RequirePIN(const std::string &pin, bool require, Error *error);
   virtual void EnterPIN(const std::string &pin, Error *error);
diff --git a/cellular_capability_cdma.cc b/cellular_capability_cdma.cc
index 1567342..ee97e5f 100644
--- a/cellular_capability_cdma.cc
+++ b/cellular_capability_cdma.cc
@@ -23,4 +23,13 @@
                                             cellular()->dbus_owner()));
 }
 
+void CellularCapabilityCDMA::GetIdentifiers() {
+  VLOG(2) << __func__;
+  if (cellular()->meid().empty()) {
+    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
+    cellular()->set_meid(cellular()->modem_cdma_proxy()->MEID());
+    VLOG(2) << "MEID: " << cellular()->imei();
+  }
+}
+
 }  // namespace shill
diff --git a/cellular_capability_cdma.h b/cellular_capability_cdma.h
index c8fb623..3aeea7e 100644
--- a/cellular_capability_cdma.h
+++ b/cellular_capability_cdma.h
@@ -16,6 +16,9 @@
   // Inherited from CellularCapability.
   virtual void InitProxies();
 
+  // Obtains the MEID.
+  virtual void GetIdentifiers();
+
  private:
   DISALLOW_COPY_AND_ASSIGN(CellularCapabilityCDMA);
 };
diff --git a/cellular_capability_cdma_unittest.cc b/cellular_capability_cdma_unittest.cc
new file mode 100644
index 0000000..3d63062
--- /dev/null
+++ b/cellular_capability_cdma_unittest.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/cellular_capability_cdma.h"
+
+#include <gtest/gtest.h>
+
+#include "shill/cellular.h"
+#include "shill/error.h"
+#include "shill/event_dispatcher.h"
+#include "shill/mock_modem_cdma_proxy.h"
+#include "shill/nice_mock_control.h"
+
+using testing::Return;
+
+namespace shill {
+
+class CellularCapabilityCDMATest : public testing::Test {
+ public:
+  CellularCapabilityCDMATest()
+      : cellular_(new Cellular(&control_,
+                               &dispatcher_,
+                               NULL,
+                               "",
+                               "",
+                               0,
+                               Cellular::kTypeCDMA,
+                               "",
+                               "",
+                               NULL)),
+        proxy_(new MockModemCDMAProxy()),
+        capability_(cellular_.get()) {}
+
+ protected:
+  static const char kMEID[];
+
+  NiceMockControl control_;
+  EventDispatcher dispatcher_;
+  CellularRefPtr cellular_;
+  scoped_ptr<MockModemCDMAProxy> proxy_;
+  CellularCapabilityCDMA capability_;
+};
+
+const char CellularCapabilityCDMATest::kMEID[] = "D1234567EF8901";
+
+TEST_F(CellularCapabilityCDMATest, GetIdentifiers) {
+  EXPECT_CALL(*proxy_, MEID()).WillOnce(Return(kMEID));
+  cellular_->set_modem_cdma_proxy(proxy_.release());
+  capability_.GetIdentifiers();
+  EXPECT_EQ(kMEID, cellular_->meid());
+  capability_.GetIdentifiers();
+  EXPECT_EQ(kMEID, cellular_->meid());
+}
+
+}  // namespace shill
diff --git a/cellular_capability_gsm.cc b/cellular_capability_gsm.cc
index 464d62b..1862e3e 100644
--- a/cellular_capability_gsm.cc
+++ b/cellular_capability_gsm.cc
@@ -19,17 +19,46 @@
 
 void CellularCapabilityGSM::InitProxies() {
   VLOG(2) << __func__;
-  // TODO(petkov): Move GSM-specific proxy ownership from Cellular to this.
-  cellular()->set_modem_gsm_card_proxy(
-      proxy_factory()->CreateModemGSMCardProxy(cellular(),
+  card_proxy_.reset(
+      proxy_factory()->CreateModemGSMCardProxy(this,
                                                cellular()->dbus_path(),
                                                cellular()->dbus_owner()));
+  // TODO(petkov): Move GSM-specific proxy ownership from Cellular to this.
   cellular()->set_modem_gsm_network_proxy(
       proxy_factory()->CreateModemGSMNetworkProxy(cellular(),
                                                   cellular()->dbus_path(),
                                                   cellular()->dbus_owner()));
 }
 
+void CellularCapabilityGSM::GetIdentifiers() {
+  VLOG(2) << __func__;
+  if (cellular()->imei().empty()) {
+    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
+    cellular()->set_imei(card_proxy_->GetIMEI());
+    VLOG(2) << "IMEI: " << cellular()->imei();
+  }
+  if (cellular()->imsi().empty()) {
+    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
+    cellular()->set_imsi(card_proxy_->GetIMSI());
+    VLOG(2) << "IMSI: " << cellular()->imsi();
+  }
+  if (cellular()->spn().empty()) {
+    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
+    try {
+      cellular()->set_spn(card_proxy_->GetSPN());
+      VLOG(2) << "SPN: " << cellular()->spn();
+    } catch (const DBus::Error e) {
+      // Some modems don't support this call so catch the exception explicitly.
+      LOG(WARNING) << "Unable to obtain SPN: " << e.what();
+    }
+  }
+  if (cellular()->mdn().empty()) {
+    // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
+    cellular()->set_mdn(card_proxy_->GetMSISDN());
+    VLOG(2) << "MSISDN/MDN: " << cellular()->mdn();
+  }
+}
+
 void CellularCapabilityGSM::RequirePIN(
     const string &pin, bool require, Error */*error*/) {
   VLOG(2) << __func__ << "(" << pin << ", " << require << ")";
@@ -42,7 +71,7 @@
 void CellularCapabilityGSM::RequirePINTask(const string &pin, bool require) {
   VLOG(2) << __func__ << "(" << pin << ", " << require << ")";
   // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-  cellular()->modem_gsm_card_proxy()->EnablePIN(pin, require);
+  card_proxy_->EnablePIN(pin, require);
 }
 
 void CellularCapabilityGSM::EnterPIN(const string &pin, Error */*error*/) {
@@ -56,7 +85,7 @@
 void CellularCapabilityGSM::EnterPINTask(const string &pin) {
   VLOG(2) << __func__ << "(" << pin << ")";
   // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-  cellular()->modem_gsm_card_proxy()->SendPIN(pin);
+  card_proxy_->SendPIN(pin);
 }
 
 void CellularCapabilityGSM::UnblockPIN(
@@ -72,7 +101,7 @@
     const string &unblock_code, const string &pin) {
   VLOG(2) << __func__ << "(" << unblock_code << ", " << pin << ")";
   // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-  cellular()->modem_gsm_card_proxy()->SendPUK(unblock_code, pin);
+  card_proxy_->SendPUK(unblock_code, pin);
 }
 
 void CellularCapabilityGSM::ChangePIN(
@@ -88,7 +117,7 @@
     const string &old_pin, const string &new_pin) {
   VLOG(2) << __func__ << "(" << old_pin << ", " << new_pin << ")";
   // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
-  cellular()->modem_gsm_card_proxy()->ChangePIN(old_pin, new_pin);
+  card_proxy_->ChangePIN(old_pin, new_pin);
 }
 
 }  // namespace shill
diff --git a/cellular_capability_gsm.h b/cellular_capability_gsm.h
index 5de6aab..550563d 100644
--- a/cellular_capability_gsm.h
+++ b/cellular_capability_gsm.h
@@ -5,13 +5,16 @@
 #ifndef SHILL_CELLULAR_CAPABILITY_GSM_
 #define SHILL_CELLULAR_CAPABILITY_GSM_
 
+#include <base/memory/scoped_ptr.h>
 #include <base/task.h>
 
 #include "shill/cellular_capability.h"
+#include "shill/modem_gsm_card_proxy_interface.h"
 
 namespace shill {
 
-class CellularCapabilityGSM : public CellularCapability {
+class CellularCapabilityGSM : public CellularCapability,
+                              public ModemGSMCardProxyDelegate {
  public:
   CellularCapabilityGSM(Cellular *cellular);
 
@@ -26,12 +29,19 @@
                          const std::string &new_pin,
                          Error *error);
 
+  // Obtains the IMEI, IMSI, SPN and MSISDN.
+  virtual void GetIdentifiers();
+
  private:
+  friend class CellularCapabilityGSMTest;
+
   void RequirePINTask(const std::string &pin, bool require);
   void EnterPINTask(const std::string &pin);
   void UnblockPINTask(const std::string &unblock_code, const std::string &pin);
   void ChangePINTask(const std::string &old_pin, const std::string &new_pin);
 
+  scoped_ptr<ModemGSMCardProxyInterface> card_proxy_;
+
   ScopedRunnableMethodFactory<CellularCapabilityGSM> task_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(CellularCapabilityGSM);
diff --git a/cellular_capability_gsm_unittest.cc b/cellular_capability_gsm_unittest.cc
index 01d6397..2659727 100644
--- a/cellular_capability_gsm_unittest.cc
+++ b/cellular_capability_gsm_unittest.cc
@@ -12,6 +12,8 @@
 #include "shill/mock_modem_gsm_card_proxy.h"
 #include "shill/nice_mock_control.h"
 
+using testing::Return;
+
 namespace shill {
 
 class CellularCapabilityGSMTest : public testing::Test {
@@ -27,57 +29,87 @@
                                "",
                                "",
                                NULL)),
-        gsm_card_proxy_(new MockModemGSMCardProxy()),
+        card_proxy_(new MockModemGSMCardProxy()),
         capability_(cellular_.get()) {}
 
  protected:
+  static const char kTestCarrier[];
   static const char kPIN[];
   static const char kPUK[];
+  static const char kIMEI[];
+  static const char kIMSI[];
+  static const char kMSISDN[];
+
+  void SetCardProxy() {
+    capability_.card_proxy_.reset(card_proxy_.release());
+  }
 
   NiceMockControl control_;
   EventDispatcher dispatcher_;
   CellularRefPtr cellular_;
-  scoped_ptr<MockModemGSMCardProxy> gsm_card_proxy_;
+  scoped_ptr<MockModemGSMCardProxy> card_proxy_;
   CellularCapabilityGSM capability_;
 };
 
+const char CellularCapabilityGSMTest::kTestCarrier[] = "The Cellular Carrier";
 const char CellularCapabilityGSMTest::kPIN[] = "9876";
 const char CellularCapabilityGSMTest::kPUK[] = "8765";
+const char CellularCapabilityGSMTest::kIMEI[] = "987654321098765";
+const char CellularCapabilityGSMTest::kIMSI[] = "123456789012345";
+const char CellularCapabilityGSMTest::kMSISDN[] = "12345678901";
+
+TEST_F(CellularCapabilityGSMTest, GetIdentifiers) {
+  EXPECT_CALL(*card_proxy_, GetIMEI()).WillOnce(Return(kIMEI));
+  EXPECT_CALL(*card_proxy_, GetIMSI()).WillOnce(Return(kIMSI));
+  EXPECT_CALL(*card_proxy_, GetSPN()).WillOnce(Return(kTestCarrier));
+  EXPECT_CALL(*card_proxy_, GetMSISDN()).WillOnce(Return(kMSISDN));
+  SetCardProxy();
+  capability_.GetIdentifiers();
+  EXPECT_EQ(kIMEI, cellular_->imei());
+  EXPECT_EQ(kIMSI, cellular_->imsi());
+  EXPECT_EQ(kTestCarrier, cellular_->spn());
+  EXPECT_EQ(kMSISDN, cellular_->mdn());
+  capability_.GetIdentifiers();
+  EXPECT_EQ(kIMEI, cellular_->imei());
+  EXPECT_EQ(kIMSI, cellular_->imsi());
+  EXPECT_EQ(kTestCarrier, cellular_->spn());
+  EXPECT_EQ(kMSISDN, cellular_->mdn());
+}
 
 TEST_F(CellularCapabilityGSMTest, RequirePIN) {
   Error error;
-  EXPECT_CALL(*gsm_card_proxy_, EnablePIN(kPIN, true)).Times(1);
+  EXPECT_CALL(*card_proxy_, EnablePIN(kPIN, true)).Times(1);
   capability_.RequirePIN(kPIN, true, &error);
   EXPECT_TRUE(error.IsSuccess());
-  cellular_->set_modem_gsm_card_proxy(gsm_card_proxy_.release());
+  SetCardProxy();
   dispatcher_.DispatchPendingEvents();
 }
 
 TEST_F(CellularCapabilityGSMTest, EnterPIN) {
   Error error;
-  EXPECT_CALL(*gsm_card_proxy_, SendPIN(kPIN)).Times(1);
+  EXPECT_CALL(*card_proxy_, SendPIN(kPIN)).Times(1);
   capability_.EnterPIN(kPIN, &error);
   EXPECT_TRUE(error.IsSuccess());
-  cellular_->set_modem_gsm_card_proxy(gsm_card_proxy_.release());
+  SetCardProxy();
   dispatcher_.DispatchPendingEvents();
 }
 
 TEST_F(CellularCapabilityGSMTest, UnblockPIN) {
   Error error;
-  EXPECT_CALL(*gsm_card_proxy_, SendPUK(kPUK, kPIN)).Times(1);
+  EXPECT_CALL(*card_proxy_, SendPUK(kPUK, kPIN)).Times(1);
   capability_.UnblockPIN(kPUK, kPIN, &error);
   EXPECT_TRUE(error.IsSuccess());
-  cellular_->set_modem_gsm_card_proxy(gsm_card_proxy_.release());
+  SetCardProxy();
   dispatcher_.DispatchPendingEvents();
 }
 
 TEST_F(CellularCapabilityGSMTest, ChangePIN) {
   static const char kOldPIN[] = "1111";
   Error error;
-  EXPECT_CALL(*gsm_card_proxy_, ChangePIN(kOldPIN, kPIN)).Times(1);
+  EXPECT_CALL(*card_proxy_, ChangePIN(kOldPIN, kPIN)).Times(1);
   capability_.ChangePIN(kOldPIN, kPIN, &error);
   EXPECT_TRUE(error.IsSuccess());
-  cellular_->set_modem_gsm_card_proxy(gsm_card_proxy_.release());
+  SetCardProxy();
   dispatcher_.DispatchPendingEvents();
 }
 
diff --git a/cellular_unittest.cc b/cellular_unittest.cc
index a5d1ef0..b9531a5 100644
--- a/cellular_unittest.cc
+++ b/cellular_unittest.cc
@@ -517,7 +517,6 @@
   EXPECT_TRUE(device_->proxy_.get());
   EXPECT_TRUE(device_->simple_proxy_.get());
   EXPECT_TRUE(device_->cdma_proxy_.get());
-  EXPECT_FALSE(device_->gsm_card_proxy_.get());
   EXPECT_FALSE(device_->gsm_network_proxy_.get());
 }
 
@@ -527,7 +526,6 @@
   device_->InitProxies();
   EXPECT_TRUE(device_->proxy_.get());
   EXPECT_TRUE(device_->simple_proxy_.get());
-  EXPECT_TRUE(device_->gsm_card_proxy_.get());
   EXPECT_TRUE(device_->gsm_network_proxy_.get());
   EXPECT_FALSE(device_->cdma_proxy_.get());
 }
@@ -619,35 +617,6 @@
   EXPECT_EQ(kStrength, device_->service_->strength());
 }
 
-TEST_F(CellularTest, GetCDMAIdentifiers) {
-  device_->type_ = Cellular::kTypeCDMA;
-  EXPECT_CALL(*cdma_proxy_, MEID()).WillOnce(Return(kMEID));
-  device_->cdma_proxy_.reset(cdma_proxy_.release());
-  device_->GetModemIdentifiers();
-  EXPECT_EQ(kMEID, device_->meid_);
-  device_->GetModemIdentifiers();
-  EXPECT_EQ(kMEID, device_->meid_);
-}
-
-TEST_F(CellularTest, GetGSMIdentifiers) {
-  device_->type_ = Cellular::kTypeGSM;
-  EXPECT_CALL(*gsm_card_proxy_, GetIMEI()).WillOnce(Return(kIMEI));
-  EXPECT_CALL(*gsm_card_proxy_, GetIMSI()).WillOnce(Return(kIMSI));
-  EXPECT_CALL(*gsm_card_proxy_, GetSPN()).WillOnce(Return(kTestCarrier));
-  EXPECT_CALL(*gsm_card_proxy_, GetMSISDN()).WillOnce(Return(kMSISDN));
-  device_->gsm_card_proxy_.reset(gsm_card_proxy_.release());
-  device_->GetModemIdentifiers();
-  EXPECT_EQ(kIMEI, device_->imei_);
-  EXPECT_EQ(kIMSI, device_->imsi_);
-  EXPECT_EQ(kTestCarrier, device_->gsm_.spn);
-  EXPECT_EQ(kMSISDN, device_->mdn_);
-  device_->GetModemIdentifiers();
-  EXPECT_EQ(kIMEI, device_->imei_);
-  EXPECT_EQ(kIMSI, device_->imsi_);
-  EXPECT_EQ(kTestCarrier, device_->gsm_.spn);
-  EXPECT_EQ(kMSISDN, device_->mdn_);
-}
-
 TEST_F(CellularTest, CreateService) {
   device_->type_ = Cellular::kTypeCDMA;
   static const char kPaymentURL[] = "https://payment.url";