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

Unified Diff: components/proximity_auth/bluetooth_connection_unittest.cc

Issue 1356943004: Add RemoteDeviceLoader to create RemoteDevice from CryptAuth data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui
Patch Set: move RemoteDevice creation in tests to util function Created 5 years, 3 months 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/bluetooth_connection_unittest.cc
diff --git a/components/proximity_auth/bluetooth_connection_unittest.cc b/components/proximity_auth/bluetooth_connection_unittest.cc
index fb007bab26131ff091b8597c252211ada18dfb0a..33c49ebf83a698851a6a4accf7965e199b35d3d9 100644
--- a/components/proximity_auth/bluetooth_connection_unittest.cc
+++ b/components/proximity_auth/bluetooth_connection_unittest.cc
@@ -7,6 +7,7 @@
#include "base/message_loop/message_loop.h"
#include "base/numerics/safe_conversions.h"
#include "base/run_loop.h"
+#include "components/proximity_auth/proximity_auth_test_util.h"
#include "components/proximity_auth/remote_device.h"
#include "components/proximity_auth/wire_message.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
@@ -29,14 +30,8 @@ using testing::StrictMock;
namespace proximity_auth {
namespace {
-const char kDeviceName[] = "Device name";
const char kOtherDeviceName[] = "Other device name";
-
-const char kBluetoothAddress[] = "11:22:33:44:55:66";
-const char kOtherBluetoothAddress[] = "AA:BB:CC:DD:EE:FF";
-
-const char kPublicKey[] = "Public key";
-const char kPersistentSymmetricKey[] = "PSK";
+const char kOtherBluetoothAddress[] = "FF:BB:CC:DD:EE:FF";
const char kSerializedMessage[] = "Yarrr, this be a serialized message. Yarr!";
const int kSerializedMessageLength = strlen(kSerializedMessage);
@@ -56,7 +51,7 @@ scoped_refptr<net::IOBuffer> CreateReceiveBuffer() {
class MockBluetoothConnection : public BluetoothConnection {
public:
MockBluetoothConnection()
- : BluetoothConnection(CreateRemoteDevice(),
+ : BluetoothConnection(CreateClassicRemoteDeviceForTest(),
device::BluetoothUUID(kUuid)) {}
// Calls back into the parent Connection class.
@@ -76,11 +71,6 @@ class MockBluetoothConnection : public BluetoothConnection {
using BluetoothConnection::Disconnect;
private:
- RemoteDevice CreateRemoteDevice() {
- return RemoteDevice(kDeviceName, kPublicKey, kBluetoothAddress,
- kPersistentSymmetricKey);
- }
-
DISALLOW_COPY_AND_ASSIGN(MockBluetoothConnection);
};
@@ -101,7 +91,12 @@ class ProximityAuthBluetoothConnectionTest : public testing::Test {
public:
ProximityAuthBluetoothConnectionTest()
: adapter_(new device::MockBluetoothAdapter),
- device_(adapter_.get(), 0, kDeviceName, kBluetoothAddress, true, true),
+ device_(adapter_.get(),
+ 0,
+ kTestRemoteDeviceName,
+ kTestRemoteDeviceBluetoothAddress,
+ true,
+ true),
socket_(new StrictMock<device::MockBluetoothSocket>),
uuid_(kUuid) {
device::BluetoothAdapterFactory::SetAdapterForTesting(adapter_);

Powered by Google App Engine
This is Rietveld 408576698