Commit 1dc28965 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Remove Chromecast verification methods from shill client

These are not used anymore (the verification is separately implemented
in Chrome).

BUG=846971

Change-Id: Id96f59850f2e56aeb766c34433b5c8a86a72cf4a
Reviewed-on: https://chromium-review.googlesource.com/c/1283484Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600500}
parent afe32c4a
...@@ -353,32 +353,6 @@ void FakeShillManagerClient::GetService( ...@@ -353,32 +353,6 @@ void FakeShillManagerClient::GetService(
FROM_HERE, base::BindOnce(callback, dbus::ObjectPath())); FROM_HERE, base::BindOnce(callback, dbus::ObjectPath()));
} }
void FakeShillManagerClient::VerifyDestination(
const VerificationProperties& properties,
const BooleanCallback& callback,
const ErrorCallback& error_callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
base::BindOnce(callback, true));
}
void FakeShillManagerClient::VerifyAndEncryptCredentials(
const VerificationProperties& properties,
const std::string& service_path,
const StringCallback& callback,
const ErrorCallback& error_callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(callback, "encrypted_credentials"));
}
void FakeShillManagerClient::VerifyAndEncryptData(
const VerificationProperties& properties,
const std::string& data,
const StringCallback& callback,
const ErrorCallback& error_callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(callback, "encrypted_data"));
}
void FakeShillManagerClient::ConnectToBestServices( void FakeShillManagerClient::ConnectToBestServices(
const base::Closure& callback, const base::Closure& callback,
const ErrorCallback& error_callback) { const ErrorCallback& error_callback) {
......
...@@ -59,18 +59,6 @@ class CHROMEOS_EXPORT FakeShillManagerClient ...@@ -59,18 +59,6 @@ class CHROMEOS_EXPORT FakeShillManagerClient
void GetService(const base::DictionaryValue& properties, void GetService(const base::DictionaryValue& properties,
const ObjectPathCallback& callback, const ObjectPathCallback& callback,
const ErrorCallback& error_callback) override; const ErrorCallback& error_callback) override;
void VerifyDestination(const VerificationProperties& properties,
const BooleanCallback& callback,
const ErrorCallback& error_callback) override;
void VerifyAndEncryptCredentials(
const VerificationProperties& properties,
const std::string& service_path,
const StringCallback& callback,
const ErrorCallback& error_callback) override;
void VerifyAndEncryptData(const VerificationProperties& properties,
const std::string& data,
const StringCallback& callback,
const ErrorCallback& error_callback) override;
void ConnectToBestServices(const base::Closure& callback, void ConnectToBestServices(const base::Closure& callback,
const ErrorCallback& error_callback) override; const ErrorCallback& error_callback) override;
void SetNetworkThrottlingStatus(const NetworkThrottlingStatus& status, void SetNetworkThrottlingStatus(const NetworkThrottlingStatus& status,
......
...@@ -156,62 +156,6 @@ class ShillManagerClientImpl : public ShillManagerClient { ...@@ -156,62 +156,6 @@ class ShillManagerClientImpl : public ShillManagerClient {
error_callback); error_callback);
} }
void VerifyDestination(const VerificationProperties& properties,
const BooleanCallback& callback,
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamManagerInterface,
shill::kVerifyDestinationFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(properties.certificate);
writer.AppendString(properties.public_key);
writer.AppendString(properties.nonce);
writer.AppendString(properties.signed_data);
writer.AppendString(properties.device_serial);
writer.AppendString(properties.device_ssid);
writer.AppendString(properties.device_bssid);
helper_->CallBooleanMethodWithErrorCallback(
&method_call, callback, error_callback);
}
void VerifyAndEncryptCredentials(
const VerificationProperties& properties,
const std::string& service_path,
const StringCallback& callback,
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamManagerInterface,
shill::kVerifyAndEncryptCredentialsFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(properties.certificate);
writer.AppendString(properties.public_key);
writer.AppendString(properties.nonce);
writer.AppendString(properties.signed_data);
writer.AppendString(properties.device_serial);
writer.AppendString(properties.device_ssid);
writer.AppendString(properties.device_bssid);
writer.AppendObjectPath(dbus::ObjectPath(service_path));
helper_->CallStringMethodWithErrorCallback(
&method_call, callback, error_callback);
}
void VerifyAndEncryptData(const VerificationProperties& properties,
const std::string& data,
const StringCallback& callback,
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamManagerInterface,
shill::kVerifyAndEncryptDataFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(properties.certificate);
writer.AppendString(properties.public_key);
writer.AppendString(properties.nonce);
writer.AppendString(properties.signed_data);
writer.AppendString(properties.device_serial);
writer.AppendString(properties.device_ssid);
writer.AppendString(properties.device_bssid);
writer.AppendString(data);
helper_->CallStringMethodWithErrorCallback(
&method_call, callback, error_callback);
}
void ConnectToBestServices(const base::Closure& callback, void ConnectToBestServices(const base::Closure& callback,
const ErrorCallback& error_callback) override { const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamManagerInterface, dbus::MethodCall method_call(shill::kFlimflamManagerInterface,
...@@ -249,9 +193,4 @@ ShillManagerClient* ShillManagerClient::Create() { ...@@ -249,9 +193,4 @@ ShillManagerClient* ShillManagerClient::Create() {
return new ShillManagerClientImpl(); return new ShillManagerClientImpl();
} }
// ShillManagerClient::VerificationProperties implementation.
ShillManagerClient::VerificationProperties::VerificationProperties() = default;
ShillManagerClient::VerificationProperties::~VerificationProperties() = default;
} // namespace chromeos } // namespace chromeos
...@@ -29,8 +29,6 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient { ...@@ -29,8 +29,6 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient {
typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler;
typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback;
typedef ShillClientHelper::ErrorCallback ErrorCallback; typedef ShillClientHelper::ErrorCallback ErrorCallback;
typedef ShillClientHelper::StringCallback StringCallback;
typedef ShillClientHelper::BooleanCallback BooleanCallback;
struct NetworkThrottlingStatus { struct NetworkThrottlingStatus {
// Enable or disable network bandwidth throttling. // Enable or disable network bandwidth throttling.
...@@ -106,38 +104,6 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient { ...@@ -106,38 +104,6 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient {
virtual ~TestInterface() {} virtual ~TestInterface() {}
}; };
// Properties used to verify the origin device.
struct VerificationProperties {
VerificationProperties();
~VerificationProperties();
// A string containing a PEM-encoded X.509 certificate for use in verifying
// the signed data.
std::string certificate;
// A string containing a PEM-encoded RSA public key to be used to compare
// with the one in signedData
std::string public_key;
// A string containing a base64-encoded random binary data for use in
// verifying the signed data.
std::string nonce;
// A string containing the identifying data string signed by the device.
std::string signed_data;
// A string containing the serial number of the device.
std::string device_serial;
// A string containing the SSID of the device. Only set if the device has
// already been setup once.
std::string device_ssid;
// A string containing the BSSID of the device. Only set if the device has
// already been setup.
std::string device_bssid;
};
~ShillManagerClient() override; ~ShillManagerClient() override;
// Factory function, creates a new instance which is owned by the caller. // Factory function, creates a new instance which is owned by the caller.
...@@ -206,30 +172,6 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient { ...@@ -206,30 +172,6 @@ class CHROMEOS_EXPORT ShillManagerClient : public DBusClient {
const ObjectPathCallback& callback, const ObjectPathCallback& callback,
const ErrorCallback& error_callback) = 0; const ErrorCallback& error_callback) = 0;
// Verifies that the given data corresponds to a trusted device, and returns
// true to the callback if it is.
virtual void VerifyDestination(const VerificationProperties& properties,
const BooleanCallback& callback,
const ErrorCallback& error_callback) = 0;
// Verifies that the given data corresponds to a trusted device, and if it is,
// returns the encrypted credentials for connecting to the network represented
// by the given |service_path|, encrypted using the |public_key| for the
// trusted device. If the device is not trusted, returns the empty string.
virtual void VerifyAndEncryptCredentials(
const VerificationProperties& properties,
const std::string& service_path,
const StringCallback& callback,
const ErrorCallback& error_callback) = 0;
// Verifies that the given data corresponds to a trusted device, and returns
// the |data| encrypted using the |public_key| for the trusted device. If the
// device is not trusted, returns the empty string.
virtual void VerifyAndEncryptData(const VerificationProperties& properties,
const std::string& data,
const StringCallback& callback,
const ErrorCallback& error_callback) = 0;
// For each technology present, connects to the "best" service available. // For each technology present, connects to the "best" service available.
// Called once the user is logged in and certificates are loaded. // Called once the user is logged in and certificates are loaded.
virtual void ConnectToBestServices(const base::Closure& callback, virtual void ConnectToBestServices(const base::Closure& callback,
......
...@@ -26,33 +26,6 @@ namespace chromeos { ...@@ -26,33 +26,6 @@ namespace chromeos {
namespace { namespace {
void ExpectStringArguments(const std::vector<std::string>& arguments,
dbus::MessageReader* reader) {
for (std::vector<std::string>::const_iterator iter = arguments.begin();
iter != arguments.end(); ++iter) {
std::string arg_string;
ASSERT_TRUE(reader->PopString(&arg_string));
EXPECT_EQ(*iter, arg_string);
}
EXPECT_FALSE(reader->HasMoreData());
}
void ExpectStringArgumentsFollowedByObjectPath(
const std::vector<std::string>& arguments,
const dbus::ObjectPath& object_path,
dbus::MessageReader* reader) {
for (std::vector<std::string>::const_iterator iter = arguments.begin();
iter != arguments.end(); ++iter) {
std::string arg_string;
ASSERT_TRUE(reader->PopString(&arg_string));
EXPECT_EQ(*iter, arg_string);
}
dbus::ObjectPath path;
ASSERT_TRUE(reader->PopObjectPath(&path));
EXPECT_EQ(object_path, path);
EXPECT_FALSE(reader->HasMoreData());
}
void ExpectThrottlingArguments(bool throttling_enabled_expected, void ExpectThrottlingArguments(bool throttling_enabled_expected,
uint32_t upload_rate_kbits_expected, uint32_t upload_rate_kbits_expected,
uint32_t download_rate_kbits_expected, uint32_t download_rate_kbits_expected,
...@@ -354,125 +327,4 @@ TEST_F(ShillManagerClientTest, GetService) { ...@@ -354,125 +327,4 @@ TEST_F(ShillManagerClientTest, GetService) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
TEST_F(ShillManagerClientTest, VerifyDestination) {
// Create response.
std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
dbus::MessageWriter writer(response.get());
bool expected = true;
writer.AppendBool(expected);
// Set expectations.
std::vector<std::string> arguments;
arguments.push_back("certificate");
arguments.push_back("public_key");
arguments.push_back("nonce");
arguments.push_back("signed_data");
arguments.push_back("device_serial");
arguments.push_back("device_ssid");
arguments.push_back("device_bssid");
PrepareForMethodCall(shill::kVerifyDestinationFunction,
base::Bind(&ExpectStringArguments, arguments),
response.get());
// Call method.
base::MockCallback<ShillManagerClient::ErrorCallback> mock_error_callback;
ShillManagerClient::VerificationProperties properties;
properties.certificate = arguments[0];
properties.public_key = arguments[1];
properties.nonce = arguments[2];
properties.signed_data = arguments[3];
properties.device_serial = arguments[4];
properties.device_ssid = arguments[5];
properties.device_bssid = arguments[6];
client_->VerifyDestination(
properties, base::Bind(&ExpectBoolResultWithoutStatus, expected),
mock_error_callback.Get());
EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0);
// Run the message loop.
base::RunLoop().RunUntilIdle();
}
TEST_F(ShillManagerClientTest, VerifyAndEncryptCredentials) {
// Create response.
std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
dbus::MessageWriter writer(response.get());
std::string expected = "encrypted_credentials";
writer.AppendString(expected);
// Set expectations.
std::vector<std::string> arguments;
arguments.push_back("certificate");
arguments.push_back("public_key");
arguments.push_back("nonce");
arguments.push_back("signed_data");
arguments.push_back("device_serial");
arguments.push_back("device_ssid");
arguments.push_back("device_bssid");
std::string service_path = "/";
dbus::ObjectPath service_path_obj(service_path);
PrepareForMethodCall(shill::kVerifyAndEncryptCredentialsFunction,
base::Bind(&ExpectStringArgumentsFollowedByObjectPath,
arguments,
service_path_obj),
response.get());
// Call method.
base::MockCallback<ShillManagerClient::ErrorCallback> mock_error_callback;
ShillManagerClient::VerificationProperties properties;
properties.certificate = arguments[0];
properties.public_key = arguments[1];
properties.nonce = arguments[2];
properties.signed_data = arguments[3];
properties.device_serial = arguments[4];
properties.device_ssid = arguments[5];
properties.device_bssid = arguments[6];
client_->VerifyAndEncryptCredentials(
properties, service_path,
base::Bind(&ExpectStringResultWithoutStatus, expected),
mock_error_callback.Get());
EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0);
// Run the message loop.
base::RunLoop().RunUntilIdle();
}
TEST_F(ShillManagerClientTest, VerifyAndEncryptData) {
// Create response.
std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
dbus::MessageWriter writer(response.get());
std::string expected = "encrypted_data";
writer.AppendString(expected);
// Set expectations.
std::vector<std::string> arguments;
arguments.push_back("certificate");
arguments.push_back("public_key");
arguments.push_back("nonce");
arguments.push_back("signed_data");
arguments.push_back("device_serial");
arguments.push_back("device_ssid");
arguments.push_back("device_bssid");
arguments.push_back("data");
PrepareForMethodCall(shill::kVerifyAndEncryptDataFunction,
base::Bind(&ExpectStringArguments, arguments),
response.get());
// Call method.
base::MockCallback<ShillManagerClient::ErrorCallback> mock_error_callback;
ShillManagerClient::VerificationProperties properties;
properties.certificate = arguments[0];
properties.public_key = arguments[1];
properties.nonce = arguments[2];
properties.signed_data = arguments[3];
properties.device_serial = arguments[4];
properties.device_ssid = arguments[5];
properties.device_bssid = arguments[6];
client_->VerifyAndEncryptData(
properties, arguments[7],
base::Bind(&ExpectStringResultWithoutStatus, expected),
mock_error_callback.Get());
EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0);
// Run the message loop.
base::RunLoop().RunUntilIdle();
}
} // namespace chromeos } // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment