OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid
er.h" | 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid
er.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "device/bluetooth/bluetooth_adapter.h" | 9 #include "device/bluetooth/bluetooth_adapter.h" |
10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 // Adapters | 128 // Adapters |
129 | 129 |
130 // static | 130 // static |
131 scoped_refptr<NiceMockBluetoothAdapter> | 131 scoped_refptr<NiceMockBluetoothAdapter> |
132 LayoutTestBluetoothAdapterProvider::GetBaseAdapter() { | 132 LayoutTestBluetoothAdapterProvider::GetBaseAdapter() { |
133 scoped_refptr<NiceMockBluetoothAdapter> adapter( | 133 scoped_refptr<NiceMockBluetoothAdapter> adapter( |
134 new NiceMockBluetoothAdapter()); | 134 new NiceMockBluetoothAdapter()); |
135 | 135 |
| 136 ON_CALL(*adapter, IsPresent()).WillByDefault(Return(true)); |
| 137 ON_CALL(*adapter, IsPowered()).WillByDefault(Return(true)); |
| 138 |
136 // Using Invoke allows the adapter returned from this method to be futher | 139 // Using Invoke allows the adapter returned from this method to be futher |
137 // modified and have devices added to it. The call to ::GetDevices will | 140 // modified and have devices added to it. The call to ::GetDevices will |
138 // invoke ::GetConstMockDevices, returning all devices added up to that time. | 141 // invoke ::GetConstMockDevices, returning all devices added up to that time. |
139 ON_CALL(*adapter, GetDevices()) | 142 ON_CALL(*adapter, GetDevices()) |
140 .WillByDefault( | 143 .WillByDefault( |
141 Invoke(adapter.get(), &MockBluetoothAdapter::GetConstMockDevices)); | 144 Invoke(adapter.get(), &MockBluetoothAdapter::GetConstMockDevices)); |
142 | 145 |
143 // The call to ::GetDevice will invoke GetMockDevice which returns a device | 146 // The call to ::GetDevice will invoke GetMockDevice which returns a device |
144 // matching the address provided if the device was added to the mock. | 147 // matching the address provided if the device was added to the mock. |
145 ON_CALL(*adapter, GetDevice(_)).WillByDefault(GetMockDevice(adapter.get())); | 148 ON_CALL(*adapter, GetDevice(_)).WillByDefault(GetMockDevice(adapter.get())); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 return base::StringPrintf("%08x-97e5-4cd7-b9f1-f5a427670c59", alias); | 514 return base::StringPrintf("%08x-97e5-4cd7-b9f1-f5a427670c59", alias); |
512 } | 515 } |
513 | 516 |
514 // static | 517 // static |
515 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { | 518 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { |
516 return BluetoothDevice::CanonicalizeAddress( | 519 return BluetoothDevice::CanonicalizeAddress( |
517 base::StringPrintf("%012" PRIx64, addr)); | 520 base::StringPrintf("%012" PRIx64, addr)); |
518 } | 521 } |
519 | 522 |
520 } // namespace content | 523 } // namespace content |
OLD | NEW |