1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/memory/ref_counted.h"
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "device/bluetooth/bluetooth_adapter.h"
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "device/bluetooth/bluetooth_device.h"
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)using device::BluetoothAdapter;
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)using device::BluetoothDevice;
12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace device {
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class TestBluetoothAdapter : public BluetoothAdapter {
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public:
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  TestBluetoothAdapter() {
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE {
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE {
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual std::string GetAddress() const OVERRIDE {
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return "";
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual std::string GetName() const OVERRIDE {
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return "";
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void SetName(const std::string& name,
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                       const base::Closure& callback,
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                       const ErrorCallback& error_callback) OVERRIDE {
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual bool IsInitialized() const OVERRIDE {
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return false;
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual bool IsPresent() const OVERRIDE {
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return false;
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual bool IsPowered() const OVERRIDE {
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return false;
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void SetPowered(
53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      bool powered,
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const base::Closure& callback,
55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const ErrorCallback& error_callback) OVERRIDE {
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual bool IsDiscoverable() const OVERRIDE {
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return false;
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void SetDiscoverable(
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      bool discoverable,
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const base::Closure& callback,
65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const ErrorCallback& error_callback) OVERRIDE {
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual bool IsDiscovering() const OVERRIDE {
69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return false;
70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void StartDiscoverySession(
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const DiscoverySessionCallback& callback,
74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const ErrorCallback& error_callback) OVERRIDE {
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
77cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void CreateRfcommService(
78cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const BluetoothUUID& uuid,
79116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const ServiceOptions& options,
80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const CreateServiceCallback& callback,
81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const CreateServiceErrorCallback& error_callback) OVERRIDE {
82cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  }
83cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
84cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void CreateL2capService(
85cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const BluetoothUUID& uuid,
86116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const ServiceOptions& options,
87cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const CreateServiceCallback& callback,
88cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const CreateServiceErrorCallback& error_callback) OVERRIDE {
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) protected:
92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual ~TestBluetoothAdapter() {}
93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void AddDiscoverySession(
95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const base::Closure& callback,
96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const ErrorCallback& error_callback) OVERRIDE {
97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void RemoveDiscoverySession(
100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const base::Closure& callback,
101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const ErrorCallback& error_callback) OVERRIDE {
102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void RemovePairingDelegateInternal(
105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE {
106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  public:
111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void RequestPinCode(BluetoothDevice* device) OVERRIDE {}
112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void RequestPasskey(BluetoothDevice* device) OVERRIDE {}
113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void DisplayPinCode(BluetoothDevice* device,
114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               const std::string& pincode) OVERRIDE {}
115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void DisplayPasskey(BluetoothDevice* device,
116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               uint32 passkey) OVERRIDE {}
117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void KeysEntered(BluetoothDevice* device,
118a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            uint32 entered) OVERRIDE {}
119a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void ConfirmPasskey(BluetoothDevice* device,
120a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               uint32 passkey) OVERRIDE {}
121a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   virtual void AuthorizePairing(BluetoothDevice* device) OVERRIDE {}
122a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
123a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
124a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
125a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(BluetoothAdapterTest, NoDefaultPairingDelegate) {
126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter();
127a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
128a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Verify that when there is no registered pairing delegate, NULL is returned.
129a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(adapter->DefaultPairingDelegate() == NULL);
130a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
131a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
132a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(BluetoothAdapterTest, OneDefaultPairingDelegate) {
133a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter();
134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
135a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Verify that when there is one registered pairing delegate, it is returned.
136a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  TestPairingDelegate delegate;
137a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
138a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->AddPairingDelegate(&delegate,
139a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_LOW);
140a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
141a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(&delegate, adapter->DefaultPairingDelegate());
142a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
143a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
144a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(BluetoothAdapterTest, SamePriorityDelegates) {
145a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter();
146a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
147a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Verify that when there are two registered pairing delegates of the same
148a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // priority, the first one registered is returned.
149a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  TestPairingDelegate delegate1, delegate2;
150a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
151a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->AddPairingDelegate(&delegate1,
152a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_LOW);
153a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->AddPairingDelegate(&delegate2,
154a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_LOW);
155a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
156a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(&delegate1, adapter->DefaultPairingDelegate());
157a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
158a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // After unregistering the first, the second can be returned.
159a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->RemovePairingDelegate(&delegate1);
160a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
161a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(&delegate2, adapter->DefaultPairingDelegate());
162a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
163a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
164a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(BluetoothAdapterTest, HighestPriorityDelegate) {
165a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter();
166a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
167a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Verify that when there are two registered pairing delegates, the one with
168a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // the highest priority is returned.
169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  TestPairingDelegate delegate1, delegate2;
170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
171a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->AddPairingDelegate(&delegate1,
172a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_LOW);
173a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->AddPairingDelegate(&delegate2,
174a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
176a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(&delegate2, adapter->DefaultPairingDelegate());
177a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
178a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
179a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(BluetoothAdapterTest, UnregisterDelegate) {
180a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter();
181a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
182a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Verify that after unregistering a delegate, NULL is returned.
183a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  TestPairingDelegate delegate;
184a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
185a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->AddPairingDelegate(&delegate,
186a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_LOW);
187a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  adapter->RemovePairingDelegate(&delegate);
188a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
189a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(adapter->DefaultPairingDelegate() == NULL);
190a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
191a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
192a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace device
193