shill: cellular: Add a friendly name to MobileOperatorInfo

In order to distinguish between HomeProvider and ServingOperator in log
messages, a name tag is added to MobileOperatorInfo objects.

BUG=chromium:370199
TEST=Tested the following:
1. Build and run unit tests.
   P2_TEST_FILTER="shill::*" FEATURES=test emerge-$BOARD -v platform2
2. Deploy package.
   cros deploy $DUT .
3. (DUT) Restart shill.
4. (DUT) Enable shill debug logging as follows:
   ff_debug cellular
   ff_debug --level -2
5. (DUT) Check /var/log/net.log to ensure that shill adds "HomeProvider" and
   "ServingOperator" as name tags of MobileOperatorInfo in debug messages.

Change-Id: I9e9ad96631bcfc32d70944bf8d775a66d0dceb68
Reviewed-on: https://chromium-review.googlesource.com/199945
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: <mcchou@chromium.org>
Commit-Queue: <mcchou@chromium.org>
diff --git a/cellular.cc b/cellular.cc
index cac0f54..0673575 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -120,8 +120,10 @@
       weak_ptr_factory_(this),
       state_(kStateDisabled),
       modem_state_(kModemStateUnknown),
-      home_provider_info_(new MobileOperatorInfo(modem_info->dispatcher())),
-      serving_operator_info_(new MobileOperatorInfo(modem_info->dispatcher())),
+      home_provider_info_(
+          new MobileOperatorInfo(modem_info->dispatcher(), "HomeProvider")),
+      serving_operator_info_(
+          new MobileOperatorInfo(modem_info->dispatcher(), "ServingOperator")),
       mobile_operator_info_observer_(
           new Cellular::MobileOperatorInfoObserver(this)),
       dbus_owner_(owner),
diff --git a/cellular_capability_gsm_unittest.cc b/cellular_capability_gsm_unittest.cc
index fb1d32c..8f1d6fa 100644
--- a/cellular_capability_gsm_unittest.cc
+++ b/cellular_capability_gsm_unittest.cc
@@ -267,8 +267,10 @@
   void SetMockMobileOperatorInfoObjects() {
     CHECK(!mock_home_provider_info_);
     CHECK(!mock_serving_operator_info_);
-    mock_home_provider_info_ = new MockMobileOperatorInfo(&dispatcher_);
-    mock_serving_operator_info_ = new MockMobileOperatorInfo(&dispatcher_);
+    mock_home_provider_info_ =
+        new MockMobileOperatorInfo(&dispatcher_, "HomeProvider");
+    mock_serving_operator_info_ =
+        new MockMobileOperatorInfo(&dispatcher_, "ServingOperator");
     cellular_->set_home_provider_info(mock_home_provider_info_);
     cellular_->set_serving_operator_info(mock_serving_operator_info_);
   }
diff --git a/cellular_capability_universal_cdma_unittest.cc b/cellular_capability_universal_cdma_unittest.cc
index 905f58b..bd57710 100644
--- a/cellular_capability_universal_cdma_unittest.cc
+++ b/cellular_capability_universal_cdma_unittest.cc
@@ -117,8 +117,10 @@
   void SetMockMobileOperatorInfoObjects() {
     CHECK(!mock_home_provider_info_);
     CHECK(!mock_serving_operator_info_);
-    mock_home_provider_info_ = new MockMobileOperatorInfo(dispatcher_);
-    mock_serving_operator_info_ = new MockMobileOperatorInfo(dispatcher_);
+    mock_home_provider_info_ =
+        new MockMobileOperatorInfo(dispatcher_, "HomeProvider");
+    mock_serving_operator_info_ =
+        new MockMobileOperatorInfo(dispatcher_, "ServingOperator");
     cellular_->set_home_provider_info(mock_home_provider_info_);
     cellular_->set_serving_operator_info(mock_serving_operator_info_);
   }
diff --git a/cellular_capability_universal_unittest.cc b/cellular_capability_universal_unittest.cc
index 0221ea0..bae614d 100644
--- a/cellular_capability_universal_unittest.cc
+++ b/cellular_capability_universal_unittest.cc
@@ -214,8 +214,10 @@
   void SetMockMobileOperatorInfoObjects() {
     CHECK(!mock_home_provider_info_);
     CHECK(!mock_serving_operator_info_);
-    mock_home_provider_info_ = new MockMobileOperatorInfo(dispatcher_);
-    mock_serving_operator_info_ = new MockMobileOperatorInfo(dispatcher_);
+    mock_home_provider_info_ =
+        new MockMobileOperatorInfo(dispatcher_, "HomeProvider");
+    mock_serving_operator_info_ =
+        new MockMobileOperatorInfo(dispatcher_, "ServingOperator");
     cellular_->set_home_provider_info(mock_home_provider_info_);
     cellular_->set_serving_operator_info(mock_serving_operator_info_);
   }
@@ -1509,7 +1511,8 @@
 TEST_F(CellularCapabilityUniversalMainTest, GetMdnForOLP) {
   const string kVzwUUID = "c83d6597-dc91-4d48-a3a7-d86b80123751";
   const string kFooUUID = "foo";
-  MockMobileOperatorInfo mock_operator_info(&dispatcher_);
+  MockMobileOperatorInfo mock_operator_info(&dispatcher_,
+                                            "MobileOperatorInfo");
 
   mock_operator_info.SetEmptyDefaultsForProperties();
   EXPECT_CALL(mock_operator_info, IsMobileNetworkOperatorKnown())
diff --git a/cellular_unittest.cc b/cellular_unittest.cc
index 73bde88..968271f 100644
--- a/cellular_unittest.cc
+++ b/cellular_unittest.cc
@@ -186,11 +186,13 @@
   }
 
   void SetMockMobileOperatorInfoObjects() {
-    mock_home_provider_info_ = new MockMobileOperatorInfo(&dispatcher_);
+    mock_home_provider_info_ =
+        new MockMobileOperatorInfo(&dispatcher_, "HomeProvider");
     // Takes ownership.
     device_->set_home_provider_info(mock_home_provider_info_);
 
-    mock_serving_operator_info_ = new MockMobileOperatorInfo(&dispatcher_);
+    mock_serving_operator_info_ =
+        new MockMobileOperatorInfo(&dispatcher_, "ServingOperator");
     // Takes ownership.
     device_->set_serving_operator_info(mock_serving_operator_info_);
   }
diff --git a/mobile_operator_info.cc b/mobile_operator_info.cc
index 79577cd..5606377 100644
--- a/mobile_operator_info.cc
+++ b/mobile_operator_info.cc
@@ -22,83 +22,89 @@
 // It also logs the functions/arguments/results at sane log levels. So the
 // implementation need not leave a trace itself.
 
-MobileOperatorInfo::MobileOperatorInfo(EventDispatcher *dispatcher)
-    : impl_(new MobileOperatorInfoImpl(dispatcher)) {}
+MobileOperatorInfo::MobileOperatorInfo(EventDispatcher *dispatcher,
+                                       const string &info_owner)
+    : impl_(new MobileOperatorInfoImpl(dispatcher, info_owner)) {}
 
 MobileOperatorInfo::~MobileOperatorInfo() {}
 
+string MobileOperatorInfo::GetLogPrefix(const char *func) const {
+  return impl_->info_owner() + ": " + func;
+}
+
 void MobileOperatorInfo::ClearDatabasePaths() {
-  SLOG(Cellular, 3) << __func__;
+  SLOG(Cellular, 3) << GetLogPrefix(__func__);
   impl_->ClearDatabasePaths();
 }
 
 void MobileOperatorInfo::AddDatabasePath(const FilePath &absolute_path) {
-  SLOG(Cellular, 3) << __func__ << "(" << absolute_path.value() << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << absolute_path.value()
+                    << ")";
   impl_->AddDatabasePath(absolute_path);
 }
 
 bool MobileOperatorInfo::Init() {
   auto result = impl_->Init();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 void MobileOperatorInfo::AddObserver(MobileOperatorInfo::Observer *observer) {
-  SLOG(Cellular, 3) << __func__;
+  SLOG(Cellular, 3) << GetLogPrefix(__func__);
   impl_->AddObserver(observer);
 }
 
 void MobileOperatorInfo::RemoveObserver(
     MobileOperatorInfo::Observer *observer) {
-  SLOG(Cellular, 3) << __func__;
+  SLOG(Cellular, 3) << GetLogPrefix(__func__);
   impl_->RemoveObserver(observer);
 }
 
 bool MobileOperatorInfo::IsMobileNetworkOperatorKnown() const {
   auto result = impl_->IsMobileNetworkOperatorKnown();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 bool MobileOperatorInfo::IsMobileVirtualNetworkOperatorKnown() const {
   auto result = impl_->IsMobileVirtualNetworkOperatorKnown();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 const string &MobileOperatorInfo::uuid() const {
   const auto &result = impl_->uuid();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 const string &MobileOperatorInfo::operator_name() const {
   const auto &result = impl_->operator_name();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 const string &MobileOperatorInfo::country() const {
   const auto &result = impl_->country();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 const string &MobileOperatorInfo::mccmnc() const {
   const auto &result = impl_->mccmnc();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 const string &MobileOperatorInfo::sid() const {
   const auto &result = impl_->sid();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 const string &MobileOperatorInfo::nid() const {
   const auto &result = impl_->nid();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
@@ -109,7 +115,8 @@
     for (const auto &mccmnc : result) {
       pp_result << mccmnc << " ";
     }
-    SLOG(Cellular, 3) << __func__ << ": Result[" << pp_result.str() << "]";
+    SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result["
+                      << pp_result.str() << "]";
   }
   return result;
 }
@@ -121,7 +128,8 @@
     for (const auto &sid : result) {
       pp_result << sid << " ";
     }
-    SLOG(Cellular, 3) << __func__ << ": Result[" << pp_result.str() << "]";
+    SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result["
+                      << pp_result.str() << "]";
   }
   return result;
 }
@@ -132,10 +140,11 @@
   if (SLOG_IS_ON(Cellular, 3)) {
     stringstream pp_result;
     for (const auto &operator_name : result) {
-      pp_result << "(" << operator_name.name << ", "
-        << operator_name.language << ") ";
+      pp_result << "(" << operator_name.name << ", " << operator_name.language
+                << ") ";
     }
-    SLOG(Cellular, 3) << __func__ << ": Result[" << pp_result.str() << "]";
+    SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result["
+                      << pp_result.str() << "]";
   }
   return result;
 }
@@ -147,91 +156,90 @@
     stringstream pp_result;
     for (const auto &mobile_apn : result) {
       pp_result << "(apn: " << mobile_apn->apn
-        << ", username: " << mobile_apn->username
-        << ", password: " << mobile_apn->password;
+                << ", username: " << mobile_apn->username
+                << ", password: " << mobile_apn->password;
       pp_result << ", operator_name_list: '";
       for (const auto &operator_name : mobile_apn->operator_name_list) {
-        pp_result << "(" << operator_name.name << ", "
-          << operator_name.language << ") ";
+        pp_result << "(" << operator_name.name << ", " << operator_name.language
+                  << ") ";
       }
       pp_result << "') ";
     }
-    SLOG(Cellular, 3) << __func__ << ": Result[" << pp_result.str() << "]";
+    SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result["
+                      << pp_result.str() << "]";
   }
   return result;
 }
 
-const vector<MobileOperatorInfo::OnlinePortal> &
-MobileOperatorInfo::olp_list() const {
+const vector<MobileOperatorInfo::OnlinePortal> &MobileOperatorInfo::olp_list()
+    const {
   const auto &result = impl_->olp_list();
   if (SLOG_IS_ON(Cellular, 3)) {
     stringstream pp_result;
     for (const auto &olp : result) {
-      pp_result << "(url: " << olp.url
-        << ", method: " << olp.method
-        << ", post_data: " << olp.post_data
-        << ") ";
+      pp_result << "(url: " << olp.url << ", method: " << olp.method
+                << ", post_data: " << olp.post_data << ") ";
     }
-    SLOG(Cellular, 3) << __func__ << ": Result[" << pp_result.str() << "]";
+    SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result["
+                      << pp_result.str() << "]";
   }
   return result;
 }
 
 const string &MobileOperatorInfo::activation_code() const {
   const auto &result = impl_->activation_code();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 bool MobileOperatorInfo::requires_roaming() const {
   auto result = impl_->requires_roaming();
-  SLOG(Cellular, 3) << __func__ << ": Result[" << result << "]";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << ": Result[" << result << "]";
   return result;
 }
 
 void MobileOperatorInfo::UpdateIMSI(const string &imsi) {
-  SLOG(Cellular, 3) << __func__ << "(" << imsi << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << imsi << ")";
   impl_->UpdateIMSI(imsi);
 }
 
 void MobileOperatorInfo::UpdateICCID(const string &iccid) {
-  SLOG(Cellular, 3) << __func__ << "(" << iccid << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << iccid << ")";
   impl_->UpdateICCID(iccid);
 }
 
 void MobileOperatorInfo::UpdateMCCMNC(const string &mccmnc) {
-  SLOG(Cellular, 3) << __func__ << "(" << mccmnc << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << mccmnc << ")";
   impl_->UpdateMCCMNC(mccmnc);
 }
 
 void MobileOperatorInfo::UpdateSID(const string &sid) {
-  SLOG(Cellular, 3) << __func__ << "(" << sid << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << sid << ")";
   impl_->UpdateSID(sid);
 }
 
 void MobileOperatorInfo::UpdateNID(const string &nid) {
-  SLOG(Cellular, 3) << __func__ << "(" << nid << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << nid << ")";
   impl_->UpdateNID(nid);
 }
 
 void MobileOperatorInfo::UpdateOperatorName(const string &operator_name) {
-  SLOG(Cellular, 3) << __func__ << "(" << operator_name << ")";
+  SLOG(Cellular, 3) << GetLogPrefix(__func__) << "(" << operator_name << ")";
   impl_->UpdateOperatorName(operator_name);
 }
 
 void MobileOperatorInfo::UpdateOnlinePortal(const string &url,
                                             const string &method,
                                             const string &post_data) {
-  SLOG(Cellular, 3) << __func__
+  SLOG(Cellular, 3) << GetLogPrefix(__func__)
                     << "(" << url
                     << ", " << method
-                    << ", " << post_data
-                    << ")";
+                    << ", " << post_data << ")";
   impl_->UpdateOnlinePortal(url, method, post_data);
 }
 
 void MobileOperatorInfo::Reset() {
-  SLOG(Cellular ,3) << __func__;
+  SLOG(Cellular, 3) << GetLogPrefix(__func__);
   impl_->Reset();
 }
 
diff --git a/mobile_operator_info.h b/mobile_operator_info.h
index 9b49ea1..ef96304 100644
--- a/mobile_operator_info.h
+++ b/mobile_operator_info.h
@@ -66,11 +66,13 @@
   // |Init| must be called on the constructed object before it is used.
   // This object does not take ownership of dispatcher, and |dispatcher| is
   // expected to outlive this object.
-  explicit MobileOperatorInfo(EventDispatcher *dispatcher);
+  MobileOperatorInfo(EventDispatcher *dispatcher,
+                     const std::string &info_owner);
   virtual ~MobileOperatorInfo();
 
   // These functions can be called before Init to read non default database
   // file(s).
+  std::string GetLogPrefix(const char *func) const;
   void ClearDatabasePaths();
   void AddDatabasePath(const base::FilePath &absolute_path);
 
@@ -206,7 +208,6 @@
 
  private:
   scoped_ptr<MobileOperatorInfoImpl> impl_;
-
   DISALLOW_COPY_AND_ASSIGN(MobileOperatorInfo);
 };
 
diff --git a/mobile_operator_info_impl.cc b/mobile_operator_info_impl.cc
index 8336be7..fba89e7 100644
--- a/mobile_operator_info_impl.cc
+++ b/mobile_operator_info_impl.cc
@@ -54,10 +54,11 @@
 
 }  // namespace
 
-MobileOperatorInfoImpl::MobileOperatorInfoImpl(EventDispatcher *dispatcher)
+MobileOperatorInfoImpl::MobileOperatorInfoImpl(EventDispatcher *dispatcher,
+                                               const string &info_owner)
     : dispatcher_(dispatcher),
-      observers_(
-          ObserverList<MobileOperatorInfo::Observer, true>::NOTIFY_ALL),
+      info_owner_(info_owner),
+      observers_(ObserverList<MobileOperatorInfo::Observer, true>::NOTIFY_ALL),
       operator_code_type_(kOperatorCodeTypeUnknown),
       current_mno_(nullptr),
       current_mvno_(nullptr),
@@ -88,18 +89,17 @@
   for (const auto &database_path : database_paths_) {
     const char *database_path_cstr = database_path.value().c_str();
     scoped_ptr<CopyingInputStreamAdaptor> database_stream;
-    database_stream.reset(
-        protobuf_lite_file_input_stream(database_path_cstr));
+    database_stream.reset(protobuf_lite_file_input_stream(database_path_cstr));
     if (!database_stream.get()) {
       LOG(ERROR) << "Failed to read mobile operator database: "
-                  << database_path_cstr;
+                 << database_path_cstr;
       continue;
     }
 
     scoped_ptr<MobileOperatorDB> database(new MobileOperatorDB());
     if (!database->ParseFromZeroCopyStream(database_stream.get())) {
       LOG(ERROR) << "Could not parse mobile operator database: "
-                  << database_path_cstr;
+                 << database_path_cstr;
       continue;
     }
     LOG(INFO) << "Successfully loaded database: " << database_path_cstr;
@@ -110,7 +110,7 @@
   // Collate all loaded databases into one.
   if (databases.size() == 0) {
     LOG(ERROR) << "Could not read any mobile operator database. "
-                << "Will not be able to determine MVNO.";
+               << "Will not be able to determine MVNO.";
     return false;
   }
 
@@ -144,6 +144,10 @@
 
 // ///////////////////////////////////////////////////////////////////////////
 // Getters.
+const string &MobileOperatorInfoImpl::info_owner() const {
+  return info_owner_;
+}
+
 const string &MobileOperatorInfoImpl::uuid() const {
   return uuid_;
 }
@@ -245,7 +249,7 @@
   user_iccid_ = iccid;
   // |iccid| is not an exposed property, so don't raise event for just this
   // property update.
-  if(UpdateMVNO()) {
+  if (UpdateMVNO()) {
     PostNotifyOperatorChanged();
   }
 }
@@ -319,7 +323,7 @@
     DCHECK(!candidates_by_name_.empty());
   } else {
     LOG(INFO) << "Operator name [" << operator_name << "] does not match any "
-               << "MNO.";
+              << "MNO.";
   }
 
   operator_changed |= UpdateMNO();
@@ -415,7 +419,7 @@
   if (database_->imvno_size() > 0) {
     // TODO(pprabhu) Support IMVNOs.
     LOG(ERROR) << "InternationalMobileVirtualNetworkOperators are not "
-                << "supported yet. Ignoring all IMVNOs.";
+               << "supported yet. Ignoring all IMVNOs.";
   }
 }
 
@@ -426,7 +430,6 @@
     StringToMNOListMap &table,
     const string &key,
     const MobileNetworkOperator *value) {
-
   if (table.find(key) == table.end()) {
     vector<const MobileNetworkOperator *> empty_mno_list;
     table[key] = empty_mno_list;  // |empty_mno_list| copied.
@@ -481,7 +484,7 @@
 }
 
 string MobileOperatorInfoImpl::OperatorCodeString() const {
-  switch(operator_code_type_) {
+  switch (operator_code_type_) {
     case kOperatorCodeTypeMCCMNC:
       return "MCCMNC";
     case kOperatorCodeTypeSID:
@@ -632,8 +635,7 @@
       to_match = user_mccmnc_;
       break;
     default:
-      SLOG(Cellular, 1) << "Unknown filter type [" << filter.type()
-                        << "]";
+      SLOG(Cellular, 1) << "Unknown filter type [" << filter.type() << "]";
       return false;
   }
   // |to_match| can be empty if we have no *user provided* information of the
@@ -662,7 +664,7 @@
   int regcomp_error = regcomp(&filter_regex,
                               filter_regex_str.c_str(),
                               REG_EXTENDED | REG_NOSUB);
-  if(regcomp_error) {
+  if (regcomp_error) {
     LOG(WARNING) << "Could not compile regex '" << filter.regex() << "'. "
                  << "Error returned: "
                  << GetRegError(regcomp_error, &filter_regex) << ". ";
diff --git a/mobile_operator_info_impl.h b/mobile_operator_info_impl.h
index ffea1f8..1cd6b5a 100644
--- a/mobile_operator_info_impl.h
+++ b/mobile_operator_info_impl.h
@@ -27,7 +27,8 @@
            std::vector<const mobile_operator_db::MobileNetworkOperator *>>
       StringToMNOListMap;
 
-  explicit MobileOperatorInfoImpl(EventDispatcher *dispatcher);
+  MobileOperatorInfoImpl(EventDispatcher *dispatcher,
+                         const std::string &info_owner);
   ~MobileOperatorInfoImpl();
 
   // API functions of the interface.
@@ -39,6 +40,7 @@
   void RemoveObserver(MobileOperatorInfo::Observer *observer);
   bool IsMobileNetworkOperatorKnown() const;
   bool IsMobileVirtualNetworkOperatorKnown() const;
+  const std::string &info_owner() const;
   const std::string &uuid() const;
   const std::string &operator_name() const;
   const std::string &country() const;
@@ -70,7 +72,7 @@
   // ///////////////////////////////////////////////////////////////////////////
   // Static variables.
   // Default databases to load.
-  static const char * const kDefaultDatabasePaths[];
+  static const char *const kDefaultDatabasePaths[];
   // MCCMNC can be of length 5 or 6. When using this constant, keep in mind that
   // the lenght of MCCMNC can by |kMCCMNCMinLen| or |kMCCMNCMinLen + 1|.
   static const int kMCCMNCMinLen;
@@ -132,6 +134,8 @@
   // Not owned by MobileOperatorInfoImpl.
   EventDispatcher *const dispatcher_;
 
+  const std::string info_owner_;
+
   // Owned by MobileOperatorInfoImpl, may be created externally.
   std::vector<base::FilePath> database_paths_;
 
diff --git a/mobile_operator_info_unittest.cc b/mobile_operator_info_unittest.cc
index fbc7d76..a3b2806 100644
--- a/mobile_operator_info_unittest.cc
+++ b/mobile_operator_info_unittest.cc
@@ -52,7 +52,7 @@
 class MobileOperatorInfoInitTest : public Test {
  public:
   MobileOperatorInfoInitTest()
-      : operator_info_(new MobileOperatorInfo(&dispatcher_)),
+      : operator_info_(new MobileOperatorInfo(&dispatcher_, "Operator")),
         operator_info_impl_(operator_info_->impl()) {}
 
   virtual void TearDown() override {
diff --git a/mock_mobile_operator_info.cc b/mock_mobile_operator_info.cc
index de6336b..aa6ec12 100644
--- a/mock_mobile_operator_info.cc
+++ b/mock_mobile_operator_info.cc
@@ -8,8 +8,9 @@
 
 namespace shill {
 
-MockMobileOperatorInfo::MockMobileOperatorInfo(EventDispatcher *dispatcher)
-    : MobileOperatorInfo(dispatcher) {}
+MockMobileOperatorInfo::MockMobileOperatorInfo(EventDispatcher *dispatcher,
+                                               const std::string &info_owner)
+    : MobileOperatorInfo(dispatcher, info_owner) {}
 
 MockMobileOperatorInfo::~MockMobileOperatorInfo() {}
 
diff --git a/mock_mobile_operator_info.h b/mock_mobile_operator_info.h
index 0d33bfc..a3ebfd0 100644
--- a/mock_mobile_operator_info.h
+++ b/mock_mobile_operator_info.h
@@ -18,7 +18,8 @@
 
 class MockMobileOperatorInfo : public MobileOperatorInfo {
  public:
-  explicit MockMobileOperatorInfo(EventDispatcher *dispatcher);
+  MockMobileOperatorInfo(EventDispatcher *dispatcher,
+                         const std::string &info_owner);
   virtual ~MockMobileOperatorInfo();
 
   MOCK_CONST_METHOD0(IsMobileNetworkOperatorKnown, bool());