summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 00:15:13 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 00:15:13 +0000
commitd9016b94fa32297313dd431d9c94ce6da3f91cff (patch)
treee4e0925fe46e3beb03db9f06687fdc308cd72368 /chromeos
parente5738a07937558b0e79d047ac69dc119ac4920aa (diff)
downloadchromium_src-d9016b94fa32297313dd431d9c94ce6da3f91cff.zip
chromium_src-d9016b94fa32297313dd431d9c94ce6da3f91cff.tar.gz
chromium_src-d9016b94fa32297313dd431d9c94ce6da3f91cff.tar.bz2
Various fixes to carrier switching.
This CL makes the various fixes needed for carrier switching mentioned in the referenced crbug. R=zelidrag@chromium.org BUG=150711 TEST=Carrier switching works correctly. Review URL: https://chromiumcodereview.appspot.com/10949014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/mock_shill_device_client.h4
-rw-r--r--chromeos/dbus/shill_device_client.cc20
-rw-r--r--chromeos/dbus/shill_device_client.h7
-rw-r--r--chromeos/dbus/shill_device_client_unittest.cc21
4 files changed, 52 insertions, 0 deletions
diff --git a/chromeos/dbus/mock_shill_device_client.h b/chromeos/dbus/mock_shill_device_client.h
index 3110ee53..81c7d30 100644
--- a/chromeos/dbus/mock_shill_device_client.h
+++ b/chromeos/dbus/mock_shill_device_client.h
@@ -64,6 +64,10 @@ class MockShillDeviceClient : public ShillDeviceClient {
const std::string& network_id,
const base::Closure& callback,
const ErrorCallback& error_callback));
+ MOCK_METHOD4(SetCarrier, void(const dbus::ObjectPath& device_path,
+ const std::string& carrier,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback));
};
} // namespace chromeos
diff --git a/chromeos/dbus/shill_device_client.cc b/chromeos/dbus/shill_device_client.cc
index a1c84db..eda7c41 100644
--- a/chromeos/dbus/shill_device_client.cc
+++ b/chromeos/dbus/shill_device_client.cc
@@ -171,6 +171,18 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
&method_call, callback, error_callback);
}
+ virtual void SetCarrier(const dbus::ObjectPath& device_path,
+ const std::string& carrier,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
+ dbus::MethodCall method_call(flimflam::kFlimflamDeviceInterface,
+ shill::kSetCarrierFunction);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(carrier);
+ GetHelper(device_path)->CallVoidMethodWithErrorCallback(
+ &method_call, callback, error_callback);
+ }
+
private:
typedef std::map<std::string, ShillClientHelper*> HelperMap;
@@ -354,6 +366,14 @@ class ShillDeviceClientStubImpl : public ShillDeviceClient {
MessageLoop::current()->PostTask(FROM_HERE, callback);
}
+ // ShillDeviceClient override.
+ virtual void SetCarrier(const dbus::ObjectPath& device_path,
+ const std::string& carrier,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
+ MessageLoop::current()->PostTask(FROM_HERE, callback);
+ }
+
private:
void PassStubDevicePrperties(const dbus::ObjectPath& device_path,
const DictionaryValueCallback& callback) const {
diff --git a/chromeos/dbus/shill_device_client.h b/chromeos/dbus/shill_device_client.h
index 2d17ba2..affe2c4 100644
--- a/chromeos/dbus/shill_device_client.h
+++ b/chromeos/dbus/shill_device_client.h
@@ -140,6 +140,13 @@ class CHROMEOS_EXPORT ShillDeviceClient {
const base::Closure& callback,
const ErrorCallback& error_callback) = 0;
+ // Calls the SetCarrier method.
+ // |callback| is called after the method call finishes.
+ virtual void SetCarrier(const dbus::ObjectPath& device_path,
+ const std::string& carrier,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) = 0;
+
protected:
// Create() should be used instead.
ShillDeviceClient();
diff --git a/chromeos/dbus/shill_device_client_unittest.cc b/chromeos/dbus/shill_device_client_unittest.cc
index 9ecf5fc..a343df8 100644
--- a/chromeos/dbus/shill_device_client_unittest.cc
+++ b/chromeos/dbus/shill_device_client_unittest.cc
@@ -354,4 +354,25 @@ TEST_F(ShillDeviceClientTest, Register) {
message_loop_.RunAllPending();
}
+TEST_F(ShillDeviceClientTest, SetCarrier) {
+ const char kCarrier[] = "carrier";
+ // Create response.
+ scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
+
+ // Set expectations.
+ MockClosure mock_closure;
+ MockErrorCallback mock_error_callback;
+ PrepareForMethodCall(shill::kSetCarrierFunction,
+ base::Bind(&ExpectStringArgument, kCarrier),
+ response.get());
+ EXPECT_CALL(mock_closure, Run()).Times(1);
+ // Call method.
+ client_->SetCarrier(dbus::ObjectPath(kExampleDevicePath),
+ kCarrier,
+ mock_closure.GetCallback(),
+ mock_error_callback.GetCallback());
+ // Run the message loop.
+ message_loop_.RunAllPending();
+}
+
} // namespace chromeos