Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc

Issue 2561203002: Migrate weave-related classes from proximity_auth/ble to cryptauth/ble. (Closed)
Patch Set: Moved all general classes from proximity_auth to cryptauth. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc
index 87c814fe25287c7879e4c32ea269919e7540db8a..3c5ff16a141600fd210640a11e9dd6f4798ec2f1 100644
--- a/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc
+++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc
@@ -16,12 +16,12 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/test_simple_task_runner.h"
+#include "components/cryptauth/ble/bluetooth_low_energy_characteristics_finder.h"
#include "components/cryptauth/remote_device.h"
-#include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.h"
+#include "components/cryptauth/wire_message.h"
#include "components/proximity_auth/bluetooth_throttler.h"
#include "components/proximity_auth/connection_finder.h"
#include "components/proximity_auth/proximity_auth_test_util.h"
-#include "components/proximity_auth/wire_message.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_uuid.h"
@@ -62,7 +62,7 @@ const device::BluetoothRemoteGattCharacteristic::Properties
const int kMaxNumberOfTries = 3;
-class MockBluetoothThrottler : public BluetoothThrottler {
+class MockBluetoothThrottler : public cryptauth::BluetoothThrottler {
public:
MockBluetoothThrottler() {}
~MockBluetoothThrottler() override {}
@@ -75,7 +75,7 @@ class MockBluetoothThrottler : public BluetoothThrottler {
};
class MockBluetoothLowEnergyCharacteristicsFinder
- : public BluetoothLowEnergyCharacteristicsFinder {
+ : public cryptauth::BluetoothLowEnergyCharacteristicsFinder {
public:
MockBluetoothLowEnergyCharacteristicsFinder() {}
~MockBluetoothLowEnergyCharacteristicsFinder() override {}
@@ -90,7 +90,7 @@ class MockBluetoothLowEnergyConnection : public BluetoothLowEnergyConnection {
const cryptauth::RemoteDevice& remote_device,
scoped_refptr<device::BluetoothAdapter> adapter,
const device::BluetoothUUID remote_service_uuid,
- BluetoothThrottler* bluetooth_throttler,
+ cryptauth::BluetoothThrottler* bluetooth_throttler,
int max_number_of_write_attempts)
: BluetoothLowEnergyConnection(remote_device,
adapter,
@@ -100,15 +100,15 @@ class MockBluetoothLowEnergyConnection : public BluetoothLowEnergyConnection {
~MockBluetoothLowEnergyConnection() override {}
- MOCK_METHOD2(
- CreateCharacteristicsFinder,
- BluetoothLowEnergyCharacteristicsFinder*(
- const BluetoothLowEnergyCharacteristicsFinder::SuccessCallback&
- success,
- const BluetoothLowEnergyCharacteristicsFinder::ErrorCallback& error));
+ MOCK_METHOD2(CreateCharacteristicsFinder,
+ cryptauth::BluetoothLowEnergyCharacteristicsFinder*(
+ const cryptauth::BluetoothLowEnergyCharacteristicsFinder::
+ SuccessCallback& success,
+ const cryptauth::BluetoothLowEnergyCharacteristicsFinder::
+ ErrorCallback& error));
MOCK_METHOD2(OnDidSendMessage,
- void(const WireMessage& message, bool success));
+ void(const cryptauth::WireMessage& message, bool success));
MOCK_METHOD1(OnBytesReceived, void(const std::string& bytes));
// Exposing inherited protected methods for testing.
@@ -375,9 +375,9 @@ class ProximityAuthBluetoothLowEnergyConnectionTest : public testing::Test {
device::BluetoothDevice::ConnectErrorCallback
create_gatt_connection_error_callback_;
- BluetoothLowEnergyCharacteristicsFinder::SuccessCallback
+ cryptauth::BluetoothLowEnergyCharacteristicsFinder::SuccessCallback
characteristics_finder_success_callback_;
- BluetoothLowEnergyCharacteristicsFinder::ErrorCallback
+ cryptauth::BluetoothLowEnergyCharacteristicsFinder::ErrorCallback
characteristics_finder_error_callback_;
device::BluetoothRemoteGattCharacteristic::NotifySessionCallback
@@ -598,7 +598,8 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionTest,
int message_size = 100;
std::string message(message_size, 'A');
message[0] = 'B';
- connection->SendMessage(base::MakeUnique<FakeWireMessage>(message));
+ connection->SendMessage(
+ base::MakeUnique<cryptauth::FakeWireMessage>(message));
// Expecting that |kSendSignal| + |message_size| + |message| was written.
EXPECT_EQ(last_value_written_on_to_peripheral_char_,
@@ -626,7 +627,8 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionTest,
int message_size = 600;
std::string message(message_size, 'A');
message[0] = 'B';
- connection->SendMessage(base::MakeUnique<FakeWireMessage>(message));
+ connection->SendMessage(
+ base::MakeUnique<cryptauth::FakeWireMessage>(message));
// Expecting that |kSendSignal| + |message_size| was written in the first 8
// bytes.

Powered by Google App Engine
This is Rietveld 408576698