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

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 1264203002: bluetooth: Add histograms and logging for requestDevice() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-web-bluetooth-action
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698