diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-25 20:39:54 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-25 20:39:54 +0000 |
commit | 6f9396659fe310830483e1239816ec90d27a4b35 (patch) | |
tree | 1ab2b1ec89c7cf0f8548e8cad19d4116373f25b3 /chromeos/dbus/fake_shill_device_client.cc | |
parent | 53a6c1eff8bedf9638d4d4c3f2c23898b4587bcc (diff) | |
download | chromium_src-6f9396659fe310830483e1239816ec90d27a4b35.zip chromium_src-6f9396659fe310830483e1239816ec90d27a4b35.tar.gz chromium_src-6f9396659fe310830483e1239816ec90d27a4b35.tar.bz2 |
Eliminate use of sim unlock UI notifications
This includes some changes to the Fake Shill implementation to support
enabling sim lock to test the UI. (Was also tested using pseudomodem).
BUG=279351
For c/b/resources
TBR=xiyuan@chromium.org
Review URL: https://codereview.chromium.org/399303003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_shill_device_client.cc')
-rw-r--r-- | chromeos/dbus/fake_shill_device_client.cc | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/chromeos/dbus/fake_shill_device_client.cc b/chromeos/dbus/fake_shill_device_client.cc index de352b1..623487b 100644 --- a/chromeos/dbus/fake_shill_device_client.cc +++ b/chromeos/dbus/fake_shill_device_client.cc @@ -22,6 +22,8 @@ namespace chromeos { namespace { +std::string kSimPin = "1111"; + void ErrorFunction(const std::string& device_path, const std::string& error_name, const std::string& error_message) { @@ -129,10 +131,34 @@ void FakeShillDeviceClient::RequirePin(const dbus::ObjectPath& device_path, bool require, const base::Closure& callback, const ErrorCallback& error_callback) { - if (!stub_devices_.HasKey(device_path.value())) { + VLOG(1) << "RequirePin: " << device_path.value(); + if (pin != kSimPin) { + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(error_callback, shill::kErrorResultIncorrectPin, "")); + return; + } + base::DictionaryValue* device_properties = NULL; + if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(), + &device_properties)) { PostDeviceNotFoundError(error_callback); return; } + base::DictionaryValue* simlock_dict = NULL; + if (!device_properties->GetDictionaryWithoutPathExpansion( + shill::kSIMLockStatusProperty, &simlock_dict)) { + simlock_dict = new base::DictionaryValue; + device_properties->SetWithoutPathExpansion( + shill::kSIMLockStatusProperty, simlock_dict); + } + simlock_dict->Clear(); + simlock_dict->SetBoolean(shill::kSIMLockEnabledProperty, require); + // TODO(stevenjb): Investigate why non-empty value breaks UI. + std::string lock_type = ""; // shill::kSIMLockPin + simlock_dict->SetString(shill::kSIMLockTypeProperty, lock_type); + simlock_dict->SetInteger(shill::kSIMLockRetriesLeftProperty, 5); + + NotifyObserversPropertyChanged(device_path, shill::kSIMLockStatusProperty); base::MessageLoop::current()->PostTask(FROM_HERE, callback); } @@ -140,6 +166,13 @@ void FakeShillDeviceClient::EnterPin(const dbus::ObjectPath& device_path, const std::string& pin, const base::Closure& callback, const ErrorCallback& error_callback) { + VLOG(1) << "EnterPin: " << device_path.value(); + if (pin != kSimPin) { + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(error_callback, shill::kErrorResultIncorrectPin, "")); + return; + } if (!stub_devices_.HasKey(device_path.value())) { PostDeviceNotFoundError(error_callback); return; @@ -152,6 +185,7 @@ void FakeShillDeviceClient::UnblockPin(const dbus::ObjectPath& device_path, const std::string& pin, const base::Closure& callback, const ErrorCallback& error_callback) { + VLOG(1) << "UnblockPin: " << device_path.value(); if (!stub_devices_.HasKey(device_path.value())) { PostDeviceNotFoundError(error_callback); return; @@ -164,6 +198,7 @@ void FakeShillDeviceClient::ChangePin(const dbus::ObjectPath& device_path, const std::string& new_pin, const base::Closure& callback, const ErrorCallback& error_callback) { + VLOG(1) << "ChangePin: " << device_path.value(); if (!stub_devices_.HasKey(device_path.value())) { PostDeviceNotFoundError(error_callback); return; |