summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chrome_browser_main_linux.cc21
-rw-r--r--chrome/browser/chrome_browser_main_linux.h2
-rw-r--r--chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc1
-rw-r--r--device/BUILD.gn24
-rw-r--r--device/bluetooth/BUILD.gn64
-rw-r--r--device/bluetooth/bluetooth.gyp60
-rw-r--r--device/bluetooth/bluetooth_adapter.cc4
-rw-r--r--device/bluetooth/bluetooth_adapter.h2
-rw-r--r--device/bluetooth/bluetooth_adapter_chromeos.cc (renamed from device/bluetooth/bluetooth_adapter_bluez.cc)604
-rw-r--r--device/bluetooth/bluetooth_adapter_chromeos.h (renamed from device/bluetooth/bluetooth_adapter_bluez.h)99
-rw-r--r--device/bluetooth/bluetooth_adapter_factory.cc13
-rw-r--r--device/bluetooth/bluetooth_adapter_factory.h2
-rw-r--r--device/bluetooth/bluetooth_adapter_profile_chromeos.cc (renamed from device/bluetooth/bluetooth_adapter_profile_bluez.cc)35
-rw-r--r--device/bluetooth/bluetooth_adapter_profile_chromeos.h (renamed from device/bluetooth/bluetooth_adapter_profile_bluez.h)32
-rw-r--r--device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_adapter_profile_bluez_unittest.cc)112
-rw-r--r--device/bluetooth/bluetooth_advertisement_chromeos.cc (renamed from device/bluetooth/bluetooth_advertisement_bluez.cc)22
-rw-r--r--device/bluetooth/bluetooth_advertisement_chromeos.h (renamed from device/bluetooth/bluetooth_advertisement_bluez.h)26
-rw-r--r--device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_advertisement_bluez_unittest.cc)36
-rw-r--r--device/bluetooth/bluetooth_audio_sink_chromeos.cc (renamed from device/bluetooth/bluetooth_audio_sink_bluez.cc)127
-rw-r--r--device/bluetooth/bluetooth_audio_sink_chromeos.h (renamed from device/bluetooth/bluetooth_audio_sink_bluez.h)30
-rw-r--r--device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_audio_sink_bluez_unittest.cc)175
-rw-r--r--device/bluetooth/bluetooth_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_bluez_unittest.cc)573
-rw-r--r--device/bluetooth/bluetooth_device_chromeos.cc (renamed from device/bluetooth/bluetooth_device_bluez.cc)270
-rw-r--r--device/bluetooth/bluetooth_device_chromeos.h (renamed from device/bluetooth/bluetooth_device_bluez.h)44
-rw-r--r--device/bluetooth/bluetooth_discovery_session_outcome.h12
-rw-r--r--device/bluetooth/bluetooth_gatt_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_gatt_bluez_unittest.cc)283
-rw-r--r--device/bluetooth/bluetooth_gatt_connection_chromeos.cc (renamed from device/bluetooth/bluetooth_gatt_connection_bluez.cc)18
-rw-r--r--device/bluetooth/bluetooth_gatt_connection_chromeos.h (renamed from device/bluetooth/bluetooth_gatt_connection_bluez.h)20
-rw-r--r--device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc (renamed from device/bluetooth/bluetooth_gatt_notify_session_bluez.cc)26
-rw-r--r--device/bluetooth/bluetooth_gatt_notify_session_chromeos.h (renamed from device/bluetooth/bluetooth_gatt_notify_session_bluez.h)24
-rw-r--r--device/bluetooth/bluetooth_pairing_chromeos.cc (renamed from device/bluetooth/bluetooth_pairing_bluez.cc)62
-rw-r--r--device/bluetooth/bluetooth_pairing_chromeos.h (renamed from device/bluetooth/bluetooth_pairing_bluez.h)34
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc (renamed from device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc)140
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h (renamed from device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h)34
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc (renamed from device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc)53
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h (renamed from device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h)30
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc (renamed from device/bluetooth/bluetooth_remote_gatt_service_bluez.cc)81
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_service_chromeos.h (renamed from device/bluetooth/bluetooth_remote_gatt_service_bluez.h)58
-rw-r--r--device/bluetooth/bluetooth_socket_chromeos.cc (renamed from device/bluetooth/bluetooth_socket_bluez.cc)177
-rw-r--r--device/bluetooth/bluetooth_socket_chromeos.h (renamed from device/bluetooth/bluetooth_socket_bluez.h)45
-rw-r--r--device/bluetooth/bluetooth_socket_chromeos_unittest.cc (renamed from device/bluetooth/bluetooth_socket_bluez_unittest.cc)141
-rw-r--r--device/bluetooth/bluetooth_socket_thread.h2
-rw-r--r--device/bluetooth/dbus/bluetooth_agent_service_provider.h4
-rw-r--r--device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc1
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc2
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc2
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_manager_client.cc2
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_service_client.cc2
-rw-r--r--device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h2
-rw-r--r--device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h2
-rw-r--r--device/bluetooth/dbus/bluetooth_profile_service_provider.h4
-rw-r--r--device/bluetooth/dbus/bluez_dbus_manager.h2
-rw-r--r--device/bluetooth/dbus/dbus_thread_manager_linux.cc72
-rw-r--r--device/bluetooth/dbus/dbus_thread_manager_linux.h59
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_adapter_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_device_client.cc2
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_device_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_input_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_media_transport_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h6
-rw-r--r--device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h6
-rw-r--r--device/bluetooth/test/mock_bluetooth_adapter.cc2
-rw-r--r--device/bluetooth/test/mock_bluetooth_adapter.h2
-rw-r--r--device/bluetooth/test/mock_bluetooth_advertisement.cc2
-rw-r--r--device/bluetooth/test/mock_bluetooth_advertisement.h8
-rw-r--r--device/device_tests.gyp22
-rw-r--r--extensions/browser/api/bluetooth/bluetooth_event_router.cc3
80 files changed, 1949 insertions, 1978 deletions
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc
index 1090f350..24b37c7 100644
--- a/chrome/browser/chrome_browser_main_linux.cc
+++ b/chrome/browser/chrome_browser_main_linux.cc
@@ -10,8 +10,6 @@
#include "chrome/grit/chromium_strings.h"
#include "components/crash/content/app/breakpad_linux.h"
#include "components/metrics/metrics_service.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/dbus_thread_manager_linux.h"
#include "media/audio/audio_manager.h"
#include "ui/base/l10n/l10n_util.h"
@@ -64,22 +62,3 @@ void ChromeBrowserMainPartsLinux::PostProfileInit() {
g_browser_process->metrics_service()->RecordBreakpadRegistration(
breakpad::IsCrashReporterEnabled());
}
-
-void ChromeBrowserMainPartsLinux::PostMainMessageLoopStart() {
-#if !defined(OS_CHROMEOS)
- bluez::DBusThreadManagerLinux::Initialize();
- bluez::BluezDBusManager::Initialize(
- bluez::DBusThreadManagerLinux::Get()->GetSystemBus(), false);
-#endif
-
- ChromeBrowserMainPartsPosix::PostMainMessageLoopStart();
-}
-
-void ChromeBrowserMainPartsLinux::PostDestroyThreads() {
-#if !defined(OS_CHROMEOS)
- bluez::BluezDBusManager::Shutdown();
- bluez::DBusThreadManagerLinux::Shutdown();
-#endif
-
- ChromeBrowserMainPartsPosix::PostDestroyThreads();
-}
diff --git a/chrome/browser/chrome_browser_main_linux.h b/chrome/browser/chrome_browser_main_linux.h
index ec664c7..aa9ff2f 100644
--- a/chrome/browser/chrome_browser_main_linux.h
+++ b/chrome/browser/chrome_browser_main_linux.h
@@ -20,8 +20,6 @@ class ChromeBrowserMainPartsLinux : public ChromeBrowserMainPartsPosix {
void ToolkitInitialized() override;
void PreProfileInit() override;
void PostProfileInit() override;
- void PostMainMessageLoopStart() override;
- void PostDestroyThreads() override;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsLinux);
diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
index e039325..932d7a9 100644
--- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
@@ -13,6 +13,7 @@
#include "chromeos/dbus/fake_cras_audio_client.h"
#include "chromeos/dbus/fake_power_manager_client.h"
#include "content/public/browser/web_ui.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
diff --git a/device/BUILD.gn b/device/BUILD.gn
index c81e8dc3..4961292 100644
--- a/device/BUILD.gn
+++ b/device/BUILD.gn
@@ -30,14 +30,20 @@ test("device_unittests") {
"battery/battery_status_manager_win_unittest.cc",
"battery/battery_status_service_unittest.cc",
"bluetooth/bluetooth_adapter_mac_unittest.mm",
+ "bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc",
"bluetooth/bluetooth_adapter_unittest.cc",
"bluetooth/bluetooth_adapter_win_unittest.cc",
+ "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
"bluetooth/bluetooth_advertisement_unittest.cc",
+ "bluetooth/bluetooth_audio_sink_chromeos_unittest.cc",
+ "bluetooth/bluetooth_chromeos_unittest.cc",
"bluetooth/bluetooth_device_unittest.cc",
"bluetooth/bluetooth_device_win_unittest.cc",
"bluetooth/bluetooth_discovery_filter_unittest.cc",
+ "bluetooth/bluetooth_gatt_chromeos_unittest.cc",
"bluetooth/bluetooth_low_energy_win_unittest.cc",
"bluetooth/bluetooth_service_record_win_unittest.cc",
+ "bluetooth/bluetooth_socket_chromeos_unittest.cc",
"bluetooth/bluetooth_task_manager_win_unittest.cc",
"bluetooth/bluetooth_uuid_unittest.cc",
"bluetooth/test/bluetooth_test.cc",
@@ -135,28 +141,16 @@ test("device_unittests") {
}
if (is_chromeos) {
+ configs += [ "//build/config/linux:dbus" ]
+
deps += [
"//chromeos",
"//chromeos:test_support",
"//chromeos:test_support_without_gmock",
+ "//dbus",
]
}
- if (is_chromeos || is_linux) {
- configs += [ "//build/config/linux:dbus" ]
-
- sources += [
- "bluetooth/bluetooth_adapter_profile_bluez_unittest.cc",
- "bluetooth/bluetooth_advertisement_bluez_unittest.cc",
- "bluetooth/bluetooth_audio_sink_bluez_unittest.cc",
- "bluetooth/bluetooth_bluez_unittest.cc",
- "bluetooth/bluetooth_gatt_bluez_unittest.cc",
- "bluetooth/bluetooth_socket_bluez_unittest.cc",
- ]
-
- deps += [ "//dbus" ]
- }
-
if (is_posix && !is_android && !is_mac) {
libs = [ "rt" ]
}
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn
index b7bd5f8..69da108 100644
--- a/device/bluetooth/BUILD.gn
+++ b/device/bluetooth/BUILD.gn
@@ -29,16 +29,24 @@ component("bluetooth") {
"bluetooth_adapter.h",
"bluetooth_adapter_android.cc",
"bluetooth_adapter_android.h",
+ "bluetooth_adapter_chromeos.cc",
+ "bluetooth_adapter_chromeos.h",
"bluetooth_adapter_factory.cc",
"bluetooth_adapter_factory.h",
"bluetooth_adapter_mac.h",
"bluetooth_adapter_mac.mm",
+ "bluetooth_adapter_profile_chromeos.cc",
+ "bluetooth_adapter_profile_chromeos.h",
"bluetooth_adapter_win.cc",
"bluetooth_adapter_win.h",
"bluetooth_advertisement.cc",
"bluetooth_advertisement.h",
+ "bluetooth_advertisement_chromeos.cc",
+ "bluetooth_advertisement_chromeos.h",
"bluetooth_audio_sink.cc",
"bluetooth_audio_sink.h",
+ "bluetooth_audio_sink_chromeos.cc",
+ "bluetooth_audio_sink_chromeos.h",
"bluetooth_channel_mac.h",
"bluetooth_channel_mac.mm",
"bluetooth_classic_device_mac.h",
@@ -47,6 +55,8 @@ component("bluetooth") {
"bluetooth_device.h",
"bluetooth_device_android.cc",
"bluetooth_device_android.h",
+ "bluetooth_device_chromeos.cc",
+ "bluetooth_device_chromeos.h",
"bluetooth_device_mac.h",
"bluetooth_device_mac.mm",
"bluetooth_device_win.cc",
@@ -62,10 +72,14 @@ component("bluetooth") {
"bluetooth_gatt_characteristic.h",
"bluetooth_gatt_connection.cc",
"bluetooth_gatt_connection.h",
+ "bluetooth_gatt_connection_chromeos.cc",
+ "bluetooth_gatt_connection_chromeos.h",
"bluetooth_gatt_descriptor.cc",
"bluetooth_gatt_descriptor.h",
"bluetooth_gatt_notify_session.cc",
"bluetooth_gatt_notify_session.h",
+ "bluetooth_gatt_notify_session_chromeos.cc",
+ "bluetooth_gatt_notify_session_chromeos.h",
"bluetooth_gatt_service.cc",
"bluetooth_gatt_service.h",
"bluetooth_init_win.cc",
@@ -82,12 +96,22 @@ component("bluetooth") {
"bluetooth_low_energy_discovery_manager_mac.mm",
"bluetooth_low_energy_win.cc",
"bluetooth_low_energy_win.h",
+ "bluetooth_pairing_chromeos.cc",
+ "bluetooth_pairing_chromeos.h",
+ "bluetooth_remote_gatt_characteristic_chromeos.cc",
+ "bluetooth_remote_gatt_characteristic_chromeos.h",
+ "bluetooth_remote_gatt_descriptor_chromeos.cc",
+ "bluetooth_remote_gatt_descriptor_chromeos.h",
+ "bluetooth_remote_gatt_service_chromeos.cc",
+ "bluetooth_remote_gatt_service_chromeos.h",
"bluetooth_rfcomm_channel_mac.h",
"bluetooth_rfcomm_channel_mac.mm",
"bluetooth_service_record_win.cc",
"bluetooth_service_record_win.h",
"bluetooth_socket.cc",
"bluetooth_socket.h",
+ "bluetooth_socket_chromeos.cc",
+ "bluetooth_socket_chromeos.h",
"bluetooth_socket_mac.h",
"bluetooth_socket_mac.mm",
"bluetooth_socket_net.cc",
@@ -120,11 +144,10 @@ component("bluetooth") {
}
if (is_chromeos) {
- deps += [ "//chromeos" ]
- }
-
- if (is_chromeos || is_linux) {
- deps += [ "//dbus" ]
+ deps += [
+ "//chromeos",
+ "//dbus",
+ ]
}
if (is_mac) {
@@ -135,32 +158,11 @@ component("bluetooth") {
libs = [ "setupapi.lib" ]
}
- if (is_chromeos || is_linux) {
+ # This block will also build for Linux once we write the linux
+ # implementation of BluezDbusManager.
+ if (is_chromeos) {
+ defines += [ "DEVICE_BLUETOOTH_IMPLEMENTATION" ]
sources += [
- "bluetooth_adapter_bluez.cc",
- "bluetooth_adapter_bluez.h",
- "bluetooth_adapter_profile_bluez.cc",
- "bluetooth_adapter_profile_bluez.h",
- "bluetooth_advertisement_bluez.cc",
- "bluetooth_advertisement_bluez.h",
- "bluetooth_audio_sink_bluez.cc",
- "bluetooth_audio_sink_bluez.h",
- "bluetooth_device_bluez.cc",
- "bluetooth_device_bluez.h",
- "bluetooth_gatt_connection_bluez.cc",
- "bluetooth_gatt_connection_bluez.h",
- "bluetooth_gatt_notify_session_bluez.cc",
- "bluetooth_gatt_notify_session_bluez.h",
- "bluetooth_pairing_bluez.cc",
- "bluetooth_pairing_bluez.h",
- "bluetooth_remote_gatt_characteristic_bluez.cc",
- "bluetooth_remote_gatt_characteristic_bluez.h",
- "bluetooth_remote_gatt_descriptor_bluez.cc",
- "bluetooth_remote_gatt_descriptor_bluez.h",
- "bluetooth_remote_gatt_service_bluez.cc",
- "bluetooth_remote_gatt_service_bluez.h",
- "bluetooth_socket_bluez.cc",
- "bluetooth_socket_bluez.h",
"dbus/bluetooth_adapter_client.cc",
"dbus/bluetooth_adapter_client.h",
"dbus/bluetooth_agent_manager_client.cc",
@@ -204,8 +206,6 @@ component("bluetooth") {
"dbus/bluez_dbus_client.h",
"dbus/bluez_dbus_manager.cc",
"dbus/bluez_dbus_manager.h",
- "dbus/dbus_thread_manager_linux.cc",
- "dbus/dbus_thread_manager_linux.h",
"dbus/fake_bluetooth_adapter_client.cc",
"dbus/fake_bluetooth_adapter_client.h",
"dbus/fake_bluetooth_agent_manager_client.cc",
diff --git a/device/bluetooth/bluetooth.gyp b/device/bluetooth/bluetooth.gyp
index df88000..5e4e821 100644
--- a/device/bluetooth/bluetooth.gyp
+++ b/device/bluetooth/bluetooth.gyp
@@ -32,16 +32,24 @@
'bluetooth_adapter.h',
'bluetooth_adapter_android.cc',
'bluetooth_adapter_android.h',
+ 'bluetooth_adapter_chromeos.cc',
+ 'bluetooth_adapter_chromeos.h',
'bluetooth_adapter_factory.cc',
'bluetooth_adapter_factory.h',
'bluetooth_adapter_mac.h',
'bluetooth_adapter_mac.mm',
+ "bluetooth_adapter_profile_chromeos.cc",
+ "bluetooth_adapter_profile_chromeos.h",
'bluetooth_adapter_win.cc',
'bluetooth_adapter_win.h',
'bluetooth_advertisement.cc',
'bluetooth_advertisement.h',
+ 'bluetooth_advertisement_chromeos.cc',
+ 'bluetooth_advertisement_chromeos.h',
'bluetooth_audio_sink.cc',
'bluetooth_audio_sink.h',
+ 'bluetooth_audio_sink_chromeos.cc',
+ 'bluetooth_audio_sink_chromeos.h',
'bluetooth_channel_mac.mm',
'bluetooth_channel_mac.h',
'bluetooth_classic_device_mac.mm',
@@ -50,6 +58,8 @@
'bluetooth_device.h',
'bluetooth_device_android.h',
'bluetooth_device_android.cc',
+ 'bluetooth_device_chromeos.cc',
+ 'bluetooth_device_chromeos.h',
'bluetooth_device_mac.mm',
'bluetooth_device_mac.h',
'bluetooth_device_win.cc',
@@ -65,10 +75,14 @@
'bluetooth_gatt_characteristic.h',
'bluetooth_gatt_connection.cc',
'bluetooth_gatt_connection.h',
+ 'bluetooth_gatt_connection_chromeos.cc',
+ 'bluetooth_gatt_connection_chromeos.h',
'bluetooth_gatt_descriptor.cc',
'bluetooth_gatt_descriptor.h',
'bluetooth_gatt_notify_session.cc',
'bluetooth_gatt_notify_session.h',
+ 'bluetooth_gatt_notify_session_chromeos.cc',
+ 'bluetooth_gatt_notify_session_chromeos.h',
'bluetooth_gatt_service.cc',
'bluetooth_gatt_service.h',
'bluetooth_init_win.cc',
@@ -85,12 +99,22 @@
'bluetooth_low_energy_discovery_manager_mac.mm',
'bluetooth_low_energy_win.cc',
'bluetooth_low_energy_win.h',
+ 'bluetooth_pairing_chromeos.cc',
+ 'bluetooth_pairing_chromeos.h',
+ 'bluetooth_remote_gatt_characteristic_chromeos.cc',
+ 'bluetooth_remote_gatt_characteristic_chromeos.h',
+ 'bluetooth_remote_gatt_descriptor_chromeos.cc',
+ 'bluetooth_remote_gatt_descriptor_chromeos.h',
+ 'bluetooth_remote_gatt_service_chromeos.cc',
+ 'bluetooth_remote_gatt_service_chromeos.h',
'bluetooth_rfcomm_channel_mac.mm',
'bluetooth_rfcomm_channel_mac.h',
'bluetooth_service_record_win.cc',
'bluetooth_service_record_win.h',
'bluetooth_socket.cc',
'bluetooth_socket.h',
+ 'bluetooth_socket_chromeos.cc',
+ 'bluetooth_socket_chromeos.h',
'bluetooth_socket_mac.h',
'bluetooth_socket_mac.mm',
'bluetooth_socket_net.cc',
@@ -107,35 +131,11 @@
'conditions': [
# This block will also build for Linux once we write the linux
# implementation of BluezDbusManager.
- ['chromeos==1 or OS=="linux"', {
+ ['chromeos==1', {
'defines': [
'DEVICE_BLUETOOTH_IMPLEMENTATION',
],
'sources': [
- 'bluetooth_adapter_bluez.cc',
- 'bluetooth_adapter_bluez.h',
- 'bluetooth_adapter_profile_bluez.cc',
- 'bluetooth_adapter_profile_bluez.h',
- 'bluetooth_advertisement_bluez.cc',
- 'bluetooth_advertisement_bluez.h',
- 'bluetooth_audio_sink_bluez.cc',
- 'bluetooth_audio_sink_bluez.h',
- 'bluetooth_device_bluez.cc',
- 'bluetooth_device_bluez.h',
- 'bluetooth_gatt_connection_bluez.cc',
- 'bluetooth_gatt_connection_bluez.h',
- 'bluetooth_gatt_notify_session_bluez.cc',
- 'bluetooth_gatt_notify_session_bluez.h',
- 'bluetooth_pairing_bluez.cc',
- 'bluetooth_pairing_bluez.h',
- 'bluetooth_remote_gatt_characteristic_bluez.cc',
- 'bluetooth_remote_gatt_characteristic_bluez.h',
- 'bluetooth_remote_gatt_descriptor_bluez.cc',
- 'bluetooth_remote_gatt_descriptor_bluez.h',
- 'bluetooth_remote_gatt_service_bluez.cc',
- 'bluetooth_remote_gatt_service_bluez.h',
- 'bluetooth_socket_bluez.cc',
- 'bluetooth_socket_bluez.h',
'dbus/bluetooth_adapter_client.cc',
'dbus/bluetooth_adapter_client.h',
'dbus/bluetooth_le_advertising_manager_client.cc',
@@ -179,8 +179,6 @@
'dbus/bluez_dbus_client.h',
'dbus/bluez_dbus_manager.cc',
'dbus/bluez_dbus_manager.h',
- 'dbus/dbus_thread_manager_linux.cc',
- 'dbus/dbus_thread_manager_linux.h',
'dbus/fake_bluetooth_adapter_client.cc',
'dbus/fake_bluetooth_adapter_client.h',
'dbus/fake_bluetooth_le_advertising_manager_client.cc',
@@ -220,19 +218,17 @@
'dbus/fake_bluetooth_profile_service_provider.cc',
'dbus/fake_bluetooth_profile_service_provider.h',
],
+ }],
+ ['chromeos==1', {
'dependencies': [
'../../build/linux/system.gyp:dbus',
+ '../../chromeos/chromeos.gyp:chromeos',
'../../dbus/dbus.gyp:dbus',
],
'export_dependent_settings': [
'../../build/linux/system.gyp:dbus'
]
}],
- ['chromeos==1', {
- 'dependencies': [
- '../../chromeos/chromeos.gyp:chromeos',
- ],
- }],
['OS == "android"', {
'dependencies': [
'device_bluetooth_java',
diff --git a/device/bluetooth/bluetooth_adapter.cc b/device/bluetooth/bluetooth_adapter.cc
index 0cb190c..f3d15bf 100644
--- a/device/bluetooth/bluetooth_adapter.cc
+++ b/device/bluetooth/bluetooth_adapter.cc
@@ -19,7 +19,7 @@ BluetoothAdapter::ServiceOptions::~ServiceOptions() {
}
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_MACOSX) && \
- !defined(OS_WIN) && !defined(OS_LINUX)
+ !defined(OS_WIN)
// static
base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter(
const InitCallback& init_callback) {
@@ -31,7 +31,7 @@ base::WeakPtr<BluetoothAdapter> BluetoothAdapter::GetWeakPtrForTesting() {
return weak_ptr_factory_.GetWeakPtr();
}
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS)
void BluetoothAdapter::Shutdown() {
NOTIMPLEMENTED();
}
diff --git a/device/bluetooth/bluetooth_adapter.h b/device/bluetooth/bluetooth_adapter.h
index 0479527..801a1fd 100644
--- a/device/bluetooth/bluetooth_adapter.h
+++ b/device/bluetooth/bluetooth_adapter.h
@@ -216,7 +216,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapter
// Returns a weak pointer to an existing adapter for testing purposes only.
base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting();
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS)
// Shutdown the adapter: tear down and clean up all objects owned by
// BluetoothAdapter. After this call, the BluetoothAdapter will behave as if
// no Bluetooth controller exists in the local system. |IsPresent| will return
diff --git a/device/bluetooth/bluetooth_adapter_bluez.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
index 3175f8f..15f30bf 100644
--- a/device/bluetooth/bluetooth_adapter_bluez.cc
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include <string>
@@ -13,17 +13,18 @@
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "device/bluetooth/bluetooth_adapter_profile_bluez.h"
-#include "device/bluetooth/bluetooth_advertisement_bluez.h"
-#include "device/bluetooth/bluetooth_audio_sink_bluez.h"
+#include "chromeos/system/devicetype.h"
+#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
+#include "device/bluetooth/bluetooth_advertisement_chromeos.h"
+#include "device/bluetooth/bluetooth_audio_sink_chromeos.h"
#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/bluetooth_device_bluez.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_discovery_session_outcome.h"
-#include "device/bluetooth/bluetooth_pairing_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
-#include "device/bluetooth/bluetooth_socket_bluez.h"
+#include "device/bluetooth/bluetooth_pairing_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
+#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
@@ -34,10 +35,6 @@
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-#if defined(OS_CHROMEOS)
-#include "chromeos/system/devicetype.h"
-#endif
-
using device::BluetoothAdapter;
using device::BluetoothAudioSink;
using device::BluetoothDevice;
@@ -58,20 +55,20 @@ void OnUnregisterAgentError(const std::string& error_name,
if (error_name == bluetooth_agent_manager::kErrorDoesNotExist)
return;
- LOG(WARNING) << "Failed to unregister pairing agent: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << "Failed to unregister pairing agent: "
+ << error_name << ": " << error_message;
}
UMABluetoothDiscoverySessionOutcome TranslateDiscoveryErrorToUMA(
const std::string& error_name) {
if (error_name == bluez::BluetoothAdapterClient::kUnknownAdapterError) {
- return UMABluetoothDiscoverySessionOutcome::BLUEZ_DBUS_UNKNOWN_ADAPTER;
+ return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_UNKNOWN_ADAPTER;
} else if (error_name == bluez::BluetoothAdapterClient::kNoResponseError) {
- return UMABluetoothDiscoverySessionOutcome::BLUEZ_DBUS_NO_RESPONSE;
+ return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_NO_RESPONSE;
} else if (error_name == bluetooth_device::kErrorInProgress) {
- return UMABluetoothDiscoverySessionOutcome::BLUEZ_DBUS_IN_PROGRESS;
+ return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_IN_PROGRESS;
} else if (error_name == bluetooth_device::kErrorNotReady) {
- return UMABluetoothDiscoverySessionOutcome::BLUEZ_DBUS_NOT_READY;
+ return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_NOT_READY;
} else if (error_name == bluetooth_device::kErrorFailed) {
return UMABluetoothDiscoverySessionOutcome::FAILED;
} else {
@@ -87,20 +84,20 @@ namespace device {
// static
base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter(
const InitCallback& init_callback) {
- return bluez::BluetoothAdapterBlueZ::CreateAdapter();
+ return chromeos::BluetoothAdapterChromeOS::CreateAdapter();
}
} // namespace device
-namespace bluez {
+namespace chromeos {
// static
-base::WeakPtr<BluetoothAdapter> BluetoothAdapterBlueZ::CreateAdapter() {
- BluetoothAdapterBlueZ* adapter = new BluetoothAdapterBlueZ();
+base::WeakPtr<BluetoothAdapter> BluetoothAdapterChromeOS::CreateAdapter() {
+ BluetoothAdapterChromeOS* adapter = new BluetoothAdapterChromeOS();
return adapter->weak_ptr_factory_.GetWeakPtr();
}
-void BluetoothAdapterBlueZ::Shutdown() {
+void BluetoothAdapterChromeOS::Shutdown() {
if (dbus_is_shutdown_)
return;
DCHECK(bluez::BluezDBusManager::IsInitialized())
@@ -136,7 +133,7 @@ void BluetoothAdapterBlueZ::Shutdown() {
dbus_is_shutdown_ = true;
}
-BluetoothAdapterBlueZ::BluetoothAdapterBlueZ()
+BluetoothAdapterChromeOS::BluetoothAdapterChromeOS()
: dbus_is_shutdown_(false),
num_discovery_sessions_(0),
discovery_request_pending_(false),
@@ -165,11 +162,11 @@ BluetoothAdapterBlueZ::BluetoothAdapterBlueZ()
}
}
-BluetoothAdapterBlueZ::~BluetoothAdapterBlueZ() {
+BluetoothAdapterChromeOS::~BluetoothAdapterChromeOS() {
Shutdown();
}
-std::string BluetoothAdapterBlueZ::GetAddress() const {
+std::string BluetoothAdapterChromeOS::GetAddress() const {
if (!IsPresent())
return std::string();
@@ -182,7 +179,7 @@ std::string BluetoothAdapterBlueZ::GetAddress() const {
return BluetoothDevice::CanonicalizeAddress(properties->address.value());
}
-std::string BluetoothAdapterBlueZ::GetName() const {
+std::string BluetoothAdapterChromeOS::GetName() const {
if (!IsPresent())
return std::string();
@@ -195,9 +192,9 @@ std::string BluetoothAdapterBlueZ::GetName() const {
return properties->alias.value();
}
-void BluetoothAdapterBlueZ::SetName(const std::string& name,
- const base::Closure& callback,
- const ErrorCallback& error_callback) {
+void BluetoothAdapterChromeOS::SetName(const std::string& name,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) {
if (!IsPresent()) {
error_callback.Run();
return;
@@ -208,19 +205,19 @@ void BluetoothAdapterBlueZ::SetName(const std::string& name,
->GetProperties(object_path_)
->alias.Set(
name,
- base::Bind(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted,
+ base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-bool BluetoothAdapterBlueZ::IsInitialized() const {
+bool BluetoothAdapterChromeOS::IsInitialized() const {
return true;
}
-bool BluetoothAdapterBlueZ::IsPresent() const {
+bool BluetoothAdapterChromeOS::IsPresent() const {
return !dbus_is_shutdown_ && !object_path_.value().empty();
}
-bool BluetoothAdapterBlueZ::IsPowered() const {
+bool BluetoothAdapterChromeOS::IsPowered() const {
if (!IsPresent())
return false;
@@ -232,9 +229,10 @@ bool BluetoothAdapterBlueZ::IsPowered() const {
return properties->powered.value();
}
-void BluetoothAdapterBlueZ::SetPowered(bool powered,
- const base::Closure& callback,
- const ErrorCallback& error_callback) {
+void BluetoothAdapterChromeOS::SetPowered(
+ bool powered,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) {
if (!IsPresent()) {
error_callback.Run();
return;
@@ -245,11 +243,11 @@ void BluetoothAdapterBlueZ::SetPowered(bool powered,
->GetProperties(object_path_)
->powered.Set(
powered,
- base::Bind(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted,
+ base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-bool BluetoothAdapterBlueZ::IsDiscoverable() const {
+bool BluetoothAdapterChromeOS::IsDiscoverable() const {
if (!IsPresent())
return false;
@@ -261,7 +259,7 @@ bool BluetoothAdapterBlueZ::IsDiscoverable() const {
return properties->discoverable.value();
}
-void BluetoothAdapterBlueZ::SetDiscoverable(
+void BluetoothAdapterChromeOS::SetDiscoverable(
bool discoverable,
const base::Closure& callback,
const ErrorCallback& error_callback) {
@@ -275,11 +273,11 @@ void BluetoothAdapterBlueZ::SetDiscoverable(
->GetProperties(object_path_)
->discoverable.Set(
discoverable,
- base::Bind(&BluetoothAdapterBlueZ::OnSetDiscoverable,
+ base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoverable,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-bool BluetoothAdapterBlueZ::IsDiscovering() const {
+bool BluetoothAdapterChromeOS::IsDiscovering() const {
if (!IsPresent())
return false;
@@ -291,37 +289,45 @@ bool BluetoothAdapterBlueZ::IsDiscovering() const {
return properties->discovering.value();
}
-void BluetoothAdapterBlueZ::CreateRfcommService(
+void BluetoothAdapterChromeOS::CreateRfcommService(
const BluetoothUUID& uuid,
const ServiceOptions& options,
const CreateServiceCallback& callback,
const CreateServiceErrorCallback& error_callback) {
DCHECK(!dbus_is_shutdown_);
- VLOG(1) << object_path_.value()
- << ": Creating RFCOMM service: " << uuid.canonical_value();
- scoped_refptr<BluetoothSocketBlueZ> socket =
- BluetoothSocketBlueZ::CreateBluetoothSocket(ui_task_runner_,
- socket_thread_);
- socket->Listen(this, BluetoothSocketBlueZ::kRfcomm, uuid, options,
- base::Bind(callback, socket), error_callback);
-}
-
-void BluetoothAdapterBlueZ::CreateL2capService(
+ VLOG(1) << object_path_.value() << ": Creating RFCOMM service: "
+ << uuid.canonical_value();
+ scoped_refptr<BluetoothSocketChromeOS> socket =
+ BluetoothSocketChromeOS::CreateBluetoothSocket(
+ ui_task_runner_, socket_thread_);
+ socket->Listen(this,
+ BluetoothSocketChromeOS::kRfcomm,
+ uuid,
+ options,
+ base::Bind(callback, socket),
+ error_callback);
+}
+
+void BluetoothAdapterChromeOS::CreateL2capService(
const BluetoothUUID& uuid,
const ServiceOptions& options,
const CreateServiceCallback& callback,
const CreateServiceErrorCallback& error_callback) {
DCHECK(!dbus_is_shutdown_);
- VLOG(1) << object_path_.value()
- << ": Creating L2CAP service: " << uuid.canonical_value();
- scoped_refptr<BluetoothSocketBlueZ> socket =
- BluetoothSocketBlueZ::CreateBluetoothSocket(ui_task_runner_,
- socket_thread_);
- socket->Listen(this, BluetoothSocketBlueZ::kL2cap, uuid, options,
- base::Bind(callback, socket), error_callback);
-}
-
-void BluetoothAdapterBlueZ::RegisterAudioSink(
+ VLOG(1) << object_path_.value() << ": Creating L2CAP service: "
+ << uuid.canonical_value();
+ scoped_refptr<BluetoothSocketChromeOS> socket =
+ BluetoothSocketChromeOS::CreateBluetoothSocket(
+ ui_task_runner_, socket_thread_);
+ socket->Listen(this,
+ BluetoothSocketChromeOS::kL2cap,
+ uuid,
+ options,
+ base::Bind(callback, socket),
+ error_callback);
+}
+
+void BluetoothAdapterChromeOS::RegisterAudioSink(
const BluetoothAudioSink::Options& options,
const device::BluetoothAdapter::AcquiredCallback& callback,
const BluetoothAudioSink::ErrorCallback& error_callback) {
@@ -330,52 +336,53 @@ void BluetoothAdapterBlueZ::RegisterAudioSink(
error_callback.Run(BluetoothAudioSink::ERROR_INVALID_ADAPTER);
return;
}
- scoped_refptr<BluetoothAudioSinkBlueZ> audio_sink(
- new BluetoothAudioSinkBlueZ(this));
- audio_sink->Register(options,
- base::Bind(&BluetoothAdapterBlueZ::OnRegisterAudioSink,
- weak_ptr_factory_.GetWeakPtr(), callback,
- error_callback, audio_sink),
- error_callback);
+ scoped_refptr<BluetoothAudioSinkChromeOS> audio_sink(
+ new BluetoothAudioSinkChromeOS(this));
+ audio_sink->Register(
+ options, base::Bind(&BluetoothAdapterChromeOS::OnRegisterAudioSink,
+ weak_ptr_factory_.GetWeakPtr(), callback,
+ error_callback, audio_sink),
+ error_callback);
}
-void BluetoothAdapterBlueZ::RegisterAdvertisement(
+void BluetoothAdapterChromeOS::RegisterAdvertisement(
scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data,
const CreateAdvertisementCallback& callback,
const CreateAdvertisementErrorCallback& error_callback) {
- scoped_refptr<BluetoothAdvertisementBlueZ> advertisement(
- new BluetoothAdvertisementBlueZ(advertisement_data.Pass(), this));
+ scoped_refptr<BluetoothAdvertisementChromeOS> advertisement(
+ new BluetoothAdvertisementChromeOS(advertisement_data.Pass(), this));
advertisement->Register(base::Bind(callback, advertisement), error_callback);
}
-void BluetoothAdapterBlueZ::RemovePairingDelegateInternal(
+void BluetoothAdapterChromeOS::RemovePairingDelegateInternal(
BluetoothDevice::PairingDelegate* pairing_delegate) {
// Check if any device is using the pairing delegate.
// If so, clear the pairing context which will make any responses no-ops.
- for (DevicesMap::iterator iter = devices_.begin(); iter != devices_.end();
- ++iter) {
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(iter->second);
+ for (DevicesMap::iterator iter = devices_.begin();
+ iter != devices_.end(); ++iter) {
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(iter->second);
- BluetoothPairingBlueZ* pairing = device_bluez->GetPairing();
+ BluetoothPairingChromeOS* pairing = device_chromeos->GetPairing();
if (pairing && pairing->GetPairingDelegate() == pairing_delegate)
- device_bluez->EndPairing();
+ device_chromeos->EndPairing();
}
}
-void BluetoothAdapterBlueZ::AdapterAdded(const dbus::ObjectPath& object_path) {
+void BluetoothAdapterChromeOS::AdapterAdded(
+ const dbus::ObjectPath& object_path) {
// Set the adapter to the newly added adapter only if no adapter is present.
if (!IsPresent())
SetAdapter(object_path);
}
-void BluetoothAdapterBlueZ::AdapterRemoved(
+void BluetoothAdapterChromeOS::AdapterRemoved(
const dbus::ObjectPath& object_path) {
if (object_path == object_path_)
RemoveAdapter();
}
-void BluetoothAdapterBlueZ::AdapterPropertyChanged(
+void BluetoothAdapterChromeOS::AdapterPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
if (object_path != object_path_)
@@ -396,7 +403,8 @@ void BluetoothAdapterBlueZ::AdapterPropertyChanged(
}
}
-void BluetoothAdapterBlueZ::DeviceAdded(const dbus::ObjectPath& object_path) {
+void BluetoothAdapterChromeOS::DeviceAdded(
+ const dbus::ObjectPath& object_path) {
DCHECK(bluez::BluezDBusManager::Get());
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
@@ -405,37 +413,41 @@ void BluetoothAdapterBlueZ::DeviceAdded(const dbus::ObjectPath& object_path) {
return;
DCHECK(IsPresent());
- BluetoothDeviceBlueZ* device_bluez = new BluetoothDeviceBlueZ(
- this, object_path, ui_task_runner_, socket_thread_);
- DCHECK(devices_.find(device_bluez->GetAddress()) == devices_.end());
+ BluetoothDeviceChromeOS* device_chromeos =
+ new BluetoothDeviceChromeOS(this,
+ object_path,
+ ui_task_runner_,
+ socket_thread_);
+ DCHECK(devices_.find(device_chromeos->GetAddress()) == devices_.end());
- devices_[device_bluez->GetAddress()] = device_bluez;
+ devices_[device_chromeos->GetAddress()] = device_chromeos;
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
- DeviceAdded(this, device_bluez));
+ DeviceAdded(this, device_chromeos));
}
-void BluetoothAdapterBlueZ::DeviceRemoved(const dbus::ObjectPath& object_path) {
- for (DevicesMap::iterator iter = devices_.begin(); iter != devices_.end();
- ++iter) {
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(iter->second);
- if (device_bluez->object_path() == object_path) {
+void BluetoothAdapterChromeOS::DeviceRemoved(
+ const dbus::ObjectPath& object_path) {
+ for (DevicesMap::iterator iter = devices_.begin();
+ iter != devices_.end(); ++iter) {
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(iter->second);
+ if (device_chromeos->object_path() == object_path) {
devices_.erase(iter);
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
- DeviceRemoved(this, device_bluez));
- delete device_bluez;
+ DeviceRemoved(this, device_chromeos));
+ delete device_chromeos;
return;
}
}
}
-void BluetoothAdapterBlueZ::DevicePropertyChanged(
+void BluetoothAdapterChromeOS::DevicePropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
- BluetoothDeviceBlueZ* device_bluez = GetDeviceWithPath(object_path);
- if (!device_bluez)
+ BluetoothDeviceChromeOS* device_chromeos = GetDeviceWithPath(object_path);
+ if (!device_chromeos)
return;
bluez::BluetoothDeviceClient::Properties* properties =
@@ -444,15 +456,15 @@ void BluetoothAdapterBlueZ::DevicePropertyChanged(
if (property_name == properties->address.name()) {
for (auto iter = devices_.begin(); iter != devices_.end(); ++iter) {
- if (iter->second->GetAddress() == device_bluez->GetAddress()) {
+ if (iter->second->GetAddress() == device_chromeos->GetAddress()) {
std::string old_address = iter->first;
VLOG(1) << "Device changed address, old: " << old_address
- << " new: " << device_bluez->GetAddress();
+ << " new: " << device_chromeos->GetAddress();
devices_.erase(iter);
- DCHECK(devices_.find(device_bluez->GetAddress()) == devices_.end());
- devices_[device_bluez->GetAddress()] = device_bluez;
- NotifyDeviceAddressChanged(device_bluez, old_address);
+ DCHECK(devices_.find(device_chromeos->GetAddress()) == devices_.end());
+ devices_[device_chromeos->GetAddress()] = device_chromeos;
+ NotifyDeviceAddressChanged(device_chromeos, old_address);
break;
}
}
@@ -467,14 +479,14 @@ void BluetoothAdapterBlueZ::DevicePropertyChanged(
property_name == properties->uuids.name() ||
property_name == properties->rssi.name() ||
property_name == properties->tx_power.name()) {
- NotifyDeviceChanged(device_bluez);
+ NotifyDeviceChanged(device_chromeos);
}
// When a device becomes paired, mark it as trusted so that the user does
// not need to approve every incoming connection
if (property_name == properties->paired.name() &&
properties->paired.value() && !properties->trusted.value()) {
- device_bluez->SetTrusted();
+ device_chromeos->SetTrusted();
}
// UMA connection counting
@@ -482,14 +494,14 @@ void BluetoothAdapterBlueZ::DevicePropertyChanged(
// PlayStation joystick tries to reconnect after disconnection from USB.
// If it is still not trusted, set it, so it becomes available on the
// list of known devices.
- if (properties->connected.value() && device_bluez->IsTrustable() &&
+ if (properties->connected.value() && device_chromeos->IsTrustable() &&
!properties->trusted.value())
- device_bluez->SetTrusted();
+ device_chromeos->SetTrusted();
int count = 0;
- for (DevicesMap::iterator iter = devices_.begin(); iter != devices_.end();
- ++iter) {
+ for (DevicesMap::iterator iter = devices_.begin();
+ iter != devices_.end(); ++iter) {
if (iter->second->IsPaired() && iter->second->IsConnected())
++count;
}
@@ -498,11 +510,11 @@ void BluetoothAdapterBlueZ::DevicePropertyChanged(
}
}
-void BluetoothAdapterBlueZ::InputPropertyChanged(
+void BluetoothAdapterChromeOS::InputPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
- BluetoothDeviceBlueZ* device_bluez = GetDeviceWithPath(object_path);
- if (!device_bluez)
+ BluetoothDeviceChromeOS* device_chromeos = GetDeviceWithPath(object_path);
+ if (!device_chromeos)
return;
bluez::BluetoothInputClient::Properties* properties =
@@ -513,11 +525,11 @@ void BluetoothAdapterBlueZ::InputPropertyChanged(
// BluetoothDevice::IsConnectable() property, as does a change in the
// actual reconnect_mode property.
if (!properties || property_name == properties->reconnect_mode.name()) {
- NotifyDeviceChanged(device_bluez);
+ NotifyDeviceChanged(device_chromeos);
}
}
-void BluetoothAdapterBlueZ::Released() {
+void BluetoothAdapterChromeOS::Released() {
VLOG(1) << "Release";
if (!IsPresent())
return;
@@ -527,13 +539,14 @@ void BluetoothAdapterBlueZ::Released() {
// capabilities. Nothing much to be done right now.
}
-void BluetoothAdapterBlueZ::RequestPinCode(const dbus::ObjectPath& device_path,
- const PinCodeCallback& callback) {
+void BluetoothAdapterChromeOS::RequestPinCode(
+ const dbus::ObjectPath& device_path,
+ const PinCodeCallback& callback) {
DCHECK(IsPresent());
DCHECK(agent_.get());
VLOG(1) << device_path.value() << ": RequestPinCode";
- BluetoothPairingBlueZ* pairing = GetPairing(device_path);
+ BluetoothPairingChromeOS* pairing = GetPairing(device_path);
if (!pairing) {
callback.Run(REJECTED, "");
return;
@@ -542,26 +555,28 @@ void BluetoothAdapterBlueZ::RequestPinCode(const dbus::ObjectPath& device_path,
pairing->RequestPinCode(callback);
}
-void BluetoothAdapterBlueZ::DisplayPinCode(const dbus::ObjectPath& device_path,
- const std::string& pincode) {
+void BluetoothAdapterChromeOS::DisplayPinCode(
+ const dbus::ObjectPath& device_path,
+ const std::string& pincode) {
DCHECK(IsPresent());
DCHECK(agent_.get());
VLOG(1) << device_path.value() << ": DisplayPinCode: " << pincode;
- BluetoothPairingBlueZ* pairing = GetPairing(device_path);
+ BluetoothPairingChromeOS* pairing = GetPairing(device_path);
if (!pairing)
return;
pairing->DisplayPinCode(pincode);
}
-void BluetoothAdapterBlueZ::RequestPasskey(const dbus::ObjectPath& device_path,
- const PasskeyCallback& callback) {
+void BluetoothAdapterChromeOS::RequestPasskey(
+ const dbus::ObjectPath& device_path,
+ const PasskeyCallback& callback) {
DCHECK(IsPresent());
DCHECK(agent_.get());
VLOG(1) << device_path.value() << ": RequestPasskey";
- BluetoothPairingBlueZ* pairing = GetPairing(device_path);
+ BluetoothPairingChromeOS* pairing = GetPairing(device_path);
if (!pairing) {
callback.Run(REJECTED, 0);
return;
@@ -570,15 +585,16 @@ void BluetoothAdapterBlueZ::RequestPasskey(const dbus::ObjectPath& device_path,
pairing->RequestPasskey(callback);
}
-void BluetoothAdapterBlueZ::DisplayPasskey(const dbus::ObjectPath& device_path,
- uint32 passkey,
- uint16 entered) {
+void BluetoothAdapterChromeOS::DisplayPasskey(
+ const dbus::ObjectPath& device_path,
+ uint32 passkey,
+ uint16 entered) {
DCHECK(IsPresent());
DCHECK(agent_.get());
- VLOG(1) << device_path.value() << ": DisplayPasskey: " << passkey << " ("
- << entered << " entered)";
+ VLOG(1) << device_path.value() << ": DisplayPasskey: " << passkey
+ << " (" << entered << " entered)";
- BluetoothPairingBlueZ* pairing = GetPairing(device_path);
+ BluetoothPairingChromeOS* pairing = GetPairing(device_path);
if (!pairing)
return;
@@ -588,7 +604,7 @@ void BluetoothAdapterBlueZ::DisplayPasskey(const dbus::ObjectPath& device_path,
pairing->KeysEntered(entered);
}
-void BluetoothAdapterBlueZ::RequestConfirmation(
+void BluetoothAdapterChromeOS::RequestConfirmation(
const dbus::ObjectPath& device_path,
uint32 passkey,
const ConfirmationCallback& callback) {
@@ -596,7 +612,7 @@ void BluetoothAdapterBlueZ::RequestConfirmation(
DCHECK(agent_.get());
VLOG(1) << device_path.value() << ": RequestConfirmation: " << passkey;
- BluetoothPairingBlueZ* pairing = GetPairing(device_path);
+ BluetoothPairingChromeOS* pairing = GetPairing(device_path);
if (!pairing) {
callback.Run(REJECTED);
return;
@@ -605,14 +621,14 @@ void BluetoothAdapterBlueZ::RequestConfirmation(
pairing->RequestConfirmation(passkey, callback);
}
-void BluetoothAdapterBlueZ::RequestAuthorization(
+void BluetoothAdapterChromeOS::RequestAuthorization(
const dbus::ObjectPath& device_path,
const ConfirmationCallback& callback) {
DCHECK(IsPresent());
DCHECK(agent_.get());
VLOG(1) << device_path.value() << ": RequestAuthorization";
- BluetoothPairingBlueZ* pairing = GetPairing(device_path);
+ BluetoothPairingChromeOS* pairing = GetPairing(device_path);
if (!pairing) {
callback.Run(REJECTED);
return;
@@ -621,7 +637,7 @@ void BluetoothAdapterBlueZ::RequestAuthorization(
pairing->RequestAuthorization(callback);
}
-void BluetoothAdapterBlueZ::AuthorizeService(
+void BluetoothAdapterChromeOS::AuthorizeService(
const dbus::ObjectPath& device_path,
const std::string& uuid,
const ConfirmationCallback& callback) {
@@ -629,8 +645,8 @@ void BluetoothAdapterBlueZ::AuthorizeService(
DCHECK(agent_.get());
VLOG(1) << device_path.value() << ": AuthorizeService: " << uuid;
- BluetoothDeviceBlueZ* device_bluez = GetDeviceWithPath(device_path);
- if (!device_bluez) {
+ BluetoothDeviceChromeOS* device_chromeos = GetDeviceWithPath(device_path);
+ if (!device_chromeos) {
callback.Run(CANCELLED);
return;
}
@@ -639,7 +655,7 @@ void BluetoothAdapterBlueZ::AuthorizeService(
// method call would ever be called is in the case of a race condition where
// our "Set('Trusted', true)" method call is still pending in the Bluetooth
// daemon because it's busy handling the incoming connection.
- if (device_bluez->IsPaired()) {
+ if (device_chromeos->IsPaired()) {
callback.Run(SUCCESS);
return;
}
@@ -647,52 +663,52 @@ void BluetoothAdapterBlueZ::AuthorizeService(
// TODO(keybuk): reject service authorizations when not paired, determine
// whether this is acceptable long-term.
LOG(WARNING) << "Rejecting service connection from unpaired device "
- << device_bluez->GetAddress() << " for UUID " << uuid;
+ << device_chromeos->GetAddress() << " for UUID " << uuid;
callback.Run(REJECTED);
}
-void BluetoothAdapterBlueZ::Cancel() {
+void BluetoothAdapterChromeOS::Cancel() {
DCHECK(IsPresent());
DCHECK(agent_.get());
VLOG(1) << "Cancel";
}
-void BluetoothAdapterBlueZ::OnRegisterAgent() {
+void BluetoothAdapterChromeOS::OnRegisterAgent() {
VLOG(1) << "Pairing agent registered, requesting to be made default";
bluez::BluezDBusManager::Get()
->GetBluetoothAgentManagerClient()
->RequestDefaultAgent(
dbus::ObjectPath(kAgentPath),
- base::Bind(&BluetoothAdapterBlueZ::OnRequestDefaultAgent,
+ base::Bind(&BluetoothAdapterChromeOS::OnRequestDefaultAgent,
weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&BluetoothAdapterBlueZ::OnRequestDefaultAgentError,
+ base::Bind(&BluetoothAdapterChromeOS::OnRequestDefaultAgentError,
weak_ptr_factory_.GetWeakPtr()));
}
-void BluetoothAdapterBlueZ::OnRegisterAgentError(
+void BluetoothAdapterChromeOS::OnRegisterAgentError(
const std::string& error_name,
const std::string& error_message) {
// Our agent being already registered isn't an error.
if (error_name == bluetooth_agent_manager::kErrorAlreadyExists)
return;
- LOG(WARNING) << ": Failed to register pairing agent: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << ": Failed to register pairing agent: "
+ << error_name << ": " << error_message;
}
-void BluetoothAdapterBlueZ::OnRequestDefaultAgent() {
+void BluetoothAdapterChromeOS::OnRequestDefaultAgent() {
VLOG(1) << "Pairing agent now default";
}
-void BluetoothAdapterBlueZ::OnRequestDefaultAgentError(
+void BluetoothAdapterChromeOS::OnRequestDefaultAgentError(
const std::string& error_name,
const std::string& error_message) {
- LOG(WARNING) << ": Failed to make pairing agent default: " << error_name
- << ": " << error_message;
+ LOG(WARNING) << ": Failed to make pairing agent default: "
+ << error_name << ": " << error_message;
}
-void BluetoothAdapterBlueZ::OnRegisterAudioSink(
+void BluetoothAdapterChromeOS::OnRegisterAudioSink(
const device::BluetoothAdapter::AcquiredCallback& callback,
const device::BluetoothAudioSink::ErrorCallback& error_callback,
scoped_refptr<BluetoothAudioSink> audio_sink) {
@@ -705,33 +721,34 @@ void BluetoothAdapterBlueZ::OnRegisterAudioSink(
callback.Run(audio_sink);
}
-BluetoothDeviceBlueZ* BluetoothAdapterBlueZ::GetDeviceWithPath(
+BluetoothDeviceChromeOS*
+BluetoothAdapterChromeOS::GetDeviceWithPath(
const dbus::ObjectPath& object_path) {
if (!IsPresent())
return nullptr;
for (DevicesMap::iterator iter = devices_.begin(); iter != devices_.end();
++iter) {
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(iter->second);
- if (device_bluez->object_path() == object_path)
- return device_bluez;
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(iter->second);
+ if (device_chromeos->object_path() == object_path)
+ return device_chromeos;
}
return nullptr;
}
-BluetoothPairingBlueZ* BluetoothAdapterBlueZ::GetPairing(
+BluetoothPairingChromeOS* BluetoothAdapterChromeOS::GetPairing(
const dbus::ObjectPath& object_path) {
DCHECK(IsPresent());
- BluetoothDeviceBlueZ* device_bluez = GetDeviceWithPath(object_path);
- if (!device_bluez) {
+ BluetoothDeviceChromeOS* device_chromeos = GetDeviceWithPath(object_path);
+ if (!device_chromeos) {
LOG(WARNING) << "Pairing Agent request for unknown device: "
<< object_path.value();
return nullptr;
}
- BluetoothPairingBlueZ* pairing = device_bluez->GetPairing();
+ BluetoothPairingChromeOS* pairing = device_chromeos->GetPairing();
if (pairing)
return pairing;
@@ -741,10 +758,10 @@ BluetoothPairingBlueZ* BluetoothAdapterBlueZ::GetPairing(
if (!pairing_delegate)
return nullptr;
- return device_bluez->BeginPairing(pairing_delegate);
+ return device_chromeos->BeginPairing(pairing_delegate);
}
-void BluetoothAdapterBlueZ::SetAdapter(const dbus::ObjectPath& object_path) {
+void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) {
DCHECK(!IsPresent());
DCHECK(!dbus_is_shutdown_);
object_path_ = object_path;
@@ -754,12 +771,13 @@ void BluetoothAdapterBlueZ::SetAdapter(const dbus::ObjectPath& object_path) {
VLOG(1) << "Registering pairing agent";
bluez::BluezDBusManager::Get()
->GetBluetoothAgentManagerClient()
- ->RegisterAgent(dbus::ObjectPath(kAgentPath),
- bluetooth_agent_manager::kKeyboardDisplayCapability,
- base::Bind(&BluetoothAdapterBlueZ::OnRegisterAgent,
- weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&BluetoothAdapterBlueZ::OnRegisterAgentError,
- weak_ptr_factory_.GetWeakPtr()));
+ ->RegisterAgent(
+ dbus::ObjectPath(kAgentPath),
+ bluetooth_agent_manager::kKeyboardDisplayCapability,
+ base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgent,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgentError,
+ weak_ptr_factory_.GetWeakPtr()));
SetDefaultAdapterName();
@@ -788,36 +806,32 @@ void BluetoothAdapterBlueZ::SetAdapter(const dbus::ObjectPath& object_path) {
}
}
-void BluetoothAdapterBlueZ::SetDefaultAdapterName() {
+void BluetoothAdapterChromeOS::SetDefaultAdapterName() {
DCHECK(IsPresent());
std::string alias;
-#if defined(OS_CHROMEOS)
switch (chromeos::GetDeviceType()) {
- case chromeos::DeviceType::kChromebase:
+ case DeviceType::kChromebase:
alias = "Chromebase";
break;
- case chromeos::DeviceType::kChromebit:
+ case DeviceType::kChromebit:
alias = "Chromebit";
break;
- case chromeos::DeviceType::kChromebook:
+ case DeviceType::kChromebook:
alias = "Chromebook";
break;
- case chromeos::DeviceType::kChromebox:
+ case DeviceType::kChromebox:
alias = "Chromebox";
break;
- case chromeos::DeviceType::kUnknown:
+ case DeviceType::kUnknown:
alias = "Chromebook";
break;
}
-#elif defined(OS_LINUX)
- alias = "ChromeLinux";
-#endif
SetName(alias, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing));
}
-void BluetoothAdapterBlueZ::RemoveAdapter() {
+void BluetoothAdapterChromeOS::RemoveAdapter() {
DCHECK(IsPresent());
VLOG(1) << object_path_.value() << ": adapter removed.";
@@ -840,8 +854,8 @@ void BluetoothAdapterBlueZ::RemoveAdapter() {
DevicesMap devices = devices_;
devices_.clear();
- for (DevicesMap::iterator iter = devices.begin(); iter != devices.end();
- ++iter) {
+ for (DevicesMap::iterator iter = devices.begin();
+ iter != devices.end(); ++iter) {
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
DeviceRemoved(this, iter->second));
delete iter->second;
@@ -850,17 +864,18 @@ void BluetoothAdapterBlueZ::RemoveAdapter() {
PresentChanged(false);
}
-void BluetoothAdapterBlueZ::PoweredChanged(bool powered) {
+void BluetoothAdapterChromeOS::PoweredChanged(bool powered) {
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
AdapterPoweredChanged(this, powered));
}
-void BluetoothAdapterBlueZ::DiscoverableChanged(bool discoverable) {
+void BluetoothAdapterChromeOS::DiscoverableChanged(bool discoverable) {
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
AdapterDiscoverableChanged(this, discoverable));
}
-void BluetoothAdapterBlueZ::DiscoveringChanged(bool discovering) {
+void BluetoothAdapterChromeOS::DiscoveringChanged(
+ bool discovering) {
// If the adapter stopped discovery due to a reason other than a request by
// us, reset the count to 0.
VLOG(1) << "Discovering changed: " << discovering;
@@ -874,12 +889,13 @@ void BluetoothAdapterBlueZ::DiscoveringChanged(bool discovering) {
AdapterDiscoveringChanged(this, discovering));
}
-void BluetoothAdapterBlueZ::PresentChanged(bool present) {
+void BluetoothAdapterChromeOS::PresentChanged(bool present) {
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
AdapterPresentChanged(this, present));
}
-void BluetoothAdapterBlueZ::NotifyDeviceChanged(BluetoothDeviceBlueZ* device) {
+void BluetoothAdapterChromeOS::NotifyDeviceChanged(
+ BluetoothDeviceChromeOS* device) {
DCHECK(device);
DCHECK(device->adapter_ == this);
@@ -887,8 +903,8 @@ void BluetoothAdapterBlueZ::NotifyDeviceChanged(BluetoothDeviceBlueZ* device) {
DeviceChanged(this, device));
}
-void BluetoothAdapterBlueZ::NotifyDeviceAddressChanged(
- BluetoothDeviceBlueZ* device,
+void BluetoothAdapterChromeOS::NotifyDeviceAddressChanged(
+ BluetoothDeviceChromeOS* device,
const std::string& old_address) {
DCHECK(device->adapter_ == this);
@@ -896,112 +912,118 @@ void BluetoothAdapterBlueZ::NotifyDeviceAddressChanged(
DeviceAddressChanged(this, device, old_address));
}
-void BluetoothAdapterBlueZ::NotifyGattServiceAdded(
- BluetoothRemoteGattServiceBlueZ* service) {
+void BluetoothAdapterChromeOS::NotifyGattServiceAdded(
+ BluetoothRemoteGattServiceChromeOS* service) {
DCHECK_EQ(service->GetAdapter(), this);
- DCHECK_EQ(static_cast<BluetoothDeviceBlueZ*>(service->GetDevice())->adapter_,
- this);
+ DCHECK_EQ(
+ static_cast<BluetoothDeviceChromeOS*>(service->GetDevice())->adapter_,
+ this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattServiceAdded(this, service->GetDevice(), service));
}
-void BluetoothAdapterBlueZ::NotifyGattServiceRemoved(
- BluetoothRemoteGattServiceBlueZ* service) {
+void BluetoothAdapterChromeOS::NotifyGattServiceRemoved(
+ BluetoothRemoteGattServiceChromeOS* service) {
DCHECK_EQ(service->GetAdapter(), this);
- DCHECK_EQ(static_cast<BluetoothDeviceBlueZ*>(service->GetDevice())->adapter_,
- this);
+ DCHECK_EQ(
+ static_cast<BluetoothDeviceChromeOS*>(service->GetDevice())->adapter_,
+ this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattServiceRemoved(this, service->GetDevice(), service));
}
-void BluetoothAdapterBlueZ::NotifyGattServiceChanged(
- BluetoothRemoteGattServiceBlueZ* service) {
+void BluetoothAdapterChromeOS::NotifyGattServiceChanged(
+ BluetoothRemoteGattServiceChromeOS* service) {
DCHECK_EQ(service->GetAdapter(), this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattServiceChanged(this, service));
}
-void BluetoothAdapterBlueZ::NotifyGattDiscoveryComplete(
- BluetoothRemoteGattServiceBlueZ* service) {
+void BluetoothAdapterChromeOS::NotifyGattDiscoveryComplete(
+ BluetoothRemoteGattServiceChromeOS* service) {
DCHECK_EQ(service->GetAdapter(), this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattDiscoveryCompleteForService(this, service));
}
-void BluetoothAdapterBlueZ::NotifyGattCharacteristicAdded(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic) {
- DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
- characteristic->GetService())
- ->GetAdapter(),
+void BluetoothAdapterChromeOS::NotifyGattCharacteristicAdded(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ characteristic->GetService())->GetAdapter(),
this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattCharacteristicAdded(this, characteristic));
}
-void BluetoothAdapterBlueZ::NotifyGattCharacteristicRemoved(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic) {
- DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
- characteristic->GetService())
- ->GetAdapter(),
+void BluetoothAdapterChromeOS::NotifyGattCharacteristicRemoved(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ characteristic->GetService())->GetAdapter(),
this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattCharacteristicRemoved(this, characteristic));
}
-void BluetoothAdapterBlueZ::NotifyGattDescriptorAdded(
- BluetoothRemoteGattDescriptorBlueZ* descriptor) {
- DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
- descriptor->GetCharacteristic()->GetService())
- ->GetAdapter(),
+void BluetoothAdapterChromeOS::NotifyGattDescriptorAdded(
+ BluetoothRemoteGattDescriptorChromeOS* descriptor) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ descriptor->GetCharacteristic()->GetService())->GetAdapter(),
this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattDescriptorAdded(this, descriptor));
}
-void BluetoothAdapterBlueZ::NotifyGattDescriptorRemoved(
- BluetoothRemoteGattDescriptorBlueZ* descriptor) {
- DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
- descriptor->GetCharacteristic()->GetService())
- ->GetAdapter(),
+void BluetoothAdapterChromeOS::NotifyGattDescriptorRemoved(
+ BluetoothRemoteGattDescriptorChromeOS* descriptor) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ descriptor->GetCharacteristic()->GetService())->GetAdapter(),
this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattDescriptorRemoved(this, descriptor));
}
-void BluetoothAdapterBlueZ::NotifyGattCharacteristicValueChanged(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
+void BluetoothAdapterChromeOS::NotifyGattCharacteristicValueChanged(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
const std::vector<uint8>& value) {
- DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
- characteristic->GetService())
- ->GetAdapter(),
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ characteristic->GetService())->GetAdapter(),
this);
FOR_EACH_OBSERVER(
- BluetoothAdapter::Observer, observers_,
+ BluetoothAdapter::Observer,
+ observers_,
GattCharacteristicValueChanged(this, characteristic, value));
}
-void BluetoothAdapterBlueZ::NotifyGattDescriptorValueChanged(
- BluetoothRemoteGattDescriptorBlueZ* descriptor,
+void BluetoothAdapterChromeOS::NotifyGattDescriptorValueChanged(
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
const std::vector<uint8>& value) {
- DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
- descriptor->GetCharacteristic()->GetService())
- ->GetAdapter(),
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ descriptor->GetCharacteristic()->GetService())->GetAdapter(),
this);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
GattDescriptorValueChanged(this, descriptor, value));
}
-void BluetoothAdapterBlueZ::UseProfile(
+void BluetoothAdapterChromeOS::UseProfile(
const BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
const bluez::BluetoothProfileManagerClient::Options& options,
@@ -1025,31 +1047,32 @@ void BluetoothAdapterBlueZ::UseProfile(
}
if (profile_queues_.find(uuid) == profile_queues_.end()) {
- BluetoothAdapterProfileBlueZ::Register(
+ BluetoothAdapterProfileChromeOS::Register(
uuid, options,
- base::Bind(&BluetoothAdapterBlueZ::OnRegisterProfile, this, uuid),
- base::Bind(&BluetoothAdapterBlueZ::OnRegisterProfileError, this, uuid));
+ base::Bind(&BluetoothAdapterChromeOS::OnRegisterProfile, this, uuid),
+ base::Bind(&BluetoothAdapterChromeOS::OnRegisterProfileError, this,
+ uuid));
profile_queues_[uuid] = new std::vector<RegisterProfileCompletionPair>();
}
profile_queues_[uuid]->push_back(std::make_pair(
- base::Bind(&BluetoothAdapterBlueZ::SetProfileDelegate, this, uuid,
+ base::Bind(&BluetoothAdapterChromeOS::SetProfileDelegate, this, uuid,
device_path, delegate, success_callback, error_callback),
error_callback));
}
-void BluetoothAdapterBlueZ::ReleaseProfile(
+void BluetoothAdapterChromeOS::ReleaseProfile(
const dbus::ObjectPath& device_path,
- BluetoothAdapterProfileBlueZ* profile) {
+ BluetoothAdapterProfileChromeOS* profile) {
VLOG(2) << "Releasing Profile: " << profile->uuid().canonical_value()
<< " from " << device_path.value();
profile->RemoveDelegate(
- device_path, base::Bind(&BluetoothAdapterBlueZ::RemoveProfile,
+ device_path, base::Bind(&BluetoothAdapterChromeOS::RemoveProfile,
weak_ptr_factory_.GetWeakPtr(), profile->uuid()));
}
-void BluetoothAdapterBlueZ::RemoveProfile(const BluetoothUUID& uuid) {
+void BluetoothAdapterChromeOS::RemoveProfile(const BluetoothUUID& uuid) {
VLOG(2) << "Remove Profile: " << uuid.canonical_value();
if (profiles_.find(uuid) != profiles_.end()) {
@@ -1058,9 +1081,9 @@ void BluetoothAdapterBlueZ::RemoveProfile(const BluetoothUUID& uuid) {
}
}
-void BluetoothAdapterBlueZ::OnRegisterProfile(
+void BluetoothAdapterChromeOS::OnRegisterProfile(
const BluetoothUUID& uuid,
- scoped_ptr<BluetoothAdapterProfileBlueZ> profile) {
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile) {
profiles_[uuid] = profile.release();
if (profile_queues_.find(uuid) == profile_queues_.end())
@@ -1072,7 +1095,7 @@ void BluetoothAdapterBlueZ::OnRegisterProfile(
profile_queues_.erase(uuid);
}
-void BluetoothAdapterBlueZ::SetProfileDelegate(
+void BluetoothAdapterChromeOS::SetProfileDelegate(
const BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
bluez::BluetoothProfileServiceProvider::Delegate* delegate,
@@ -1091,13 +1114,12 @@ void BluetoothAdapterBlueZ::SetProfileDelegate(
error_callback.Run(bluetooth_agent_manager::kErrorAlreadyExists);
}
-void BluetoothAdapterBlueZ::OnRegisterProfileError(
+void BluetoothAdapterChromeOS::OnRegisterProfileError(
const BluetoothUUID& uuid,
const std::string& error_name,
const std::string& error_message) {
- VLOG(2) << object_path_.value()
- << ": Failed to register profile: " << error_name << ": "
- << error_message;
+ VLOG(2) << object_path_.value() << ": Failed to register profile: "
+ << error_name << ": " << error_message;
if (profile_queues_.find(uuid) == profile_queues_.end())
return;
@@ -1108,7 +1130,7 @@ void BluetoothAdapterBlueZ::OnRegisterProfileError(
profile_queues_.erase(uuid);
}
-void BluetoothAdapterBlueZ::OnSetDiscoverable(
+void BluetoothAdapterChromeOS::OnSetDiscoverable(
const base::Closure& callback,
const ErrorCallback& error_callback,
bool success) {
@@ -1124,11 +1146,11 @@ void BluetoothAdapterBlueZ::OnSetDiscoverable(
->GetProperties(object_path_)
->discoverable_timeout.Set(
0,
- base::Bind(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted,
+ base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-void BluetoothAdapterBlueZ::OnPropertyChangeCompleted(
+void BluetoothAdapterChromeOS::OnPropertyChangeCompleted(
const base::Closure& callback,
const ErrorCallback& error_callback,
bool success) {
@@ -1139,7 +1161,7 @@ void BluetoothAdapterBlueZ::OnPropertyChangeCompleted(
}
}
-void BluetoothAdapterBlueZ::AddDiscoverySession(
+void BluetoothAdapterChromeOS::AddDiscoverySession(
BluetoothDiscoveryFilter* discovery_filter,
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback) {
@@ -1182,9 +1204,9 @@ void BluetoothAdapterBlueZ::AddDiscoverySession(
df->CopyFrom(*discovery_filter);
SetDiscoveryFilter(
df.Pass(),
- base::Bind(&BluetoothAdapterBlueZ::OnPreSetDiscoveryFilter,
+ base::Bind(&BluetoothAdapterChromeOS::OnPreSetDiscoveryFilter,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
- base::Bind(&BluetoothAdapterBlueZ::OnPreSetDiscoveryFilterError,
+ base::Bind(&BluetoothAdapterChromeOS::OnPreSetDiscoveryFilterError,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
return;
} else {
@@ -1195,13 +1217,13 @@ void BluetoothAdapterBlueZ::AddDiscoverySession(
discovery_request_pending_ = true;
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
object_path_,
- base::Bind(&BluetoothAdapterBlueZ::OnStartDiscovery,
+ base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
- base::Bind(&BluetoothAdapterBlueZ::OnStartDiscoveryError,
+ base::Bind(&BluetoothAdapterChromeOS::OnStartDiscoveryError,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-void BluetoothAdapterBlueZ::RemoveDiscoverySession(
+void BluetoothAdapterChromeOS::RemoveDiscoverySession(
BluetoothDiscoveryFilter* discovery_filter,
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback) {
@@ -1248,13 +1270,13 @@ void BluetoothAdapterBlueZ::RemoveDiscoverySession(
DCHECK_EQ(num_discovery_sessions_, 1);
discovery_request_pending_ = true;
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StopDiscovery(
- object_path_, base::Bind(&BluetoothAdapterBlueZ::OnStopDiscovery,
+ object_path_, base::Bind(&BluetoothAdapterChromeOS::OnStopDiscovery,
weak_ptr_factory_.GetWeakPtr(), callback),
- base::Bind(&BluetoothAdapterBlueZ::OnStopDiscoveryError,
+ base::Bind(&BluetoothAdapterChromeOS::OnStopDiscoveryError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothAdapterBlueZ::SetDiscoveryFilter(
+void BluetoothAdapterChromeOS::SetDiscoveryFilter(
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter,
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback) {
@@ -1319,13 +1341,13 @@ void BluetoothAdapterBlueZ::SetDiscoveryFilter(
->GetBluetoothAdapterClient()
->SetDiscoveryFilter(
object_path_, dbus_discovery_filter,
- base::Bind(&BluetoothAdapterBlueZ::OnSetDiscoveryFilter,
+ base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilter,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
- base::Bind(&BluetoothAdapterBlueZ::OnSetDiscoveryFilterError,
+ base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilterError,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-void BluetoothAdapterBlueZ::OnStartDiscovery(
+void BluetoothAdapterChromeOS::OnStartDiscovery(
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback) {
// Report success on the original request and increment the count.
@@ -1344,14 +1366,13 @@ void BluetoothAdapterBlueZ::OnStartDiscovery(
ProcessQueuedDiscoveryRequests();
}
-void BluetoothAdapterBlueZ::OnStartDiscoveryError(
+void BluetoothAdapterChromeOS::OnStartDiscoveryError(
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- LOG(WARNING) << object_path_.value()
- << ": Failed to start discovery: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << object_path_.value() << ": Failed to start discovery: "
+ << error_name << ": " << error_message;
// Failed to start discovery. This can only happen if the count is at 0.
DCHECK_EQ(num_discovery_sessions_, 0);
@@ -1374,7 +1395,7 @@ void BluetoothAdapterBlueZ::OnStartDiscoveryError(
ProcessQueuedDiscoveryRequests();
}
-void BluetoothAdapterBlueZ::OnStopDiscovery(const base::Closure& callback) {
+void BluetoothAdapterChromeOS::OnStopDiscovery(const base::Closure& callback) {
// Report success on the original request and decrement the count.
VLOG(1) << __func__;
DCHECK(discovery_request_pending_);
@@ -1389,13 +1410,12 @@ void BluetoothAdapterBlueZ::OnStopDiscovery(const base::Closure& callback) {
ProcessQueuedDiscoveryRequests();
}
-void BluetoothAdapterBlueZ::OnStopDiscoveryError(
+void BluetoothAdapterChromeOS::OnStopDiscoveryError(
const DiscoverySessionErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- LOG(WARNING) << object_path_.value()
- << ": Failed to stop discovery: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << object_path_.value() << ": Failed to stop discovery: "
+ << error_name << ": " << error_message;
// Failed to stop discovery. This can only happen if the count is at 1.
DCHECK(discovery_request_pending_);
@@ -1407,7 +1427,7 @@ void BluetoothAdapterBlueZ::OnStopDiscoveryError(
ProcessQueuedDiscoveryRequests();
}
-void BluetoothAdapterBlueZ::OnPreSetDiscoveryFilter(
+void BluetoothAdapterChromeOS::OnPreSetDiscoveryFilter(
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback) {
// This is the first request to start device discovery.
@@ -1416,13 +1436,13 @@ void BluetoothAdapterBlueZ::OnPreSetDiscoveryFilter(
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
object_path_,
- base::Bind(&BluetoothAdapterBlueZ::OnStartDiscovery,
+ base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
- base::Bind(&BluetoothAdapterBlueZ::OnStartDiscoveryError,
+ base::Bind(&BluetoothAdapterChromeOS::OnStartDiscoveryError,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
-void BluetoothAdapterBlueZ::OnPreSetDiscoveryFilterError(
+void BluetoothAdapterChromeOS::OnPreSetDiscoveryFilterError(
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback,
UMABluetoothDiscoverySessionOutcome outcome) {
@@ -1440,7 +1460,7 @@ void BluetoothAdapterBlueZ::OnPreSetDiscoveryFilterError(
ProcessQueuedDiscoveryRequests();
}
-void BluetoothAdapterBlueZ::OnSetDiscoveryFilter(
+void BluetoothAdapterChromeOS::OnSetDiscoveryFilter(
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback) {
// Report success on the original request and increment the count.
@@ -1452,7 +1472,7 @@ void BluetoothAdapterBlueZ::OnSetDiscoveryFilter(
}
}
-void BluetoothAdapterBlueZ::OnSetDiscoveryFilterError(
+void BluetoothAdapterChromeOS::OnSetDiscoveryFilterError(
const base::Closure& callback,
const DiscoverySessionErrorCallback& error_callback,
const std::string& error_name,
@@ -1468,7 +1488,7 @@ void BluetoothAdapterBlueZ::OnSetDiscoveryFilterError(
// SetDiscoveryFilter when the controller doesn't support the requested
// transport.
outcome = UMABluetoothDiscoverySessionOutcome::
- BLUEZ_DBUS_FAILED_MAYBE_UNSUPPORTED_TRANSPORT;
+ CHROMEOS_DBUS_FAILED_MAYBE_UNSUPPORTED_TRANSPORT;
}
error_callback.Run(outcome);
@@ -1476,7 +1496,7 @@ void BluetoothAdapterBlueZ::OnSetDiscoveryFilterError(
ProcessQueuedDiscoveryRequests();
}
-void BluetoothAdapterBlueZ::ProcessQueuedDiscoveryRequests() {
+void BluetoothAdapterChromeOS::ProcessQueuedDiscoveryRequests() {
while (!discovery_request_queue_.empty()) {
VLOG(1) << "Process queued discovery request.";
DiscoveryParamTuple params = discovery_request_queue_.front();
@@ -1492,4 +1512,4 @@ void BluetoothAdapterBlueZ::ProcessQueuedDiscoveryRequests() {
}
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_adapter_bluez.h b/device/bluetooth/bluetooth_adapter_chromeos.h
index a4d66a9..b51e603 100644
--- a/device/bluetooth/bluetooth_adapter_bluez.h
+++ b/device/bluetooth/bluetooth_adapter_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
#include <map>
#include <queue>
@@ -33,17 +33,17 @@ namespace device {
class BluetoothSocketThread;
} // namespace device
-namespace bluez {
+namespace chromeos {
-class BluetoothBlueZTest;
-class BluetoothAdapterProfileBlueZ;
-class BluetoothDeviceBlueZ;
-class BluetoothPairingBlueZ;
-class BluetoothRemoteGattCharacteristicBlueZ;
-class BluetoothRemoteGattDescriptorBlueZ;
-class BluetoothRemoteGattServiceBlueZ;
+class BluetoothChromeOSTest;
+class BluetoothAdapterProfileChromeOS;
+class BluetoothDeviceChromeOS;
+class BluetoothPairingChromeOS;
+class BluetoothRemoteGattCharacteristicChromeOS;
+class BluetoothRemoteGattDescriptorChromeOS;
+class BluetoothRemoteGattServiceChromeOS;
-// The BluetoothAdapterBlueZ class implements BluetoothAdapter for the
+// The BluetoothAdapterChromeOS class implements BluetoothAdapter for the
// Chrome OS platform.
//
// All methods are called from the dbus origin / UI thread and are generally
@@ -52,13 +52,13 @@ class BluetoothRemoteGattServiceBlueZ;
// This class interacts with sockets using the BluetoothSocketThread to ensure
// single-threaded calls, and posts tasks to the UI thread.
//
-// Methods tolerate a shutdown scenario where BluetoothAdapterBlueZ::Shutdown
+// Methods tolerate a shutdown scenario where BluetoothAdapterChromeOS::Shutdown
// causes IsPresent to return false just before the dbus system is shutdown but
-// while references to the BluetoothAdapterBlueZ object still exists.
+// while references to the BluetoothAdapterChromeOS object still exists.
//
// When adding methods to this class verify shutdown behavior in
-// BluetoothBlueZTest, Shutdown.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
+// BluetoothChromeOSTest, Shutdown.
+class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
: public device::BluetoothAdapter,
public bluez::BluetoothAdapterClient::Observer,
public bluez::BluetoothDeviceClient::Observer,
@@ -67,7 +67,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
public:
typedef base::Callback<void(const std::string& error_message)>
ErrorCompletionCallback;
- typedef base::Callback<void(BluetoothAdapterProfileBlueZ* profile)>
+ typedef base::Callback<void(BluetoothAdapterProfileChromeOS* profile)>
ProfileRegisteredCallback;
static base::WeakPtr<BluetoothAdapter> CreateAdapter();
@@ -112,35 +112,36 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
// Locates the device object by object path (the devices map and
// BluetoothDevice methods are by address).
- BluetoothDeviceBlueZ* GetDeviceWithPath(const dbus::ObjectPath& object_path);
+ BluetoothDeviceChromeOS* GetDeviceWithPath(
+ const dbus::ObjectPath& object_path);
// Announces to observers a change in device state that is not reflected by
// its D-Bus properties. |device| is owned by the caller and cannot be NULL.
- void NotifyDeviceChanged(BluetoothDeviceBlueZ* device);
+ void NotifyDeviceChanged(BluetoothDeviceChromeOS* device);
// Announce to observers a device address change.
- void NotifyDeviceAddressChanged(BluetoothDeviceBlueZ* device,
+ void NotifyDeviceAddressChanged(BluetoothDeviceChromeOS* device,
const std::string& old_address);
// The following methods are used to send various GATT observer events to
// observers.
- void NotifyGattServiceAdded(BluetoothRemoteGattServiceBlueZ* service);
- void NotifyGattServiceRemoved(BluetoothRemoteGattServiceBlueZ* service);
- void NotifyGattServiceChanged(BluetoothRemoteGattServiceBlueZ* service);
- void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service);
+ void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service);
+ void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service);
+ void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service);
void NotifyGattCharacteristicAdded(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic);
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic);
void NotifyGattCharacteristicRemoved(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic);
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic);
void NotifyGattDescriptorAdded(
- BluetoothRemoteGattDescriptorBlueZ* descriptor);
+ BluetoothRemoteGattDescriptorChromeOS* descriptor);
void NotifyGattDescriptorRemoved(
- BluetoothRemoteGattDescriptorBlueZ* descriptor);
+ BluetoothRemoteGattDescriptorChromeOS* descriptor);
void NotifyGattCharacteristicValueChanged(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
const std::vector<uint8>& value);
void NotifyGattDescriptorValueChanged(
- BluetoothRemoteGattDescriptorBlueZ* descriptor,
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
const std::vector<uint8>& value);
// Returns the object path of the adapter.
@@ -151,7 +152,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
// If |device_path| is the empty string, incoming connections will be
// assigned to |delegate|. When the profile is
// successfully registered, |success_callback| will be called with a pointer
- // to the profile which is managed by BluetoothAdapterBlueZ. On failure,
+ // to the profile which is managed by BluetoothAdapterChromeOS. On failure,
// |error_callback| will be called.
void UseProfile(const device::BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
@@ -162,7 +163,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
// Release use of a profile by a device.
void ReleaseProfile(const dbus::ObjectPath& device_path,
- BluetoothAdapterProfileBlueZ* profile);
+ BluetoothAdapterProfileChromeOS* profile);
protected:
// BluetoothAdapter:
@@ -170,12 +171,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
device::BluetoothDevice::PairingDelegate* pairing_delegate) override;
private:
- friend class BluetoothBlueZTest;
- friend class BluetoothBlueZTest_Shutdown_Test;
- friend class BluetoothBlueZTest_Shutdown_OnStartDiscovery_Test;
- friend class BluetoothBlueZTest_Shutdown_OnStartDiscoveryError_Test;
- friend class BluetoothBlueZTest_Shutdown_OnStopDiscovery_Test;
- friend class BluetoothBlueZTest_Shutdown_OnStopDiscoveryError_Test;
+ friend class BluetoothChromeOSTest;
+ friend class BluetoothChromeOSTest_Shutdown_Test;
+ friend class BluetoothChromeOSTest_Shutdown_OnStartDiscovery_Test;
+ friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test;
+ friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test;
+ friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test;
// typedef for callback parameters that are passed to AddDiscoverySession
// and RemoveDiscoverySession. This is used to queue incoming requests while
@@ -189,8 +190,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
typedef std::pair<base::Closure, ErrorCompletionCallback>
RegisterProfileCompletionPair;
- BluetoothAdapterBlueZ();
- ~BluetoothAdapterBlueZ() override;
+ BluetoothAdapterChromeOS();
+ ~BluetoothAdapterChromeOS() override;
// bluez::BluetoothAdapterClient::Observer override.
void AdapterAdded(const dbus::ObjectPath& object_path) override;
@@ -241,19 +242,19 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
void OnRequestDefaultAgentError(const std::string& error_name,
const std::string& error_message);
- // Called by BluetoothAudioSinkBlueZ on completion of registering an audio
+ // Called by BluetoothAudioSinkChromeOS on completion of registering an audio
// sink.
void OnRegisterAudioSink(
const device::BluetoothAdapter::AcquiredCallback& callback,
const device::BluetoothAudioSink::ErrorCallback& error_callback,
scoped_refptr<device::BluetoothAudioSink> audio_sink);
- // Internal method to obtain a BluetoothPairingBlueZ object for the device
+ // Internal method to obtain a BluetoothPairingChromeOS object for the device
// with path |object_path|. Returns the existing pairing object if the device
// already has one (usually an outgoing connection in progress) or a new
// pairing object with the default pairing delegate if not. If no default
// pairing object exists, NULL will be returned.
- BluetoothPairingBlueZ* GetPairing(const dbus::ObjectPath& object_path);
+ BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path);
// Set the tracked adapter to the one in |object_path|, this object will
// subsequently operate on that adapter until it is removed.
@@ -329,7 +330,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
// Called by dbus:: on completion of the D-Bus method to register a profile.
void OnRegisterProfile(const device::BluetoothUUID& uuid,
- scoped_ptr<BluetoothAdapterProfileBlueZ> profile);
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile);
void SetProfileDelegate(
const device::BluetoothUUID& uuid,
@@ -341,7 +342,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
const std::string& error_name,
const std::string& error_message);
- // Called by BluetoothAdapterProfileBlueZ when no users of a profile
+ // Called by BluetoothAdapterProfileChromeOS when no users of a profile
// remain.
void RemoveProfile(const device::BluetoothUUID& uuid);
@@ -383,7 +384,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
scoped_refptr<device::BluetoothSocketThread> socket_thread_;
// The profiles we have registered with the bluetooth daemon.
- std::map<device::BluetoothUUID, BluetoothAdapterProfileBlueZ*> profiles_;
+ std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_;
// Queue of delegates waiting for a profile to register.
std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*>
@@ -393,11 +394,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc
index 9771439..c3e6d5c 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -12,8 +12,8 @@
#include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#if defined(OS_CHROMEOS)
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#endif
#if defined(OS_MACOSX)
@@ -62,8 +62,6 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
// instance even on platforms that would otherwise not support it.
if (default_adapter.Get())
return true;
-// Even though the adapter is available on Linux, we only want to use it for
-// the Chrome API, which is why defines(OS_LINUX) is missing from here.
#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
return true;
#elif defined(OS_MACOSX)
@@ -75,12 +73,7 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
// static
void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) {
-// TODO(rkc): This is a very slight hack to allow us to be able to create
-// an adapter on Linux, 'without' exposing the adapter to all Bluetooth
-// services within the browser.
-#if !defined(OS_LINUX)
DCHECK(IsBluetoothAdapterAvailable());
-#endif
#if defined(OS_WIN)
if (!default_adapter.Get()) {
@@ -105,7 +98,7 @@ void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) {
}
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS)
// static
void BluetoothAdapterFactory::Shutdown() {
if (default_adapter.Get())
diff --git a/device/bluetooth/bluetooth_adapter_factory.h b/device/bluetooth/bluetooth_adapter_factory.h
index 05e1d3d..3b11685 100644
--- a/device/bluetooth/bluetooth_adapter_factory.h
+++ b/device/bluetooth/bluetooth_adapter_factory.h
@@ -29,7 +29,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterFactory {
// use.
static void GetAdapter(const AdapterCallback& callback);
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS)
// Calls |BluetoothAdapter::Shutdown| on the adapter if
// present.
static void Shutdown();
diff --git a/device/bluetooth/bluetooth_adapter_profile_bluez.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
index 845002b..27779f2 100644
--- a/device/bluetooth/bluetooth_adapter_profile_bluez.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_adapter_profile_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
#include <string>
@@ -11,21 +11,21 @@
#include "base/strings/string_util.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-namespace bluez {
+namespace chromeos {
// static
-void BluetoothAdapterProfileBlueZ::Register(
+void BluetoothAdapterProfileChromeOS::Register(
const device::BluetoothUUID& uuid,
const bluez::BluetoothProfileManagerClient::Options& options,
const ProfileRegisteredCallback& success_callback,
const bluez::BluetoothProfileManagerClient::ErrorCallback& error_callback) {
- scoped_ptr<BluetoothAdapterProfileBlueZ> profile(
- new BluetoothAdapterProfileBlueZ(uuid));
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile(
+ new BluetoothAdapterProfileChromeOS(uuid));
VLOG(1) << "Registering profile: " << profile->object_path().value();
const dbus::ObjectPath& object_path = profile->object_path();
@@ -36,7 +36,7 @@ void BluetoothAdapterProfileBlueZ::Register(
error_callback);
}
-BluetoothAdapterProfileBlueZ::BluetoothAdapterProfileBlueZ(
+BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(
const device::BluetoothUUID& uuid)
: uuid_(uuid), weak_ptr_factory_(this) {
std::string uuid_path;
@@ -50,9 +50,10 @@ BluetoothAdapterProfileBlueZ::BluetoothAdapterProfileBlueZ(
DCHECK(profile_.get());
}
-BluetoothAdapterProfileBlueZ::~BluetoothAdapterProfileBlueZ() {}
+BluetoothAdapterProfileChromeOS::~BluetoothAdapterProfileChromeOS() {
+}
-bool BluetoothAdapterProfileBlueZ::SetDelegate(
+bool BluetoothAdapterProfileChromeOS::SetDelegate(
const dbus::ObjectPath& device_path,
bluez::BluetoothProfileServiceProvider::Delegate* delegate) {
DCHECK(delegate);
@@ -67,7 +68,7 @@ bool BluetoothAdapterProfileBlueZ::SetDelegate(
return true;
}
-void BluetoothAdapterProfileBlueZ::RemoveDelegate(
+void BluetoothAdapterProfileChromeOS::RemoveDelegate(
const dbus::ObjectPath& device_path,
const base::Closure& unregistered_callback) {
VLOG(1) << object_path_.value() << " dev " << device_path.value()
@@ -88,11 +89,11 @@ void BluetoothAdapterProfileBlueZ::RemoveDelegate(
->GetBluetoothProfileManagerClient()
->UnregisterProfile(
object_path_, unregistered_callback,
- base::Bind(&BluetoothAdapterProfileBlueZ::OnUnregisterProfileError,
+ base::Bind(&BluetoothAdapterProfileChromeOS::OnUnregisterProfileError,
weak_ptr_factory_.GetWeakPtr(), unregistered_callback));
}
-void BluetoothAdapterProfileBlueZ::OnUnregisterProfileError(
+void BluetoothAdapterProfileChromeOS::OnUnregisterProfileError(
const base::Closure& unregistered_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -104,11 +105,11 @@ void BluetoothAdapterProfileBlueZ::OnUnregisterProfileError(
}
// bluez::BluetoothProfileServiceProvider::Delegate:
-void BluetoothAdapterProfileBlueZ::Released() {
+void BluetoothAdapterProfileChromeOS::Released() {
VLOG(1) << object_path_.value() << ": Release";
}
-void BluetoothAdapterProfileBlueZ::NewConnection(
+void BluetoothAdapterProfileChromeOS::NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
@@ -129,7 +130,7 @@ void BluetoothAdapterProfileBlueZ::NewConnection(
options, callback);
}
-void BluetoothAdapterProfileBlueZ::RequestDisconnection(
+void BluetoothAdapterProfileChromeOS::RequestDisconnection(
const dbus::ObjectPath& device_path,
const ConfirmationCallback& callback) {
dbus::ObjectPath delegate_path = device_path;
@@ -147,7 +148,7 @@ void BluetoothAdapterProfileBlueZ::RequestDisconnection(
callback);
}
-void BluetoothAdapterProfileBlueZ::Cancel() {
+void BluetoothAdapterProfileChromeOS::Cancel() {
// Cancel() should only go to a delegate accepting connections.
if (delegates_.find("") == delegates_.end()) {
VLOG(1) << object_path_.value() << ": Cancel with no delegate!";
@@ -157,4 +158,4 @@ void BluetoothAdapterProfileBlueZ::Cancel() {
delegates_[""]->Cancel();
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_adapter_profile_bluez.h b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
index b6e9eb4..35971e8 100644
--- a/device/bluetooth/bluetooth_adapter_profile_bluez.h
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_CHROMEOS_H_
#include "base/memory/weak_ptr.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
@@ -15,9 +15,9 @@ namespace device {
class BluetoothUUID;
} // namespace device
-namespace bluez {
+namespace chromeos {
-// The BluetoothAdapterProfileBlueZ class implements a multiplexing
+// The BluetoothAdapterProfileChromeOS class implements a multiplexing
// profile for custom Bluetooth services managed by a BluetoothAdapter.
// Maintains a list of delegates which may serve the profile.
// One delegate is allowed for each device.
@@ -25,13 +25,13 @@ namespace bluez {
// This class is not thread-safe, but is only called from the dbus origin
// thread.
//
-// BluetoothAdapterProfileBlueZ objects are owned by the
-// BluetoothAdapterBlueZ and allocated through Register()
-class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileBlueZ
+// BluetoothAdapterProfileChromeOS objects are owned by the
+// BluetoothAdapterChromeOS and allocated through Register()
+class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
: public bluez::BluetoothProfileServiceProvider::Delegate {
public:
- typedef base::Callback<void(scoped_ptr<BluetoothAdapterProfileBlueZ> profile)>
- ProfileRegisteredCallback;
+ typedef base::Callback<void(scoped_ptr<BluetoothAdapterProfileChromeOS>
+ profile)> ProfileRegisteredCallback;
// Registers a profile with the BlueZ server for |uuid| with the
// options |options|. |success_callback| is provided with a newly
@@ -44,7 +44,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileBlueZ
const bluez::BluetoothProfileManagerClient::ErrorCallback&
error_callback);
- ~BluetoothAdapterProfileBlueZ() override;
+ ~BluetoothAdapterProfileChromeOS() override;
// The object path of the profile.
const dbus::ObjectPath& object_path() const { return object_path_; }
@@ -68,7 +68,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileBlueZ
size_t DelegateCount() const { return delegates_.size(); }
private:
- BluetoothAdapterProfileBlueZ(const device::BluetoothUUID& uuid);
+ BluetoothAdapterProfileChromeOS(const device::BluetoothUUID& uuid);
// bluez::BluetoothProfileServiceProvider::Delegate:
void Released() override;
@@ -101,11 +101,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileBlueZ
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterProfileBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterProfileChromeOS> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterProfileBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterProfileChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_adapter_profile_bluez_unittest.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
index f64359d..be99901 100644
--- a/device/bluetooth/bluetooth_adapter_profile_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
@@ -5,9 +5,9 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
-#include "device/bluetooth/bluetooth_adapter_profile_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
@@ -20,11 +20,11 @@
using device::BluetoothAdapter;
using device::BluetoothUUID;
-namespace bluez {
+namespace chromeos {
-class BluetoothAdapterProfileBlueZTest : public testing::Test {
+class BluetoothAdapterProfileChromeOSTest : public testing::Test {
public:
- BluetoothAdapterProfileBlueZTest()
+ BluetoothAdapterProfileChromeOSTest()
: success_callback_count_(0),
error_callback_count_(0),
fake_delegate_paired_(
@@ -53,7 +53,7 @@ class BluetoothAdapterProfileBlueZTest : public testing::Test {
// Grab a pointer to the adapter.
device::BluetoothAdapterFactory::GetAdapter(
- base::Bind(&BluetoothAdapterProfileBlueZTest::AdapterCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::AdapterCallback,
base::Unretained(this)));
ASSERT_TRUE(adapter_.get() != nullptr);
ASSERT_TRUE(adapter_->IsInitialized());
@@ -115,17 +115,17 @@ class BluetoothAdapterProfileBlueZTest : public testing::Test {
};
void ProfileSuccessCallback(
- scoped_ptr<BluetoothAdapterProfileBlueZ> profile) {
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile) {
profile_.swap(profile);
++success_callback_count_;
}
- void ProfileUserSuccessCallback(BluetoothAdapterProfileBlueZ* profile) {
+ void ProfileUserSuccessCallback(BluetoothAdapterProfileChromeOS* profile) {
profile_user_ptr_ = profile;
++success_callback_count_;
}
- void MatchedProfileCallback(BluetoothAdapterProfileBlueZ* profile) {
+ void MatchedProfileCallback(BluetoothAdapterProfileChromeOS* profile) {
ASSERT_EQ(profile_user_ptr_, profile);
++success_callback_count_;
}
@@ -153,24 +153,24 @@ class BluetoothAdapterProfileBlueZTest : public testing::Test {
FakeDelegate fake_delegate_autopair_;
FakeDelegate fake_delegate_listen_;
- scoped_ptr<BluetoothAdapterProfileBlueZ> profile_;
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile_;
// unowned pointer as expected to be used by clients of
- // BluetoothAdapterBlueZ::UseProfile like BluetoothSocketBlueZ
- BluetoothAdapterProfileBlueZ* profile_user_ptr_;
+ // BluetoothAdapterChromeOS::UseProfile like BluetoothSocketChromeOS
+ BluetoothAdapterProfileChromeOS* profile_user_ptr_;
};
-TEST_F(BluetoothAdapterProfileBlueZTest, DelegateCount) {
+TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
bluez::BluetoothProfileManagerClient::Options options;
options.require_authentication.reset(new bool(false));
- BluetoothAdapterProfileBlueZ::Register(
+ BluetoothAdapterProfileChromeOS::Register(
uuid, options,
- base::Bind(&BluetoothAdapterProfileBlueZTest::ProfileSuccessCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -197,17 +197,17 @@ TEST_F(BluetoothAdapterProfileBlueZTest, DelegateCount) {
EXPECT_EQ(0U, profile_->DelegateCount());
}
-TEST_F(BluetoothAdapterProfileBlueZTest, BlackHole) {
+TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
bluez::BluetoothProfileManagerClient::Options options;
options.require_authentication.reset(new bool(false));
- BluetoothAdapterProfileBlueZ::Register(
+ BluetoothAdapterProfileChromeOS::Register(
uuid, options,
- base::Bind(&BluetoothAdapterProfileBlueZTest::ProfileSuccessCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -219,9 +219,10 @@ TEST_F(BluetoothAdapterProfileBlueZTest, BlackHole) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(
+ &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -232,17 +233,17 @@ TEST_F(BluetoothAdapterProfileBlueZTest, BlackHole) {
EXPECT_EQ(0U, fake_delegate_paired_.connections_);
}
-TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
+TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
bluez::BluetoothProfileManagerClient::Options options;
options.require_authentication.reset(new bool(false));
- BluetoothAdapterProfileBlueZ::Register(
+ BluetoothAdapterProfileChromeOS::Register(
uuid, options,
- base::Bind(&BluetoothAdapterProfileBlueZTest::ProfileSuccessCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -261,9 +262,10 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(
+ &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -276,9 +278,10 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(
+ &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -292,9 +295,10 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
+ base::Bind(
+ &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -305,11 +309,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
EXPECT_EQ(1U, fake_delegate_listen_.connections_);
}
-TEST_F(BluetoothAdapterProfileBlueZTest, SimultaneousRegister) {
+TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) {
BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
bluez::BluetoothProfileManagerClient::Options options;
- BluetoothAdapterBlueZ* adapter =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
options.require_authentication.reset(new bool(false));
@@ -318,17 +322,18 @@ TEST_F(BluetoothAdapterProfileBlueZTest, SimultaneousRegister) {
adapter->UseProfile(
uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_,
- base::Bind(&BluetoothAdapterProfileBlueZTest::ProfileUserSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::BasicErrorCallback,
+ base::Bind(
+ &BluetoothAdapterProfileChromeOSTest::ProfileUserSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback,
base::Unretained(this)));
adapter->UseProfile(
uuid, fake_delegate_autopair_.device_path_, options,
&fake_delegate_autopair_,
- base::Bind(&BluetoothAdapterProfileBlueZTest::MatchedProfileCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::MatchedProfileCallback,
base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::BasicErrorCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -345,12 +350,12 @@ TEST_F(BluetoothAdapterProfileBlueZTest, SimultaneousRegister) {
message_loop_.RunUntilIdle();
}
-TEST_F(BluetoothAdapterProfileBlueZTest, SimultaneousRegisterFail) {
+TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) {
BluetoothUUID uuid(
bluez::FakeBluetoothProfileManagerClient::kUnregisterableUuid);
bluez::BluetoothProfileManagerClient::Options options;
- BluetoothAdapterBlueZ* adapter =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
options.require_authentication.reset(new bool(false));
@@ -359,17 +364,18 @@ TEST_F(BluetoothAdapterProfileBlueZTest, SimultaneousRegisterFail) {
adapter->UseProfile(
uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_,
- base::Bind(&BluetoothAdapterProfileBlueZTest::ProfileUserSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::BasicErrorCallback,
+ base::Bind(
+ &BluetoothAdapterProfileChromeOSTest::ProfileUserSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback,
base::Unretained(this)));
adapter->UseProfile(
uuid, fake_delegate_autopair_.device_path_, options,
&fake_delegate_autopair_,
- base::Bind(&BluetoothAdapterProfileBlueZTest::MatchedProfileCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::MatchedProfileCallback,
base::Unretained(this)),
- base::Bind(&BluetoothAdapterProfileBlueZTest::BasicErrorCallback,
+ base::Bind(&BluetoothAdapterProfileChromeOSTest::BasicErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -379,4 +385,4 @@ TEST_F(BluetoothAdapterProfileBlueZTest, SimultaneousRegisterFail) {
EXPECT_EQ(2U, error_callback_count_);
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_advertisement_bluez.cc b/device/bluetooth/bluetooth_advertisement_chromeos.cc
index 97b78da..671977d 100644
--- a/device/bluetooth/bluetooth_advertisement_bluez.cc
+++ b/device/bluetooth/bluetooth_advertisement_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_advertisement_bluez.h"
+#include "device/bluetooth/bluetooth_advertisement_chromeos.h"
#include <string>
@@ -14,7 +14,7 @@
#include "base/strings/string_util.h"
#include "dbus/bus.h"
#include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -23,7 +23,7 @@ namespace {
void UnregisterFailure(device::BluetoothAdvertisement::ErrorCode error) {
LOG(ERROR)
- << "BluetoothAdvertisementBlueZ::Unregister failed with error code = "
+ << "BluetoothAdvertisementChromeOS::Unregister failed with error code = "
<< error;
}
@@ -68,11 +68,11 @@ void UnregisterErrorCallbackConnector(
} // namespace
-namespace bluez {
+namespace chromeos {
-BluetoothAdvertisementBlueZ::BluetoothAdvertisementBlueZ(
+BluetoothAdvertisementChromeOS::BluetoothAdvertisementChromeOS(
scoped_ptr<device::BluetoothAdvertisement::Data> data,
- scoped_refptr<BluetoothAdapterBlueZ> adapter)
+ scoped_refptr<BluetoothAdapterChromeOS> adapter)
: adapter_(adapter) {
// Generate a new object path - make sure that we strip any -'s from the
// generated GUID string since object paths can only contain alphanumeric
@@ -93,7 +93,7 @@ BluetoothAdvertisementBlueZ::BluetoothAdvertisementBlueZ(
data->solicit_uuids().Pass(), data->service_data().Pass());
}
-void BluetoothAdvertisementBlueZ::Register(
+void BluetoothAdvertisementChromeOS::Register(
const base::Closure& success_callback,
const device::BluetoothAdapter::CreateAdvertisementErrorCallback&
error_callback) {
@@ -105,11 +105,11 @@ void BluetoothAdvertisementBlueZ::Register(
base::Bind(&RegisterErrorCallbackConnector, error_callback));
}
-BluetoothAdvertisementBlueZ::~BluetoothAdvertisementBlueZ() {
+BluetoothAdvertisementChromeOS::~BluetoothAdvertisementChromeOS() {
Unregister(base::Bind(&base::DoNothing), base::Bind(&UnregisterFailure));
}
-void BluetoothAdvertisementBlueZ::Unregister(
+void BluetoothAdvertisementChromeOS::Unregister(
const SuccessCallback& success_callback,
const ErrorCallback& error_callback) {
// If we don't have a provider, that means we have already been unregistered,
@@ -129,11 +129,11 @@ void BluetoothAdvertisementBlueZ::Unregister(
provider_.reset();
}
-void BluetoothAdvertisementBlueZ::Released() {
+void BluetoothAdvertisementChromeOS::Released() {
LOG(WARNING) << "Advertisement released.";
provider_.reset();
FOR_EACH_OBSERVER(BluetoothAdvertisement::Observer, observers_,
AdvertisementReleased(this));
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_advertisement_bluez.h b/device/bluetooth/bluetooth_advertisement_chromeos.h
index bde8cc8..44abec2 100644
--- a/device/bluetooth/bluetooth_advertisement_bluez.h
+++ b/device/bluetooth/bluetooth_advertisement_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
#include "base/macros.h"
#include "device/bluetooth/bluetooth_adapter.h"
@@ -15,19 +15,19 @@ namespace bluez {
class BluetoothLEAdvertisementServiceProvider;
}
-namespace bluez {
+namespace chromeos {
-class BluetoothAdapterBlueZ;
+class BluetoothAdapterChromeOS;
-// The BluetoothAdvertisementBlueZ class implements BluetoothAdvertisement
+// The BluetoothAdvertisementChromeOS class implements BluetoothAdvertisement
// for the Chrome OS platform.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementBlueZ
+class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS
: public device::BluetoothAdvertisement,
public bluez::BluetoothLEAdvertisementServiceProvider::Delegate {
public:
- BluetoothAdvertisementBlueZ(
+ BluetoothAdvertisementChromeOS(
scoped_ptr<device::BluetoothAdvertisement::Data> data,
- scoped_refptr<BluetoothAdapterBlueZ> adapter);
+ scoped_refptr<BluetoothAdapterChromeOS> adapter);
// BluetoothAdvertisement overrides:
void Unregister(const SuccessCallback& success_callback,
@@ -48,15 +48,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementBlueZ
}
private:
- ~BluetoothAdvertisementBlueZ() override;
+ ~BluetoothAdvertisementChromeOS() override;
// Adapter this advertisement is advertising on.
- scoped_refptr<BluetoothAdapterBlueZ> adapter_;
+ scoped_refptr<BluetoothAdapterChromeOS> adapter_;
scoped_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_advertisement_bluez_unittest.cc b/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
index 6ef7a63..165dc8d 100644
--- a/device/bluetooth/bluetooth_advertisement_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
@@ -12,7 +12,7 @@
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_advertisement.h"
-#include "device/bluetooth/bluetooth_advertisement_bluez.h"
+#include "device/bluetooth/bluetooth_advertisement_chromeos.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -21,7 +21,7 @@ using device::BluetoothAdapter;
using device::BluetoothAdapterFactory;
using device::BluetoothAdvertisement;
-namespace bluez {
+namespace chromeos {
class TestAdvertisementObserver : public BluetoothAdvertisement::Observer {
public:
@@ -49,7 +49,7 @@ class TestAdvertisementObserver : public BluetoothAdvertisement::Observer {
DISALLOW_COPY_AND_ASSIGN(TestAdvertisementObserver);
};
-class BluetoothAdvertisementBlueZTest : public testing::Test {
+class BluetoothAdvertisementChromeOSTest : public testing::Test {
public:
void SetUp() override {
bluez::BluezDBusManager::Initialize(NULL, true);
@@ -76,7 +76,7 @@ class BluetoothAdvertisementBlueZTest : public testing::Test {
// Gets the existing Bluetooth adapter.
void GetAdapter() {
BluetoothAdapterFactory::GetAdapter(
- base::Bind(&BluetoothAdvertisementBlueZTest::GetAdapterCallback,
+ base::Bind(&BluetoothAdvertisementChromeOSTest::GetAdapterCallback,
base::Unretained(this)));
}
@@ -109,10 +109,11 @@ class BluetoothAdvertisementBlueZTest : public testing::Test {
adapter_->RegisterAdvertisement(
CreateAdvertisementData().Pass(),
- base::Bind(&BluetoothAdvertisementBlueZTest::RegisterCallback,
+ base::Bind(&BluetoothAdvertisementChromeOSTest::RegisterCallback,
base::Unretained(this)),
- base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback,
- base::Unretained(this)));
+ base::Bind(
+ &BluetoothAdvertisementChromeOSTest::AdvertisementErrorCallback,
+ base::Unretained(this)));
message_loop_.RunUntilIdle();
return advertisement_;
@@ -121,17 +122,18 @@ class BluetoothAdvertisementBlueZTest : public testing::Test {
void UnregisterAdvertisement(
scoped_refptr<BluetoothAdvertisement> advertisement) {
advertisement->Unregister(
- base::Bind(&BluetoothAdvertisementBlueZTest::Callback,
+ base::Bind(&BluetoothAdvertisementChromeOSTest::Callback,
base::Unretained(this)),
- base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback,
- base::Unretained(this)));
+ base::Bind(
+ &BluetoothAdvertisementChromeOSTest::AdvertisementErrorCallback,
+ base::Unretained(this)));
message_loop_.RunUntilIdle();
}
void TriggerReleased(scoped_refptr<BluetoothAdvertisement> advertisement) {
- BluetoothAdvertisementBlueZ* adv =
- static_cast<BluetoothAdvertisementBlueZ*>(advertisement.get());
+ BluetoothAdvertisementChromeOS* adv =
+ static_cast<BluetoothAdvertisementChromeOS*>(advertisement.get());
bluez::FakeBluetoothLEAdvertisementServiceProvider* provider =
static_cast<bluez::FakeBluetoothLEAdvertisementServiceProvider*>(
adv->provider());
@@ -188,7 +190,7 @@ class BluetoothAdvertisementBlueZTest : public testing::Test {
scoped_refptr<BluetoothAdvertisement> advertisement_;
};
-TEST_F(BluetoothAdvertisementBlueZTest, RegisterSucceeded) {
+TEST_F(BluetoothAdvertisementChromeOSTest, RegisterSucceeded) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
EXPECT_NE(nullptr, advertisement);
@@ -197,7 +199,7 @@ TEST_F(BluetoothAdvertisementBlueZTest, RegisterSucceeded) {
ExpectSuccess();
}
-TEST_F(BluetoothAdvertisementBlueZTest, DoubleRegisterFailed) {
+TEST_F(BluetoothAdvertisementChromeOSTest, DoubleRegisterFailed) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
EXPECT_NE(nullptr, advertisement);
@@ -208,7 +210,7 @@ TEST_F(BluetoothAdvertisementBlueZTest, DoubleRegisterFailed) {
EXPECT_EQ(nullptr, advertisement2);
}
-TEST_F(BluetoothAdvertisementBlueZTest, DoubleUnregisterFailed) {
+TEST_F(BluetoothAdvertisementChromeOSTest, DoubleUnregisterFailed) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
EXPECT_NE(nullptr, advertisement);
@@ -222,7 +224,7 @@ TEST_F(BluetoothAdvertisementBlueZTest, DoubleUnregisterFailed) {
ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
}
-TEST_F(BluetoothAdvertisementBlueZTest, UnregisterAfterReleasedFailed) {
+TEST_F(BluetoothAdvertisementChromeOSTest, UnregisterAfterReleasedFailed) {
scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
ExpectSuccess();
EXPECT_NE(nullptr, advertisement);
@@ -237,4 +239,4 @@ TEST_F(BluetoothAdvertisementBlueZTest, UnregisterAfterReleasedFailed) {
ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_audio_sink_bluez.cc b/device/bluetooth/bluetooth_audio_sink_chromeos.cc
index fca894b..9bb4b60 100644
--- a/device/bluetooth/bluetooth_audio_sink_bluez.cc
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_audio_sink_bluez.h"
+#include "device/bluetooth/bluetooth_audio_sink_chromeos.h"
#include <unistd.h>
@@ -15,7 +15,7 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "dbus/message.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
using dbus::ObjectPath;
@@ -71,16 +71,17 @@ std::string ErrorCodeToString(const BluetoothAudioSink::ErrorCode& error_code) {
}
// A dummy error callback for calling Unregister() in destructor.
-void UnregisterErrorCallback(device::BluetoothAudioSink::ErrorCode error_code) {
+void UnregisterErrorCallback(
+ device::BluetoothAudioSink::ErrorCode error_code) {
VLOG(1) << "UnregisterErrorCallback - " << ErrorCodeToString(error_code)
<< "(" << error_code << ")";
}
} // namespace
-namespace bluez {
+namespace chromeos {
-BluetoothAudioSinkBlueZ::BluetoothAudioSinkBlueZ(
+BluetoothAudioSinkChromeOS::BluetoothAudioSinkChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter)
: state_(BluetoothAudioSink::STATE_INVALID),
volume_(BluetoothAudioSink::kInvalidVolume),
@@ -89,7 +90,7 @@ BluetoothAudioSinkBlueZ::BluetoothAudioSinkBlueZ(
read_has_failed_(false),
adapter_(adapter),
weak_ptr_factory_(this) {
- VLOG(1) << "BluetoothAudioSinkBlueZ created";
+ VLOG(1) << "BluetoothAudioSinkChromeOS created";
CHECK(adapter_.get());
CHECK(adapter_->IsPresent());
@@ -110,8 +111,8 @@ BluetoothAudioSinkBlueZ::BluetoothAudioSinkBlueZ(
StateChanged(device::BluetoothAudioSink::STATE_DISCONNECTED);
}
-BluetoothAudioSinkBlueZ::~BluetoothAudioSinkBlueZ() {
- VLOG(1) << "BluetoothAudioSinkBlueZ destroyed";
+BluetoothAudioSinkChromeOS::~BluetoothAudioSinkChromeOS() {
+ VLOG(1) << "BluetoothAudioSinkChromeOS destroyed";
DCHECK(adapter_.get());
@@ -133,7 +134,7 @@ BluetoothAudioSinkBlueZ::~BluetoothAudioSinkBlueZ() {
transport->RemoveObserver(this);
}
-void BluetoothAudioSinkBlueZ::Unregister(
+void BluetoothAudioSinkChromeOS::Unregister(
const base::Closure& callback,
const device::BluetoothAudioSink::ErrorCallback& error_callback) {
VLOG(1) << "Unregister";
@@ -146,34 +147,35 @@ void BluetoothAudioSinkBlueZ::Unregister(
CHECK(media);
media->UnregisterEndpoint(
- media_path_, endpoint_path_,
- base::Bind(&BluetoothAudioSinkBlueZ::OnUnregisterSucceeded,
+ media_path_,
+ endpoint_path_,
+ base::Bind(&BluetoothAudioSinkChromeOS::OnUnregisterSucceeded,
weak_ptr_factory_.GetWeakPtr(), callback),
- base::Bind(&BluetoothAudioSinkBlueZ::OnUnregisterFailed,
+ base::Bind(&BluetoothAudioSinkChromeOS::OnUnregisterFailed,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothAudioSinkBlueZ::AddObserver(
+void BluetoothAudioSinkChromeOS::AddObserver(
BluetoothAudioSink::Observer* observer) {
CHECK(observer);
observers_.AddObserver(observer);
}
-void BluetoothAudioSinkBlueZ::RemoveObserver(
+void BluetoothAudioSinkChromeOS::RemoveObserver(
BluetoothAudioSink::Observer* observer) {
CHECK(observer);
observers_.RemoveObserver(observer);
}
-BluetoothAudioSink::State BluetoothAudioSinkBlueZ::GetState() const {
+BluetoothAudioSink::State BluetoothAudioSinkChromeOS::GetState() const {
return state_;
}
-uint16_t BluetoothAudioSinkBlueZ::GetVolume() const {
+uint16_t BluetoothAudioSinkChromeOS::GetVolume() const {
return volume_;
}
-void BluetoothAudioSinkBlueZ::Register(
+void BluetoothAudioSinkChromeOS::Register(
const BluetoothAudioSink::Options& options,
const base::Closure& callback,
const BluetoothAudioSink::ErrorCallback& error_callback) {
@@ -200,28 +202,29 @@ void BluetoothAudioSinkBlueZ::Register(
endpoint_properties.codec = options_.codec;
endpoint_properties.capabilities = options_.capabilities;
- media_path_ =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get())->object_path();
+ media_path_ = static_cast<BluetoothAdapterChromeOS*>(
+ adapter_.get())->object_path();
bluez::BluetoothMediaClient* media =
bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
CHECK(media);
media->RegisterEndpoint(
- media_path_, endpoint_path_, endpoint_properties,
- base::Bind(&BluetoothAudioSinkBlueZ::OnRegisterSucceeded,
+ media_path_,
+ endpoint_path_,
+ endpoint_properties,
+ base::Bind(&BluetoothAudioSinkChromeOS::OnRegisterSucceeded,
weak_ptr_factory_.GetWeakPtr(), callback),
- base::Bind(&BluetoothAudioSinkBlueZ::OnRegisterFailed,
+ base::Bind(&BluetoothAudioSinkChromeOS::OnRegisterFailed,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
bluez::BluetoothMediaEndpointServiceProvider*
-BluetoothAudioSinkBlueZ::GetEndpointServiceProvider() {
+BluetoothAudioSinkChromeOS::GetEndpointServiceProvider() {
return media_endpoint_.get();
}
-void BluetoothAudioSinkBlueZ::AdapterPresentChanged(
- device::BluetoothAdapter* adapter,
- bool present) {
+void BluetoothAudioSinkChromeOS::AdapterPresentChanged(
+ device::BluetoothAdapter* adapter, bool present) {
VLOG(1) << "AdapterPresentChanged: " << present;
if (adapter != adapter_.get())
@@ -235,9 +238,8 @@ void BluetoothAudioSinkBlueZ::AdapterPresentChanged(
}
}
-void BluetoothAudioSinkBlueZ::AdapterPoweredChanged(
- device::BluetoothAdapter* adapter,
- bool powered) {
+void BluetoothAudioSinkChromeOS::AdapterPoweredChanged(
+ device::BluetoothAdapter* adapter, bool powered) {
VLOG(1) << "AdapterPoweredChanged: " << powered;
if (adapter != adapter_.get())
@@ -251,14 +253,14 @@ void BluetoothAudioSinkBlueZ::AdapterPoweredChanged(
StateChanged(BluetoothAudioSink::STATE_DISCONNECTED);
}
-void BluetoothAudioSinkBlueZ::MediaRemoved(const ObjectPath& object_path) {
+void BluetoothAudioSinkChromeOS::MediaRemoved(const ObjectPath& object_path) {
if (object_path == media_path_) {
VLOG(1) << "MediaRemoved: " << object_path.value();
StateChanged(BluetoothAudioSink::STATE_INVALID);
}
}
-void BluetoothAudioSinkBlueZ::MediaTransportRemoved(
+void BluetoothAudioSinkChromeOS::MediaTransportRemoved(
const ObjectPath& object_path) {
// Whenever powered of |adapter_| turns false while present stays true, media
// transport object should be removed accordingly, and the state should be
@@ -269,7 +271,7 @@ void BluetoothAudioSinkBlueZ::MediaTransportRemoved(
}
}
-void BluetoothAudioSinkBlueZ::MediaTransportPropertyChanged(
+void BluetoothAudioSinkChromeOS::MediaTransportPropertyChanged(
const ObjectPath& object_path,
const std::string& property_name) {
if (object_path != transport_path_)
@@ -300,7 +302,7 @@ void BluetoothAudioSinkBlueZ::MediaTransportPropertyChanged(
}
}
-void BluetoothAudioSinkBlueZ::SetConfiguration(
+void BluetoothAudioSinkChromeOS::SetConfiguration(
const ObjectPath& transport_path,
const TransportProperties& properties) {
VLOG(1) << "SetConfiguration";
@@ -320,14 +322,14 @@ void BluetoothAudioSinkBlueZ::SetConfiguration(
StateChanged(BluetoothAudioSink::STATE_IDLE);
}
-void BluetoothAudioSinkBlueZ::SelectConfiguration(
+void BluetoothAudioSinkChromeOS::SelectConfiguration(
const std::vector<uint8_t>& capabilities,
const SelectConfigurationCallback& callback) {
VLOG(1) << "SelectConfiguration";
callback.Run(options_.capabilities);
}
-void BluetoothAudioSinkBlueZ::ClearConfiguration(
+void BluetoothAudioSinkChromeOS::ClearConfiguration(
const ObjectPath& transport_path) {
if (transport_path != transport_path_)
return;
@@ -336,32 +338,33 @@ void BluetoothAudioSinkBlueZ::ClearConfiguration(
StateChanged(BluetoothAudioSink::STATE_DISCONNECTED);
}
-void BluetoothAudioSinkBlueZ::Released() {
+void BluetoothAudioSinkChromeOS::Released() {
VLOG(1) << "Released";
StateChanged(BluetoothAudioSink::STATE_INVALID);
}
-void BluetoothAudioSinkBlueZ::OnFileCanReadWithoutBlocking(int fd) {
+void BluetoothAudioSinkChromeOS::OnFileCanReadWithoutBlocking(int fd) {
ReadFromFile();
}
-void BluetoothAudioSinkBlueZ::OnFileCanWriteWithoutBlocking(int fd) {
+void BluetoothAudioSinkChromeOS::OnFileCanWriteWithoutBlocking(int fd) {
// Do nothing for now.
}
-void BluetoothAudioSinkBlueZ::AcquireFD() {
+void BluetoothAudioSinkChromeOS::AcquireFD() {
VLOG(1) << "AcquireFD - transport path: " << transport_path_.value();
read_has_failed_ = false;
bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()->Acquire(
- transport_path_, base::Bind(&BluetoothAudioSinkBlueZ::OnAcquireSucceeded,
- weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&BluetoothAudioSinkBlueZ::OnAcquireFailed,
+ transport_path_,
+ base::Bind(&BluetoothAudioSinkChromeOS::OnAcquireSucceeded,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&BluetoothAudioSinkChromeOS::OnAcquireFailed,
weak_ptr_factory_.GetWeakPtr()));
}
-void BluetoothAudioSinkBlueZ::WatchFD() {
+void BluetoothAudioSinkChromeOS::WatchFD() {
CHECK(file_.get() && file_->IsValid());
VLOG(1) << "WatchFD - file: " << file_->GetPlatformFile()
@@ -372,7 +375,7 @@ void BluetoothAudioSinkBlueZ::WatchFD() {
&fd_read_watcher_, this);
}
-void BluetoothAudioSinkBlueZ::StopWatchingFD() {
+void BluetoothAudioSinkChromeOS::StopWatchingFD() {
if (!file_.get()) {
VLOG(1) << "StopWatchingFD - skip";
return;
@@ -387,7 +390,7 @@ void BluetoothAudioSinkBlueZ::StopWatchingFD() {
file_.reset(); // This will close the file descriptor.
}
-void BluetoothAudioSinkBlueZ::ReadFromFile() {
+void BluetoothAudioSinkChromeOS::ReadFromFile() {
DCHECK(file_.get() && file_->IsValid());
DCHECK(data_.get());
@@ -408,7 +411,8 @@ void BluetoothAudioSinkBlueZ::ReadFromFile() {
BluetoothAudioSinkDataAvailable(this, data_.get(), size, read_mtu_));
}
-void BluetoothAudioSinkBlueZ::StateChanged(BluetoothAudioSink::State state) {
+void BluetoothAudioSinkChromeOS::StateChanged(
+ BluetoothAudioSink::State state) {
if (state == state_)
return;
@@ -439,7 +443,7 @@ void BluetoothAudioSinkBlueZ::StateChanged(BluetoothAudioSink::State state) {
BluetoothAudioSinkStateChanged(this, state_));
}
-void BluetoothAudioSinkBlueZ::VolumeChanged(uint16_t volume) {
+void BluetoothAudioSinkChromeOS::VolumeChanged(uint16_t volume) {
if (volume == volume_)
return;
@@ -450,7 +454,7 @@ void BluetoothAudioSinkBlueZ::VolumeChanged(uint16_t volume) {
BluetoothAudioSinkVolumeChanged(this, volume_));
}
-void BluetoothAudioSinkBlueZ::OnRegisterSucceeded(
+void BluetoothAudioSinkChromeOS::OnRegisterSucceeded(
const base::Closure& callback) {
DCHECK(media_endpoint_.get());
VLOG(1) << "OnRegisterSucceeded";
@@ -459,7 +463,7 @@ void BluetoothAudioSinkBlueZ::OnRegisterSucceeded(
callback.Run();
}
-void BluetoothAudioSinkBlueZ::OnRegisterFailed(
+void BluetoothAudioSinkChromeOS::OnRegisterFailed(
const BluetoothAudioSink::ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -470,7 +474,7 @@ void BluetoothAudioSinkBlueZ::OnRegisterFailed(
error_callback.Run(BluetoothAudioSink::ERROR_NOT_REGISTERED);
}
-void BluetoothAudioSinkBlueZ::OnUnregisterSucceeded(
+void BluetoothAudioSinkChromeOS::OnUnregisterSucceeded(
const base::Closure& callback) {
VLOG(1) << "Unregistered - endpoint: " << endpoint_path_.value();
@@ -480,7 +484,7 @@ void BluetoothAudioSinkBlueZ::OnUnregisterSucceeded(
callback.Run();
}
-void BluetoothAudioSinkBlueZ::OnUnregisterFailed(
+void BluetoothAudioSinkChromeOS::OnUnregisterFailed(
const device::BluetoothAudioSink::ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -490,9 +494,10 @@ void BluetoothAudioSinkBlueZ::OnUnregisterFailed(
error_callback.Run(BluetoothAudioSink::ERROR_NOT_UNREGISTERED);
}
-void BluetoothAudioSinkBlueZ::OnAcquireSucceeded(dbus::FileDescriptor* fd,
- const uint16_t read_mtu,
- const uint16_t write_mtu) {
+void BluetoothAudioSinkChromeOS::OnAcquireSucceeded(
+ dbus::FileDescriptor* fd,
+ const uint16_t read_mtu,
+ const uint16_t write_mtu) {
CHECK(fd);
fd->CheckValidity();
CHECK(fd->is_valid() && fd->value() != kInvalidFd);
@@ -521,31 +526,31 @@ void BluetoothAudioSinkBlueZ::OnAcquireSucceeded(dbus::FileDescriptor* fd,
<< ", read MTU: " << read_mtu_ << ", write MTU: " << write_mtu_;
}
-void BluetoothAudioSinkBlueZ::OnAcquireFailed(
+void BluetoothAudioSinkChromeOS::OnAcquireFailed(
const std::string& error_name,
const std::string& error_message) {
VLOG(1) << "OnAcquireFailed - error name: " << error_name
<< ", error message: " << error_message;
}
-void BluetoothAudioSinkBlueZ::OnReleaseFDSucceeded() {
+void BluetoothAudioSinkChromeOS::OnReleaseFDSucceeded() {
VLOG(1) << "OnReleaseFDSucceeded";
}
-void BluetoothAudioSinkBlueZ::OnReleaseFDFailed(
+void BluetoothAudioSinkChromeOS::OnReleaseFDFailed(
const std::string& error_name,
const std::string& error_message) {
VLOG(1) << "OnReleaseFDFailed - error name: " << error_name
<< ", error message: " << error_message;
}
-void BluetoothAudioSinkBlueZ::ResetMedia() {
+void BluetoothAudioSinkChromeOS::ResetMedia() {
VLOG(1) << "ResetMedia";
media_path_ = dbus::ObjectPath("");
}
-void BluetoothAudioSinkBlueZ::ResetTransport() {
+void BluetoothAudioSinkChromeOS::ResetTransport() {
if (!transport_path_.IsValid()) {
VLOG(1) << "ResetTransport - skip";
return;
@@ -560,11 +565,11 @@ void BluetoothAudioSinkBlueZ::ResetTransport() {
file_.reset();
}
-void BluetoothAudioSinkBlueZ::ResetEndpoint() {
+void BluetoothAudioSinkChromeOS::ResetEndpoint() {
VLOG(1) << "ResetEndpoint";
endpoint_path_ = ObjectPath("");
media_endpoint_ = nullptr;
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_audio_sink_bluez.h b/device/bluetooth/bluetooth_audio_sink_chromeos.h
index e319aea..750b31d 100644
--- a/device/bluetooth/bluetooth_audio_sink_bluez.h
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
#include <stdint.h>
#include <string>
@@ -23,11 +23,11 @@
#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
-namespace bluez {
+namespace chromeos {
-class BluetoothAudioSinkBlueZTest;
+class BluetoothAudioSinkChromeOSTest;
-class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
+class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
: public device::BluetoothAudioSink,
public device::BluetoothAdapter::Observer,
public bluez::BluetoothMediaClient::Observer,
@@ -35,7 +35,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
public bluez::BluetoothMediaEndpointServiceProvider::Delegate,
public base::MessageLoopForIO::Watcher {
public:
- explicit BluetoothAudioSinkBlueZ(
+ explicit BluetoothAudioSinkChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter);
// device::BluetoothAudioSink overrides.
@@ -53,7 +53,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
// Registers a BluetoothAudioSink. User applications can use |options| to
// configure the audio sink. |callback| will be executed if the audio sink is
// successfully registered, otherwise |error_callback| will be called. Called
- // by BluetoothAdapterBlueZ.
+ // by BluetoothAdapterChromeOS.
void Register(
const device::BluetoothAudioSink::Options& options,
const base::Closure& callback,
@@ -64,7 +64,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
bluez::BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider();
private:
- ~BluetoothAudioSinkBlueZ() override;
+ ~BluetoothAudioSinkChromeOS() override;
// device::BluetoothAdapter::Observer overrides.
void AdapterPresentChanged(device::BluetoothAdapter* adapter,
@@ -157,7 +157,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
void ResetTransport();
void ResetEndpoint();
- // The connection state between the BluetoothAudioSinkBlueZ and the remote
+ // The connection state between the BluetoothAudioSinkChromeOS and the remote
// device.
device::BluetoothAudioSink::State state_;
@@ -196,7 +196,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
dbus::ObjectPath endpoint_path_;
// BT adapter which the audio sink binds to. |adapter_| should outlive
- // a BluetoothAudioSinkBlueZ object.
+ // a BluetoothAudioSinkChromeOS object.
scoped_refptr<device::BluetoothAdapter> adapter_;
// Options used to initiate Media Endpoint and select configuration for the
@@ -207,16 +207,16 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkBlueZ
scoped_ptr<bluez::BluetoothMediaEndpointServiceProvider> media_endpoint_;
// List of observers interested in event notifications from us. Objects in
- // |observers_| are expected to outlive a BluetoothAudioSinkBlueZ object.
+ // |observers_| are expected to outlive a BluetoothAudioSinkChromeOS object.
base::ObserverList<BluetoothAudioSink::Observer> observers_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAudioSinkBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_audio_sink_bluez_unittest.cc b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
index 663ec81..22918f7 100644
--- a/device/bluetooth/bluetooth_audio_sink_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
@@ -12,7 +12,7 @@
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_audio_sink.h"
-#include "device/bluetooth/bluetooth_audio_sink_bluez.h"
+#include "device/bluetooth/bluetooth_audio_sink_chromeos.h"
#include "device/bluetooth/dbus/bluetooth_media_client.h"
#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
@@ -27,7 +27,7 @@ using device::BluetoothAdapter;
using device::BluetoothAdapterFactory;
using device::BluetoothAudioSink;
-namespace bluez {
+namespace chromeos {
class TestAudioSinkObserver : public BluetoothAudioSink::Observer {
public:
@@ -78,7 +78,7 @@ class TestAudioSinkObserver : public BluetoothAudioSink::Observer {
scoped_refptr<BluetoothAudioSink> audio_sink_;
};
-class BluetoothAudioSinkBlueZTest : public testing::Test {
+class BluetoothAudioSinkChromeOSTest : public testing::Test {
public:
void SetUp() override {
bluez::BluezDBusManager::Initialize(NULL, true);
@@ -124,7 +124,7 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
// Gets the existing Bluetooth adapter.
void GetAdapter() {
BluetoothAdapterFactory::GetAdapter(
- base::Bind(&BluetoothAudioSinkBlueZTest::GetAdapterCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::GetAdapterCallback,
base::Unretained(this)));
}
@@ -134,11 +134,12 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
ASSERT_NE(adapter_.get(), nullptr);
ASSERT_TRUE(adapter_->IsInitialized());
- adapter_->SetPowered(true,
- base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::ErrorCallback,
- base::Unretained(this)));
+ adapter_->SetPowered(
+ true,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
ASSERT_TRUE(adapter_->IsPresent());
ASSERT_TRUE(adapter_->IsPowered());
EXPECT_EQ(callback_count_, 1);
@@ -148,7 +149,7 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
--callback_count_;
}
- // Registers BluetoothAudioSinkBlueZ with default codec and capabilities.
+ // Registers BluetoothAudioSinkChromeOS with default codec and capabilities.
// If the audio sink is retrieved successfully, the state changes to
// STATE_DISCONNECTED.
void GetAudioSink() {
@@ -160,9 +161,10 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
// Registers |audio_sink_| with valid codec and capabilities
adapter_->RegisterAudioSink(
- options, base::Bind(&BluetoothAudioSinkBlueZTest::RegisterCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::RegisterErrorCallback,
+ options,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::RegisterCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::RegisterErrorCallback,
base::Unretained(this)));
observer_.reset(new TestAudioSinkObserver(audio_sink_));
@@ -173,17 +175,18 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
}
void GetFakeMediaEndpoint() {
- BluetoothAudioSinkBlueZ* audio_sink_bluez =
- static_cast<BluetoothAudioSinkBlueZ*>(audio_sink_.get());
- ASSERT_NE(audio_sink_bluez, nullptr);
+ BluetoothAudioSinkChromeOS* audio_sink_chromeos =
+ static_cast<BluetoothAudioSinkChromeOS*>(audio_sink_.get());
+ ASSERT_NE(audio_sink_chromeos, nullptr);
media_endpoint_ =
static_cast<bluez::FakeBluetoothMediaEndpointServiceProvider*>(
- audio_sink_bluez->GetEndpointServiceProvider());
+ audio_sink_chromeos->GetEndpointServiceProvider());
}
// Called whenever RegisterAudioSink is completed successfully.
- void RegisterCallback(scoped_refptr<BluetoothAudioSink> audio_sink) {
+ void RegisterCallback(
+ scoped_refptr<BluetoothAudioSink> audio_sink) {
++callback_count_;
audio_sink_ = audio_sink;
@@ -216,9 +219,13 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
}
// Generic callbacks.
- void Callback() { ++callback_count_; }
+ void Callback() {
+ ++callback_count_;
+ }
- void ErrorCallback() { ++error_callback_count_; }
+ void ErrorCallback() {
+ ++error_callback_count_;
+ }
protected:
int callback_count_;
@@ -239,20 +246,21 @@ class BluetoothAudioSinkBlueZTest : public testing::Test {
properties_;
};
-TEST_F(BluetoothAudioSinkBlueZTest, RegisterSucceeded) {
+TEST_F(BluetoothAudioSinkChromeOSTest, RegisterSucceeded) {
GetAudioSink();
}
-TEST_F(BluetoothAudioSinkBlueZTest, RegisterFailedWithInvalidOptions) {
+TEST_F(BluetoothAudioSinkChromeOSTest, RegisterFailedWithInvalidOptions) {
// Sets options with an invalid codec and valid capabilities.
BluetoothAudioSink::Options options;
options.codec = 0xff;
options.capabilities = std::vector<uint8_t>({0x3f, 0xff, 0x12, 0x35});
adapter_->RegisterAudioSink(
- options, base::Bind(&BluetoothAudioSinkBlueZTest::RegisterCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::RegisterErrorCallback,
+ options,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::RegisterCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::RegisterErrorCallback,
base::Unretained(this)));
EXPECT_EQ(callback_count_, 0);
@@ -262,23 +270,24 @@ TEST_F(BluetoothAudioSinkBlueZTest, RegisterFailedWithInvalidOptions) {
options.codec = 0x00;
options.capabilities.clear();
adapter_->RegisterAudioSink(
- options, base::Bind(&BluetoothAudioSinkBlueZTest::RegisterCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::RegisterErrorCallback,
+ options,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::RegisterCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::RegisterErrorCallback,
base::Unretained(this)));
EXPECT_EQ(callback_count_, 0);
EXPECT_EQ(error_callback_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest, SelectConfiguration) {
+TEST_F(BluetoothAudioSinkChromeOSTest, SelectConfiguration) {
GetAudioSink();
// Simulates calling SelectConfiguration on the media endpoint object owned by
// |audio_sink_| with some fake capabilities.
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -288,12 +297,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, SelectConfiguration) {
EXPECT_EQ(observer_->volume_changed_count_, 0);
}
-TEST_F(BluetoothAudioSinkBlueZTest, SetConfiguration) {
+TEST_F(BluetoothAudioSinkChromeOSTest, SetConfiguration) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -316,12 +325,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, SetConfiguration) {
EXPECT_EQ(observer_->volume_changed_count_, 1);
}
-TEST_F(BluetoothAudioSinkBlueZTest, SetConfigurationWithUnexpectedState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, SetConfigurationWithUnexpectedState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -347,7 +356,7 @@ TEST_F(BluetoothAudioSinkBlueZTest, SetConfigurationWithUnexpectedState) {
// Checks if the observer is notified on media-removed event when the state of
// |audio_sink_| is STATE_DISCONNECTED. Once the media object is removed, the
// audio sink is no longer valid.
-TEST_F(BluetoothAudioSinkBlueZTest, MediaRemovedDuringDisconnectedState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, MediaRemovedDuringDisconnectedState) {
GetAudioSink();
// Gets the media object and makes it invisible to see if the state of the
@@ -365,12 +374,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, MediaRemovedDuringDisconnectedState) {
// Checks if the observer is notified on media-removed event when the state of
// |audio_sink_| is STATE_IDLE. Once the media object is removed, the audio sink
// is no longer valid.
-TEST_F(BluetoothAudioSinkBlueZTest, MediaRemovedDuringIdleState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, MediaRemovedDuringIdleState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -405,12 +414,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, MediaRemovedDuringIdleState) {
EXPECT_EQ(observer_->volume_changed_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest, MediaRemovedDuringActiveState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, MediaRemovedDuringActiveState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -458,12 +467,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, MediaRemovedDuringActiveState) {
// Checks if the observer is notified on transport-removed event when the state
// of |audio_sink_| is STATE_IDEL. Once the media transport object is removed,
// the audio sink is disconnected.
-TEST_F(BluetoothAudioSinkBlueZTest, TransportRemovedDuringIdleState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, TransportRemovedDuringIdleState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -492,12 +501,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, TransportRemovedDuringIdleState) {
EXPECT_EQ(observer_->volume_changed_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest, TransportRemovedDuringActiveState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, TransportRemovedDuringActiveState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -536,14 +545,16 @@ TEST_F(BluetoothAudioSinkBlueZTest, TransportRemovedDuringActiveState) {
EXPECT_EQ(observer_->volume_changed_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest,
+TEST_F(BluetoothAudioSinkChromeOSTest,
AdapterPoweredChangedDuringDisconnectedState) {
GetAudioSink();
- adapter_->SetPowered(false, base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::ErrorCallback,
- base::Unretained(this)));
+ adapter_->SetPowered(
+ false,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_TRUE(adapter_->IsPresent());
EXPECT_FALSE(adapter_->IsPowered());
@@ -553,10 +564,12 @@ TEST_F(BluetoothAudioSinkBlueZTest,
EXPECT_EQ(observer_->state_changed_count_, 0);
EXPECT_EQ(observer_->volume_changed_count_, 0);
- adapter_->SetPowered(true, base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::ErrorCallback,
- base::Unretained(this)));
+ adapter_->SetPowered(
+ true,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_TRUE(adapter_->IsPresent());
EXPECT_TRUE(adapter_->IsPowered());
@@ -567,12 +580,12 @@ TEST_F(BluetoothAudioSinkBlueZTest,
EXPECT_EQ(observer_->volume_changed_count_, 0);
}
-TEST_F(BluetoothAudioSinkBlueZTest, AdapterPoweredChangedDuringIdleState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, AdapterPoweredChangedDuringIdleState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -591,10 +604,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, AdapterPoweredChangedDuringIdleState) {
EXPECT_EQ(observer_->state_changed_count_, 1);
EXPECT_EQ(observer_->volume_changed_count_, 1);
- adapter_->SetPowered(false, base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
- base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::ErrorCallback,
- base::Unretained(this)));
+ adapter_->SetPowered(
+ false,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothAudioSinkChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
GetFakeMediaEndpoint();
EXPECT_TRUE(adapter_->IsPresent());
@@ -607,14 +622,14 @@ TEST_F(BluetoothAudioSinkBlueZTest, AdapterPoweredChangedDuringIdleState) {
EXPECT_EQ(observer_->volume_changed_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest,
+TEST_F(BluetoothAudioSinkChromeOSTest,
UnregisterAudioSinkDuringDisconnectedState) {
GetAudioSink();
audio_sink_->Unregister(
- base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::UnregisterErrorCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::UnregisterErrorCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_INVALID);
@@ -624,12 +639,12 @@ TEST_F(BluetoothAudioSinkBlueZTest,
EXPECT_EQ(observer_->volume_changed_count_, 0);
}
-TEST_F(BluetoothAudioSinkBlueZTest, UnregisterAudioSinkDuringIdleState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, UnregisterAudioSinkDuringIdleState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -649,9 +664,9 @@ TEST_F(BluetoothAudioSinkBlueZTest, UnregisterAudioSinkDuringIdleState) {
EXPECT_EQ(observer_->volume_changed_count_, 1);
audio_sink_->Unregister(
- base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::UnregisterErrorCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::UnregisterErrorCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_INVALID);
@@ -665,12 +680,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, UnregisterAudioSinkDuringIdleState) {
EXPECT_EQ(observer_->volume_changed_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest, UnregisterAudioSinkDuringActiveState) {
+TEST_F(BluetoothAudioSinkChromeOSTest, UnregisterAudioSinkDuringActiveState) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -700,9 +715,9 @@ TEST_F(BluetoothAudioSinkBlueZTest, UnregisterAudioSinkDuringActiveState) {
EXPECT_EQ(observer_->state_changed_count_, 3);
audio_sink_->Unregister(
- base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::Callback,
base::Unretained(this)),
- base::Bind(&BluetoothAudioSinkBlueZTest::UnregisterErrorCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::UnregisterErrorCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_INVALID);
@@ -712,12 +727,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, UnregisterAudioSinkDuringActiveState) {
EXPECT_EQ(observer_->volume_changed_count_, 2);
}
-TEST_F(BluetoothAudioSinkBlueZTest, StateChanged) {
+TEST_F(BluetoothAudioSinkChromeOSTest, StateChanged) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -744,12 +759,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, StateChanged) {
EXPECT_EQ(observer_->volume_changed_count_, 1);
}
-TEST_F(BluetoothAudioSinkBlueZTest, VolumeChanged) {
+TEST_F(BluetoothAudioSinkChromeOSTest, VolumeChanged) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -790,12 +805,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, VolumeChanged) {
EXPECT_EQ(audio_sink_->GetVolume(), BluetoothAudioSink::kInvalidVolume);
}
-TEST_F(BluetoothAudioSinkBlueZTest, AcquireFD) {
+TEST_F(BluetoothAudioSinkChromeOSTest, AcquireFD) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -833,12 +848,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, AcquireFD) {
}
// Tests the case where the remote device pauses and resume audio streaming.
-TEST_F(BluetoothAudioSinkBlueZTest, PauseAndResume) {
+TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -891,12 +906,12 @@ TEST_F(BluetoothAudioSinkBlueZTest, PauseAndResume) {
EXPECT_EQ(observer_->total_read_, data_two.size());
}
-TEST_F(BluetoothAudioSinkBlueZTest, ContinuouslyStreaming) {
+TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) {
GetAudioSink();
media_endpoint_->SelectConfiguration(
std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}),
- base::Bind(&BluetoothAudioSinkBlueZTest::SelectConfigurationCallback,
+ base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback,
base::Unretained(this)));
EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_DISCONNECTED);
@@ -940,4 +955,4 @@ TEST_F(BluetoothAudioSinkBlueZTest, ContinuouslyStreaming) {
EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size());
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_bluez_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc
index e93b39d..cd17a9a 100644
--- a/device/bluetooth/bluetooth_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
@@ -8,12 +8,12 @@
#include "base/strings/utf_string_conversions.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/bluetooth_device_bluez.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
-#include "device/bluetooth/bluetooth_pairing_bluez.h"
+#include "device/bluetooth/bluetooth_pairing_chromeos.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
@@ -33,7 +33,7 @@ using device::BluetoothDiscoverySession;
using device::BluetoothUUID;
using device::TestBluetoothAdapterObserver;
-namespace bluez {
+namespace chromeos {
namespace {
@@ -151,7 +151,7 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
}
};
-class BluetoothBlueZTest : public testing::Test {
+class BluetoothChromeOSTest : public testing::Test {
public:
void SetUp() override {
scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
@@ -187,8 +187,9 @@ class BluetoothBlueZTest : public testing::Test {
void TearDown() override {
for (ScopedVector<BluetoothDiscoverySession>::iterator iter =
- discovery_sessions_.begin();
- iter != discovery_sessions_.end(); ++iter) {
+ discovery_sessions_.begin();
+ iter != discovery_sessions_.end();
+ ++iter) {
BluetoothDiscoverySession* session = *iter;
if (!session->IsActive())
continue;
@@ -209,7 +210,7 @@ class BluetoothBlueZTest : public testing::Test {
}
base::Closure GetCallback() {
- return base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this));
+ return base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this));
}
void DiscoverySessionCallback(
@@ -224,7 +225,7 @@ class BluetoothBlueZTest : public testing::Test {
QuitMessageLoop();
}
- void ProfileRegisteredCallback(BluetoothAdapterProfileBlueZ* profile) {
+ void ProfileRegisteredCallback(BluetoothAdapterProfileChromeOS* profile) {
adapter_profile_ = profile;
++callback_count_;
QuitMessageLoop();
@@ -240,13 +241,13 @@ class BluetoothBlueZTest : public testing::Test {
}
base::Closure GetErrorCallback() {
- return base::Bind(&BluetoothBlueZTest::ErrorCallback,
+ return base::Bind(&BluetoothChromeOSTest::ErrorCallback,
base::Unretained(this));
}
base::Callback<void(device::UMABluetoothDiscoverySessionOutcome)>
GetDiscoveryErrorCallback() {
- return base::Bind(&BluetoothBlueZTest::DiscoveryErrorCallback,
+ return base::Bind(&BluetoothChromeOSTest::DiscoveryErrorCallback,
base::Unretained(this));
}
@@ -274,7 +275,7 @@ class BluetoothBlueZTest : public testing::Test {
// Call to fill the adapter_ member with a BluetoothAdapter instance.
void GetAdapter() {
- adapter_ = new BluetoothAdapterBlueZ();
+ adapter_ = new BluetoothAdapterChromeOS();
ASSERT_TRUE(adapter_.get() != nullptr);
ASSERT_TRUE(adapter_->IsInitialized());
}
@@ -293,7 +294,7 @@ class BluetoothBlueZTest : public testing::Test {
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
base::MessageLoop::current()->Run();
@@ -337,7 +338,7 @@ class BluetoothBlueZTest : public testing::Test {
enum BluetoothDevice::ConnectErrorCode last_connect_error_;
std::string last_client_error_;
ScopedVector<BluetoothDiscoverySession> discovery_sessions_;
- BluetoothAdapterProfileBlueZ* adapter_profile_;
+ BluetoothAdapterProfileChromeOS* adapter_profile_;
private:
// Some tests use a message loop since background processing is simulated;
@@ -350,7 +351,7 @@ class BluetoothBlueZTest : public testing::Test {
}
};
-TEST_F(BluetoothBlueZTest, AlreadyPresent) {
+TEST_F(BluetoothChromeOSTest, AlreadyPresent) {
GetAdapter();
// This verifies that the class gets the list of adapters when created;
@@ -370,7 +371,7 @@ TEST_F(BluetoothBlueZTest, AlreadyPresent) {
devices[1]->GetAddress());
}
-TEST_F(BluetoothBlueZTest, BecomePresent) {
+TEST_F(BluetoothChromeOSTest, BecomePresent) {
fake_bluetooth_adapter_client_->SetVisible(false);
GetAdapter();
ASSERT_FALSE(adapter_->IsPresent());
@@ -398,7 +399,7 @@ TEST_F(BluetoothBlueZTest, BecomePresent) {
EXPECT_FALSE(adapter_->IsDiscovering());
}
-TEST_F(BluetoothBlueZTest, BecomeNotPresent) {
+TEST_F(BluetoothChromeOSTest, BecomeNotPresent) {
GetAdapter();
ASSERT_TRUE(adapter_->IsPresent());
@@ -425,7 +426,7 @@ TEST_F(BluetoothBlueZTest, BecomeNotPresent) {
EXPECT_FALSE(adapter_->IsDiscovering());
}
-TEST_F(BluetoothBlueZTest, SecondAdapter) {
+TEST_F(BluetoothChromeOSTest, SecondAdapter) {
GetAdapter();
ASSERT_TRUE(adapter_->IsPresent());
@@ -471,7 +472,7 @@ TEST_F(BluetoothBlueZTest, SecondAdapter) {
EXPECT_EQ(0, observer.discovering_changed_count());
}
-TEST_F(BluetoothBlueZTest, BecomePowered) {
+TEST_F(BluetoothChromeOSTest, BecomePowered) {
GetAdapter();
ASSERT_FALSE(adapter_->IsPowered());
@@ -489,7 +490,7 @@ TEST_F(BluetoothBlueZTest, BecomePowered) {
EXPECT_TRUE(adapter_->IsPowered());
}
-TEST_F(BluetoothBlueZTest, BecomeNotPowered) {
+TEST_F(BluetoothChromeOSTest, BecomeNotPowered) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
EXPECT_EQ(1, callback_count_);
@@ -512,7 +513,7 @@ TEST_F(BluetoothBlueZTest, BecomeNotPowered) {
EXPECT_FALSE(adapter_->IsPowered());
}
-TEST_F(BluetoothBlueZTest, SetPoweredWhenNotPresent) {
+TEST_F(BluetoothChromeOSTest, SetPoweredWhenNotPresent) {
GetAdapter();
ASSERT_TRUE(adapter_->IsPresent());
@@ -538,7 +539,7 @@ TEST_F(BluetoothBlueZTest, SetPoweredWhenNotPresent) {
EXPECT_FALSE(adapter_->IsPowered());
}
-TEST_F(BluetoothBlueZTest, ChangeAdapterName) {
+TEST_F(BluetoothChromeOSTest, ChangeAdapterName) {
GetAdapter();
static const std::string new_name(".__.");
@@ -550,7 +551,7 @@ TEST_F(BluetoothBlueZTest, ChangeAdapterName) {
EXPECT_EQ(new_name, adapter_->GetName());
}
-TEST_F(BluetoothBlueZTest, ChangeAdapterNameWhenNotPresent) {
+TEST_F(BluetoothChromeOSTest, ChangeAdapterNameWhenNotPresent) {
GetAdapter();
ASSERT_TRUE(adapter_->IsPresent());
@@ -573,7 +574,7 @@ TEST_F(BluetoothBlueZTest, ChangeAdapterNameWhenNotPresent) {
EXPECT_EQ("", adapter_->GetName());
}
-TEST_F(BluetoothBlueZTest, BecomeDiscoverable) {
+TEST_F(BluetoothChromeOSTest, BecomeDiscoverable) {
GetAdapter();
ASSERT_FALSE(adapter_->IsDiscoverable());
@@ -590,7 +591,7 @@ TEST_F(BluetoothBlueZTest, BecomeDiscoverable) {
EXPECT_TRUE(adapter_->IsDiscoverable());
}
-TEST_F(BluetoothBlueZTest, BecomeNotDiscoverable) {
+TEST_F(BluetoothChromeOSTest, BecomeNotDiscoverable) {
GetAdapter();
adapter_->SetDiscoverable(true, GetCallback(), GetErrorCallback());
EXPECT_EQ(1, callback_count_);
@@ -612,7 +613,7 @@ TEST_F(BluetoothBlueZTest, BecomeNotDiscoverable) {
EXPECT_FALSE(adapter_->IsDiscoverable());
}
-TEST_F(BluetoothBlueZTest, SetDiscoverableWhenNotPresent) {
+TEST_F(BluetoothChromeOSTest, SetDiscoverableWhenNotPresent) {
GetAdapter();
ASSERT_TRUE(adapter_->IsPresent());
ASSERT_FALSE(adapter_->IsDiscoverable());
@@ -638,12 +639,12 @@ TEST_F(BluetoothBlueZTest, SetDiscoverableWhenNotPresent) {
EXPECT_FALSE(adapter_->IsDiscoverable());
}
-TEST_F(BluetoothBlueZTest, StopDiscovery) {
+TEST_F(BluetoothChromeOSTest, StopDiscovery) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -677,7 +678,7 @@ TEST_F(BluetoothBlueZTest, StopDiscovery) {
// BluetoothDiscoverySession objects gets deleted
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -697,7 +698,7 @@ TEST_F(BluetoothBlueZTest, StopDiscovery) {
EXPECT_EQ(0, error_callback_count_);
}
-TEST_F(BluetoothBlueZTest, Discovery) {
+TEST_F(BluetoothChromeOSTest, Discovery) {
// Test a simulated discovery session.
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -706,7 +707,7 @@ TEST_F(BluetoothBlueZTest, Discovery) {
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -739,11 +740,11 @@ TEST_F(BluetoothBlueZTest, Discovery) {
observer.last_device_address());
}
-TEST_F(BluetoothBlueZTest, PoweredAndDiscovering) {
+TEST_F(BluetoothChromeOSTest, PoweredAndDiscovering) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -805,7 +806,7 @@ TEST_F(BluetoothBlueZTest, PoweredAndDiscovering) {
// This unit test asserts that the basic reference counting logic works
// correctly for discovery requests done via the BluetoothAdapter.
-TEST_F(BluetoothBlueZTest, MultipleDiscoverySessions) {
+TEST_F(BluetoothChromeOSTest, MultipleDiscoverySessions) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
EXPECT_EQ(1, callback_count_);
@@ -822,7 +823,7 @@ TEST_F(BluetoothBlueZTest, MultipleDiscoverySessions) {
// Request device discovery 3 times.
for (int i = 0; i < 3; i++) {
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
}
@@ -860,7 +861,7 @@ TEST_F(BluetoothBlueZTest, MultipleDiscoverySessions) {
// Request device discovery 3 times.
for (int i = 0; i < 3; i++) {
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
}
@@ -909,7 +910,8 @@ TEST_F(BluetoothBlueZTest, MultipleDiscoverySessions) {
// This unit test asserts that the reference counting logic works correctly in
// the cases when the adapter gets reset and D-Bus calls are made outside of
// the BluetoothAdapter.
-TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
+TEST_F(BluetoothChromeOSTest,
+ UnexpectedChangesDuringMultipleDiscoverySessions) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
EXPECT_EQ(1, callback_count_);
@@ -926,7 +928,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
// Request device discovery 3 times.
for (int i = 0; i < 3; i++) {
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
}
@@ -963,7 +965,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
// bluez::FakeBluetoothAdapterClient::StopDiscovery should work.
fake_bluetooth_adapter_client_->StopDiscovery(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
- GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, observer.discovering_changed_count());
@@ -980,7 +982,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
// It should be possible to successfully start discovery.
for (int i = 0; i < 2; i++) {
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
}
@@ -1028,7 +1030,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
// application other than us. Starting and stopping discovery will succeed
// but it won't cause the discovery state to change.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run(); // Run the loop, as there should have been a D-Bus call.
@@ -1052,7 +1054,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
// Start discovery again.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run(); // Run the loop, as there should have been a D-Bus call.
@@ -1069,7 +1071,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
// requested it via D-Bus.
fake_bluetooth_adapter_client_->StopDiscovery(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
- GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(5, observer.discovering_changed_count());
@@ -1090,7 +1092,7 @@ TEST_F(BluetoothBlueZTest, UnexpectedChangesDuringMultipleDiscoverySessions) {
EXPECT_FALSE(discovery_sessions_[0]->IsActive());
}
-TEST_F(BluetoothBlueZTest, InvalidatedDiscoverySessions) {
+TEST_F(BluetoothChromeOSTest, InvalidatedDiscoverySessions) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
EXPECT_EQ(1, callback_count_);
@@ -1107,7 +1109,7 @@ TEST_F(BluetoothBlueZTest, InvalidatedDiscoverySessions) {
// Request device discovery 3 times.
for (int i = 0; i < 3; i++) {
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
}
@@ -1147,7 +1149,7 @@ TEST_F(BluetoothBlueZTest, InvalidatedDiscoverySessions) {
// cleaned up.
fake_bluetooth_adapter_client_->StopDiscovery(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
- GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, observer.discovering_changed_count());
@@ -1158,7 +1160,7 @@ TEST_F(BluetoothBlueZTest, InvalidatedDiscoverySessions) {
EXPECT_FALSE(discovery_sessions_[0]->IsActive());
}
-TEST_F(BluetoothBlueZTest, QueuedDiscoveryRequests) {
+TEST_F(BluetoothChromeOSTest, QueuedDiscoveryRequests) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
@@ -1175,7 +1177,7 @@ TEST_F(BluetoothBlueZTest, QueuedDiscoveryRequests) {
// Request to start discovery. The call should be pending.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
EXPECT_EQ(0, callback_count_);
@@ -1194,7 +1196,7 @@ TEST_F(BluetoothBlueZTest, QueuedDiscoveryRequests) {
// be no change in state.
for (int i = 0; i < 2; i++) {
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
}
@@ -1240,7 +1242,7 @@ TEST_F(BluetoothBlueZTest, QueuedDiscoveryRequests) {
// Request to start should get queued.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
EXPECT_EQ(5, callback_count_);
@@ -1272,7 +1274,7 @@ TEST_F(BluetoothBlueZTest, QueuedDiscoveryRequests) {
EXPECT_TRUE(discovery_sessions_[3]->IsActive());
}
-TEST_F(BluetoothBlueZTest, StartDiscoverySession) {
+TEST_F(BluetoothChromeOSTest, StartDiscoverySession) {
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
@@ -1290,7 +1292,7 @@ TEST_F(BluetoothBlueZTest, StartDiscoverySession) {
// Request a new discovery session.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -1306,7 +1308,7 @@ TEST_F(BluetoothBlueZTest, StartDiscoverySession) {
// in turn will destroy the previous session. Adapter should still be
// discovering and the reference count should be 1.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -1320,7 +1322,7 @@ TEST_F(BluetoothBlueZTest, StartDiscoverySession) {
// Request a new session.
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
message_loop_.Run();
@@ -1358,7 +1360,7 @@ TEST_F(BluetoothBlueZTest, StartDiscoverySession) {
EXPECT_FALSE(adapter_->IsDiscovering());
}
-TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscovery) {
+TEST_F(BluetoothChromeOSTest, SetDiscoveryFilterBeforeStartDiscovery) {
// Test a simulated discovery session.
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -1371,14 +1373,16 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscovery) {
df->AddUUID(BluetoothUUID("1000"));
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df);
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1399,8 +1403,9 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscovery) {
EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1000"));
discovery_sessions_[0]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1418,7 +1423,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscovery) {
EXPECT_EQ(nullptr, filter);
}
-TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryFail) {
+TEST_F(BluetoothChromeOSTest, SetDiscoveryFilterBeforeStartDiscoveryFail) {
// Test a simulated discovery session.
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -1431,9 +1436,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryFail) {
df->AddUUID(BluetoothUUID("1000"));
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df);
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
callback_count_ = 0;
@@ -1441,9 +1447,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryFail) {
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1461,7 +1468,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryFail) {
// This test queues two requests to StartDiscovery with pre set filter. This
// should result in SetDiscoveryFilter, then StartDiscovery, and SetDiscovery
// DBus calls
-TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) {
+TEST_F(BluetoothChromeOSTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) {
// Test a simulated discovery session.
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -1480,9 +1487,10 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) {
df2->AddUUID(BluetoothUUID("1002"));
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter2(df2);
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1491,15 +1499,17 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) {
// Queue two requests to start discovery session with filter.
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
adapter_->StartDiscoverySessionWithFilter(
discovery_filter2.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
// Run requests, on DBus level there should be call SetDiscoveryFilter, then
// StartDiscovery, then SetDiscoveryFilter again.
@@ -1528,12 +1538,14 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) {
EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1002"));
discovery_sessions_[0]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
discovery_sessions_[1]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1556,7 +1568,8 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) {
// Call StartFilteredDiscovery twice (2nd time while 1st call is still pending).
// Make the first SetDiscoveryFilter fail and the second one succeed. It should
// end up with one active discovery session.
-TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) {
+TEST_F(BluetoothChromeOSTest,
+ QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) {
// Test a simulated discovery session.
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -1575,9 +1588,10 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) {
df2->AddUUID(BluetoothUUID("1002"));
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter2(df2);
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1588,15 +1602,17 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) {
// Queue two requests to start discovery session with filter.
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
adapter_->StartDiscoverySessionWithFilter(
discovery_filter2.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1631,8 +1647,9 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) {
EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1002"));
discovery_sessions_[0]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1649,20 +1666,22 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) {
EXPECT_EQ(nullptr, filter);
}
-TEST_F(BluetoothBlueZTest, SetDiscoveryFilterAfterStartDiscovery) {
+TEST_F(BluetoothChromeOSTest, SetDiscoveryFilterAfterStartDiscovery) {
// Test a simulated discovery session.
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
TestBluetoothAdapterObserver observer(adapter_);
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1690,8 +1709,9 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterAfterStartDiscovery) {
discovery_sessions_[0]->SetDiscoveryFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(1, callback_count_);
@@ -1709,8 +1729,9 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterAfterStartDiscovery) {
EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1000"));
discovery_sessions_[0]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1730,11 +1751,12 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterAfterStartDiscovery) {
// This unit test asserts that the basic reference counting, and filter merging
// works correctly for discovery requests done via the BluetoothAdapter.
-TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
+TEST_F(BluetoothChromeOSTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
GetAdapter();
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
EXPECT_EQ(0, error_callback_count_);
EXPECT_TRUE(adapter_->IsPowered());
@@ -1769,9 +1791,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1818,8 +1841,9 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
// Request to stop discovery twice.
for (int i = 0; i < 2; i++) {
discovery_sessions_[i]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
if (i == 0) {
@@ -1893,9 +1917,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
// each result in 1 requests.
message_loop_.Run();
@@ -1933,8 +1958,9 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
// Request to stop discovery 4 times.
for (int i = 2; i < 6; i++) {
discovery_sessions_[i]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
// filter no 2 is same as filter no 5, so removing it shouldn't cause any
// filter update
@@ -1961,11 +1987,12 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) {
// This unit test asserts that filter merging logic works correctly for filtered
// discovery requests done via the BluetoothAdapter.
-TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) {
+TEST_F(BluetoothChromeOSTest, SetDiscoveryFilterMergingTest) {
GetAdapter();
- adapter_->SetPowered(
- true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter(
BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
@@ -1975,9 +2002,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) {
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -1997,9 +2025,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) {
adapter_->StartDiscoverySessionWithFilter(
discovery_filter.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -2021,9 +2050,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) {
adapter_->StartDiscoverySessionWithFilter(
discovery_filter3.Pass(),
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -2039,9 +2069,10 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) {
// start additionally classic scan
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -2054,15 +2085,16 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) {
// Request to stop discovery 4 times.
for (int i = 3; i >= 0; i--) {
discovery_sessions_[i]->Stop(
- base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
+ base::Bind(&BluetoothChromeOSTest::Callback, base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
// Every session stopping would trigger filter update
message_loop_.Run();
}
}
-TEST_F(BluetoothBlueZTest, DeviceProperties) {
+TEST_F(BluetoothChromeOSTest, DeviceProperties) {
GetAdapter();
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
@@ -2093,7 +2125,7 @@ TEST_F(BluetoothBlueZTest, DeviceProperties) {
EXPECT_EQ(0x0306, devices[0]->GetDeviceID());
}
-TEST_F(BluetoothBlueZTest, DeviceClassChanged) {
+TEST_F(BluetoothChromeOSTest, DeviceClassChanged) {
// Simulate a change of class of a device, as sometimes occurs
// during discovery.
GetAdapter();
@@ -2120,7 +2152,7 @@ TEST_F(BluetoothBlueZTest, DeviceClassChanged) {
EXPECT_EQ(BluetoothDevice::DEVICE_MOUSE, devices[0]->GetDeviceType());
}
-TEST_F(BluetoothBlueZTest, DeviceNameChanged) {
+TEST_F(BluetoothChromeOSTest, DeviceNameChanged) {
// Simulate a change of name of a device.
GetAdapter();
@@ -2149,7 +2181,7 @@ TEST_F(BluetoothBlueZTest, DeviceNameChanged) {
EXPECT_EQ(base::UTF8ToUTF16(new_name), devices[0]->GetName());
}
-TEST_F(BluetoothBlueZTest, DeviceAddressChanged) {
+TEST_F(BluetoothChromeOSTest, DeviceAddressChanged) {
// Simulate a change of address of a device.
GetAdapter();
@@ -2179,7 +2211,7 @@ TEST_F(BluetoothBlueZTest, DeviceAddressChanged) {
EXPECT_EQ(std::string(kNewAddress), devices[0]->GetAddress());
}
-TEST_F(BluetoothBlueZTest, DeviceUuidsChanged) {
+TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) {
// Simulate a change of advertised services of a device.
GetAdapter();
@@ -2223,7 +2255,7 @@ TEST_F(BluetoothBlueZTest, DeviceUuidsChanged) {
EXPECT_EQ(uuids[4], BluetoothUUID("110a"));
}
-TEST_F(BluetoothBlueZTest, DeviceInquiryRSSIInvalidated) {
+TEST_F(BluetoothChromeOSTest, DeviceInquiryRSSIInvalidated) {
// Simulate invalidation of inquiry RSSI of a device, as it occurs
// when discovery is finished.
GetAdapter();
@@ -2258,7 +2290,7 @@ TEST_F(BluetoothBlueZTest, DeviceInquiryRSSIInvalidated) {
EXPECT_EQ(unknown_power, devices[0]->GetInquiryRSSI());
}
-TEST_F(BluetoothBlueZTest, DeviceInquiryTxPowerInvalidated) {
+TEST_F(BluetoothChromeOSTest, DeviceInquiryTxPowerInvalidated) {
// Simulate invalidation of inquiry TxPower of a device, as it occurs
// when discovery is finished.
GetAdapter();
@@ -2293,7 +2325,7 @@ TEST_F(BluetoothBlueZTest, DeviceInquiryTxPowerInvalidated) {
EXPECT_EQ(unknown_power, devices[0]->GetInquiryTxPower());
}
-TEST_F(BluetoothBlueZTest, ForgetDevice) {
+TEST_F(BluetoothChromeOSTest, ForgetDevice) {
GetAdapter();
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
@@ -2318,7 +2350,7 @@ TEST_F(BluetoothBlueZTest, ForgetDevice) {
ASSERT_EQ(1U, devices.size());
}
-TEST_F(BluetoothBlueZTest, ForgetUnpairedDevice) {
+TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
GetAdapter();
DiscoverDevices();
@@ -2329,7 +2361,7 @@ TEST_F(BluetoothBlueZTest, ForgetUnpairedDevice) {
// Connect the device so it becomes trusted and remembered.
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
ASSERT_EQ(1, callback_count_);
@@ -2362,7 +2394,7 @@ TEST_F(BluetoothBlueZTest, ForgetUnpairedDevice) {
EXPECT_FALSE(device != nullptr);
}
-TEST_F(BluetoothBlueZTest, ConnectPairedDevice) {
+TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
@@ -2375,7 +2407,7 @@ TEST_F(BluetoothBlueZTest, ConnectPairedDevice) {
// Connect without a pairing delegate; since the device is already Paired
// this should succeed and the device should become connected.
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
@@ -2390,7 +2422,7 @@ TEST_F(BluetoothBlueZTest, ConnectPairedDevice) {
EXPECT_FALSE(device->IsConnecting());
}
-TEST_F(BluetoothBlueZTest, ConnectUnpairableDevice) {
+TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) {
GetAdapter();
DiscoverDevices();
@@ -2404,7 +2436,7 @@ TEST_F(BluetoothBlueZTest, ConnectUnpairableDevice) {
// Connect without a pairing delegate; since the device does not require
// pairing, this should succeed and the device should become connected.
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
@@ -2431,7 +2463,7 @@ TEST_F(BluetoothBlueZTest, ConnectUnpairableDevice) {
EXPECT_FALSE(device->IsConnectable());
}
-TEST_F(BluetoothBlueZTest, ConnectConnectedDevice) {
+TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
@@ -2440,7 +2472,7 @@ TEST_F(BluetoothBlueZTest, ConnectConnectedDevice) {
ASSERT_TRUE(device->IsPaired());
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
ASSERT_EQ(1, callback_count_);
@@ -2454,7 +2486,7 @@ TEST_F(BluetoothBlueZTest, ConnectConnectedDevice) {
TestBluetoothAdapterObserver observer(adapter_);
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, callback_count_);
@@ -2468,7 +2500,7 @@ TEST_F(BluetoothBlueZTest, ConnectConnectedDevice) {
EXPECT_FALSE(device->IsConnecting());
}
-TEST_F(BluetoothBlueZTest, ConnectDeviceFails) {
+TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) {
GetAdapter();
DiscoverDevices();
@@ -2482,7 +2514,7 @@ TEST_F(BluetoothBlueZTest, ConnectDeviceFails) {
// Connect without a pairing delegate; since the device requires pairing,
// this should fail with an error.
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, callback_count_);
@@ -2495,7 +2527,7 @@ TEST_F(BluetoothBlueZTest, ConnectDeviceFails) {
EXPECT_FALSE(device->IsConnecting());
}
-TEST_F(BluetoothBlueZTest, DisconnectDevice) {
+TEST_F(BluetoothChromeOSTest, DisconnectDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
@@ -2504,7 +2536,7 @@ TEST_F(BluetoothBlueZTest, DisconnectDevice) {
ASSERT_TRUE(device->IsPaired());
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
ASSERT_EQ(1, callback_count_);
@@ -2529,7 +2561,7 @@ TEST_F(BluetoothBlueZTest, DisconnectDevice) {
EXPECT_FALSE(device->IsConnected());
}
-TEST_F(BluetoothBlueZTest, DisconnectUnconnectedDevice) {
+TEST_F(BluetoothChromeOSTest, DisconnectUnconnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
@@ -2552,7 +2584,7 @@ TEST_F(BluetoothBlueZTest, DisconnectUnconnectedDevice) {
EXPECT_FALSE(device->IsConnected());
}
-TEST_F(BluetoothBlueZTest, PairLegacyAutopair) {
+TEST_F(BluetoothChromeOSTest, PairLegacyAutopair) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2569,7 +2601,7 @@ TEST_F(BluetoothBlueZTest, PairLegacyAutopair) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, pairing_delegate.call_count_);
@@ -2604,7 +2636,7 @@ TEST_F(BluetoothBlueZTest, PairLegacyAutopair) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairDisplayPinCode) {
+TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2620,7 +2652,7 @@ TEST_F(BluetoothBlueZTest, PairDisplayPinCode) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -2657,7 +2689,7 @@ TEST_F(BluetoothBlueZTest, PairDisplayPinCode) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairDisplayPasskey) {
+TEST_F(BluetoothChromeOSTest, PairDisplayPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2674,7 +2706,7 @@ TEST_F(BluetoothBlueZTest, PairDisplayPasskey) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
// One call for DisplayPasskey() and one for KeysEntered().
@@ -2732,7 +2764,7 @@ TEST_F(BluetoothBlueZTest, PairDisplayPasskey) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairRequestPinCode) {
+TEST_F(BluetoothChromeOSTest, PairRequestPinCode) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2748,7 +2780,7 @@ TEST_F(BluetoothBlueZTest, PairRequestPinCode) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -2786,7 +2818,7 @@ TEST_F(BluetoothBlueZTest, PairRequestPinCode) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairConfirmPasskey) {
+TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2802,7 +2834,7 @@ TEST_F(BluetoothBlueZTest, PairConfirmPasskey) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -2837,7 +2869,7 @@ TEST_F(BluetoothBlueZTest, PairConfirmPasskey) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairRequestPasskey) {
+TEST_F(BluetoothChromeOSTest, PairRequestPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2854,7 +2886,7 @@ TEST_F(BluetoothBlueZTest, PairRequestPasskey) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -2888,7 +2920,7 @@ TEST_F(BluetoothBlueZTest, PairRequestPasskey) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairJustWorks) {
+TEST_F(BluetoothChromeOSTest, PairJustWorks) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2905,7 +2937,7 @@ TEST_F(BluetoothBlueZTest, PairJustWorks) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, pairing_delegate.call_count_);
@@ -2935,7 +2967,7 @@ TEST_F(BluetoothBlueZTest, PairJustWorks) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairUnpairableDeviceFails) {
+TEST_F(BluetoothChromeOSTest, PairUnpairableDeviceFails) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2950,7 +2982,7 @@ TEST_F(BluetoothBlueZTest, PairUnpairableDeviceFails) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, pairing_delegate.call_count_);
@@ -2969,7 +3001,7 @@ TEST_F(BluetoothBlueZTest, PairUnpairableDeviceFails) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingFails) {
+TEST_F(BluetoothChromeOSTest, PairingFails) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -2985,7 +3017,7 @@ TEST_F(BluetoothBlueZTest, PairingFails) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, pairing_delegate.call_count_);
@@ -3004,7 +3036,7 @@ TEST_F(BluetoothBlueZTest, PairingFails) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingFailsAtConnection) {
+TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3021,7 +3053,7 @@ TEST_F(BluetoothBlueZTest, PairingFailsAtConnection) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, pairing_delegate.call_count_);
@@ -3051,7 +3083,7 @@ TEST_F(BluetoothBlueZTest, PairingFailsAtConnection) {
EXPECT_TRUE(properties->trusted.value());
}
-TEST_F(BluetoothBlueZTest, PairingRejectedAtPinCode) {
+TEST_F(BluetoothChromeOSTest, PairingRejectedAtPinCode) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3067,7 +3099,7 @@ TEST_F(BluetoothBlueZTest, PairingRejectedAtPinCode) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3089,7 +3121,7 @@ TEST_F(BluetoothBlueZTest, PairingRejectedAtPinCode) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingCancelledAtPinCode) {
+TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3105,7 +3137,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledAtPinCode) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3127,7 +3159,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledAtPinCode) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingRejectedAtPasskey) {
+TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3143,7 +3175,7 @@ TEST_F(BluetoothBlueZTest, PairingRejectedAtPasskey) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3165,7 +3197,7 @@ TEST_F(BluetoothBlueZTest, PairingRejectedAtPasskey) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingCancelledAtPasskey) {
+TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3181,7 +3213,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledAtPasskey) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3203,7 +3235,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledAtPasskey) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingRejectedAtConfirmation) {
+TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3219,7 +3251,7 @@ TEST_F(BluetoothBlueZTest, PairingRejectedAtConfirmation) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3241,7 +3273,7 @@ TEST_F(BluetoothBlueZTest, PairingRejectedAtConfirmation) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingCancelledAtConfirmation) {
+TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3257,7 +3289,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledAtConfirmation) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3279,7 +3311,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledAtConfirmation) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, PairingCancelledInFlight) {
+TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3295,7 +3327,7 @@ TEST_F(BluetoothBlueZTest, PairingCancelledInFlight) {
TestPairingDelegate pairing_delegate;
device->Connect(&pairing_delegate, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, pairing_delegate.call_count_);
@@ -3316,14 +3348,15 @@ TEST_F(BluetoothBlueZTest, PairingCancelledInFlight) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, IncomingPairRequestPinCode) {
+TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
TestPairingDelegate pairing_delegate;
adapter_->AddPairingDelegate(
- &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
+ &pairing_delegate,
+ BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
// Requires that we provide a PIN code.
fake_bluetooth_device_client_->CreateDevice(
@@ -3338,7 +3371,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPinCode) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3364,19 +3397,20 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPinCode) {
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairConfirmPasskey) {
+TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
TestPairingDelegate pairing_delegate;
adapter_->AddPairingDelegate(
- &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
+ &pairing_delegate,
+ BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
// Requests that we confirm a displayed passkey.
fake_bluetooth_device_client_->CreateDevice(
@@ -3391,7 +3425,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairConfirmPasskey) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3418,19 +3452,20 @@ TEST_F(BluetoothBlueZTest, IncomingPairConfirmPasskey) {
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairRequestPasskey) {
+TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
TestPairingDelegate pairing_delegate;
adapter_->AddPairingDelegate(
- &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
+ &pairing_delegate,
+ BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
// Requests that we provide a Passkey.
fake_bluetooth_device_client_->CreateDevice(
@@ -3445,7 +3480,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPasskey) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3471,19 +3506,20 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPasskey) {
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairJustWorks) {
+TEST_F(BluetoothChromeOSTest, IncomingPairJustWorks) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
TestPairingDelegate pairing_delegate;
adapter_->AddPairingDelegate(
- &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
+ &pairing_delegate,
+ BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
// Uses just-works pairing so, sinec this an incoming pairing, require
// authorization from the user.
@@ -3499,7 +3535,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairJustWorks) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
- GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
@@ -3525,12 +3561,12 @@ TEST_F(BluetoothBlueZTest, IncomingPairJustWorks) {
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairRequestPinCodeWithoutDelegate) {
+TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCodeWithoutDelegate) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3549,7 +3585,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPinCodeWithoutDelegate) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -3564,12 +3600,12 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPinCodeWithoutDelegate) {
EXPECT_FALSE(device->IsPaired());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairConfirmPasskeyWithoutDelegate) {
+TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskeyWithoutDelegate) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3588,7 +3624,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairConfirmPasskeyWithoutDelegate) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -3603,12 +3639,12 @@ TEST_F(BluetoothBlueZTest, IncomingPairConfirmPasskeyWithoutDelegate) {
EXPECT_FALSE(device->IsPaired());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairRequestPasskeyWithoutDelegate) {
+TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskeyWithoutDelegate) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3627,7 +3663,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPasskeyWithoutDelegate) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -3642,12 +3678,12 @@ TEST_F(BluetoothBlueZTest, IncomingPairRequestPasskeyWithoutDelegate) {
EXPECT_FALSE(device->IsPaired());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, IncomingPairJustWorksWithoutDelegate) {
+TEST_F(BluetoothChromeOSTest, IncomingPairJustWorksWithoutDelegate) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
@@ -3666,7 +3702,7 @@ TEST_F(BluetoothBlueZTest, IncomingPairJustWorksWithoutDelegate) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
- GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -3681,19 +3717,20 @@ TEST_F(BluetoothBlueZTest, IncomingPairJustWorksWithoutDelegate) {
EXPECT_FALSE(device->IsPaired());
// No pairing context should remain on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
}
-TEST_F(BluetoothBlueZTest, RemovePairingDelegateDuringPairing) {
+TEST_F(BluetoothChromeOSTest, RemovePairingDelegateDuringPairing) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
TestPairingDelegate pairing_delegate;
adapter_->AddPairingDelegate(
- &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
+ &pairing_delegate,
+ BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
// Requests that we provide a Passkey.
fake_bluetooth_device_client_->CreateDevice(
@@ -3708,21 +3745,21 @@ TEST_F(BluetoothBlueZTest, RemovePairingDelegateDuringPairing) {
fake_bluetooth_device_client_->SimulatePairing(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
- true, GetCallback(), base::Bind(&BluetoothBlueZTest::DBusErrorCallback,
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
// A pairing context should now be set on the device.
- BluetoothDeviceBlueZ* device_bluez =
- static_cast<BluetoothDeviceBlueZ*>(device);
- ASSERT_TRUE(device_bluez->GetPairing() != nullptr);
+ BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<BluetoothDeviceChromeOS*>(device);
+ ASSERT_TRUE(device_chromeos->GetPairing() != nullptr);
// Removing the pairing delegate should remove that pairing context.
adapter_->RemovePairingDelegate(&pairing_delegate);
- EXPECT_TRUE(device_bluez->GetPairing() == nullptr);
+ EXPECT_TRUE(device_chromeos->GetPairing() == nullptr);
// Set the Passkey, this should now have no effect since the pairing has
// been, in-effect, cancelled
@@ -3735,7 +3772,7 @@ TEST_F(BluetoothBlueZTest, RemovePairingDelegateDuringPairing) {
EXPECT_FALSE(device->IsPaired());
}
-TEST_F(BluetoothBlueZTest, DeviceId) {
+TEST_F(BluetoothChromeOSTest, DeviceId) {
GetAdapter();
// Use the built-in paired device for this test, grab its Properties
@@ -3790,7 +3827,7 @@ TEST_F(BluetoothBlueZTest, DeviceId) {
EXPECT_EQ(0, device->GetDeviceID());
}
-TEST_F(BluetoothBlueZTest, GetConnectionInfoForDisconnectedDevice) {
+TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
@@ -3806,13 +3843,13 @@ TEST_F(BluetoothBlueZTest, GetConnectionInfoForDisconnectedDevice) {
EXPECT_EQ(unknown_power, conn_info.max_transmit_power);
}
-TEST_F(BluetoothBlueZTest, GetConnectionInfoForConnectedDevice) {
+TEST_F(BluetoothChromeOSTest, GetConnectionInfoForConnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
device->Connect(nullptr, GetCallback(),
- base::Bind(&BluetoothBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_TRUE(device->IsConnected());
@@ -3827,13 +3864,13 @@ TEST_F(BluetoothBlueZTest, GetConnectionInfoForConnectedDevice) {
}
// Verifies Shutdown shuts down the adapter as expected.
-TEST_F(BluetoothBlueZTest, Shutdown) {
+TEST_F(BluetoothChromeOSTest, Shutdown) {
// Set up adapter. Set powered & discoverable, start discovery.
GetAdapter();
adapter_->SetPowered(true, GetCallback(), GetErrorCallback());
adapter_->SetDiscoverable(true, GetCallback(), GetErrorCallback());
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
base::MessageLoop::current()->Run();
@@ -3857,13 +3894,13 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
EXPECT_NE(nullptr,
adapter_->GetDevice(
bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
- EXPECT_NE(dbus::ObjectPath(""),
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get())->object_path());
+ EXPECT_NE(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>(
+ adapter_.get())->object_path());
// Shutdown
adapter_->Shutdown();
- // Validate post shutdown state by calling all BluetoothAdapterBlueZ
+ // Validate post shutdown state by calling all BluetoothAdapterChromeOS
// members, in declaration order:
adapter_->Shutdown();
@@ -3899,15 +3936,15 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
BluetoothAudioSink::Options audio_sink_options;
adapter_->RegisterAudioSink(
audio_sink_options,
- base::Bind(&BluetoothBlueZTest::AudioSinkAcquiredCallback,
+ base::Bind(&BluetoothChromeOSTest::AudioSinkAcquiredCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::AudioSinkErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::AudioSinkErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, callback_count_);
EXPECT_EQ(1, error_callback_count_--) << "RegisterAudioSink error";
- BluetoothAdapterBlueZ* adapter_chrome_os =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter_chrome_os =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
EXPECT_EQ(nullptr,
adapter_chrome_os->GetDeviceWithPath(dbus::ObjectPath("")));
@@ -3934,9 +3971,9 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
- base::Bind(&BluetoothBlueZTest::ProfileRegisteredCallback,
+ base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCompletionCallback,
+ base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
base::Unretained(this)));
EXPECT_FALSE(adapter_profile_) << "UseProfile error";
@@ -3964,9 +4001,9 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
adapter_chrome_os->OnRequestDefaultAgentError("", "");
adapter_chrome_os->OnRegisterAudioSink(
- base::Bind(&BluetoothBlueZTest::AudioSinkAcquiredCallback,
+ base::Bind(&BluetoothChromeOSTest::AudioSinkAcquiredCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::AudioSinkErrorCallback,
+ base::Bind(&BluetoothChromeOSTest::AudioSinkErrorCallback,
base::Unretained(this)),
scoped_refptr<device::BluetoothAudioSink>());
EXPECT_EQ(0, callback_count_);
@@ -4012,9 +4049,9 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
- base::Bind(&BluetoothBlueZTest::ProfileRegisteredCallback,
+ base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCompletionCallback,
+ base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
base::Unretained(this)));
EXPECT_FALSE(adapter_profile_) << "UseProfile error";
@@ -4023,9 +4060,9 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
adapter_chrome_os->SetProfileDelegate(
BluetoothUUID(), dbus::ObjectPath(""), &profile_delegate,
- base::Bind(&BluetoothBlueZTest::ProfileRegisteredCallback,
+ base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
- base::Bind(&BluetoothBlueZTest::ErrorCompletionCallback,
+ base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
base::Unretained(this)));
EXPECT_EQ(0, callback_count_) << "SetProfileDelegate error";
EXPECT_EQ(1, error_callback_count_--) << "SetProfileDelegate error";
@@ -4039,7 +4076,7 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
// From BluetoothAdapater:
adapter_->StartDiscoverySession(
- base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
base::Unretained(this)),
GetErrorCallback());
EXPECT_EQ(0, callback_count_) << "StartDiscoverySession error";
@@ -4056,11 +4093,11 @@ TEST_F(BluetoothBlueZTest, Shutdown) {
}
// Verifies post-Shutdown of discovery sessions and OnStartDiscovery.
-TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscovery) {
+TEST_F(BluetoothChromeOSTest, Shutdown_OnStartDiscovery) {
const int kNumberOfDiscoverySessions = 10;
GetAdapter();
- BluetoothAdapterBlueZ* adapter_chrome_os =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter_chrome_os =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
for (int i = 0; i < kNumberOfDiscoverySessions; i++) {
adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(),
@@ -4075,11 +4112,11 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscovery) {
}
// Verifies post-Shutdown of discovery sessions and OnStartDiscoveryError.
-TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscoveryError) {
+TEST_F(BluetoothChromeOSTest, Shutdown_OnStartDiscoveryError) {
const int kNumberOfDiscoverySessions = 10;
GetAdapter();
- BluetoothAdapterBlueZ* adapter_chrome_os =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter_chrome_os =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
for (int i = 0; i < kNumberOfDiscoverySessions; i++) {
adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(),
@@ -4094,11 +4131,11 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscoveryError) {
}
// Verifies post-Shutdown of discovery sessions and OnStartDiscovery.
-TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscovery) {
+TEST_F(BluetoothChromeOSTest, Shutdown_OnStopDiscovery) {
const int kNumberOfDiscoverySessions = 10;
GetAdapter();
- BluetoothAdapterBlueZ* adapter_chrome_os =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter_chrome_os =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
// In order to queue up discovery sessions before an OnStopDiscovery call
// RemoveDiscoverySession must be called, so Add, Start, and Remove:
@@ -4125,11 +4162,11 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscovery) {
}
// Verifies post-Shutdown of discovery sessions and OnStopDiscoveryError.
-TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscoveryError) {
+TEST_F(BluetoothChromeOSTest, Shutdown_OnStopDiscoveryError) {
const int kNumberOfDiscoverySessions = 10;
GetAdapter();
- BluetoothAdapterBlueZ* adapter_chrome_os =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get());
+ BluetoothAdapterChromeOS* adapter_chrome_os =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
// In order to queue up discovery sessions before an OnStopDiscoveryError call
// RemoveDiscoverySession must be called, so Add, Start, and Remove:
@@ -4155,4 +4192,4 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscoveryError) {
EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_);
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_device_bluez.cc b/device/bluetooth/bluetooth_device_chromeos.cc
index 731e5e5..89c5572 100644
--- a/device/bluetooth/bluetooth_device_bluez.cc
+++ b/device/bluetooth/bluetooth_device_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_device_bluez.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#include <stdio.h>
@@ -12,12 +12,12 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "dbus/bus.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
-#include "device/bluetooth/bluetooth_gatt_connection_bluez.h"
-#include "device/bluetooth/bluetooth_pairing_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#include "device/bluetooth/bluetooth_gatt_connection_chromeos.h"
+#include "device/bluetooth/bluetooth_pairing_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "device/bluetooth/bluetooth_socket.h"
-#include "device/bluetooth/bluetooth_socket_bluez.h"
+#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
@@ -63,11 +63,11 @@ void ParseModalias(const dbus::ObjectPath& object_path,
BluetoothDevice::VendorIDSource source_value;
int vendor_value, product_value, device_value;
- if (sscanf(modalias.c_str(), "bluetooth:v%04xp%04xd%04x", &vendor_value,
- &product_value, &device_value) == 3) {
+ if (sscanf(modalias.c_str(), "bluetooth:v%04xp%04xd%04x",
+ &vendor_value, &product_value, &device_value) == 3) {
source_value = BluetoothDevice::VENDOR_ID_BLUETOOTH;
- } else if (sscanf(modalias.c_str(), "usb:v%04xp%04xd%04x", &vendor_value,
- &product_value, &device_value) == 3) {
+ } else if (sscanf(modalias.c_str(), "usb:v%04xp%04xd%04x",
+ &vendor_value, &product_value, &device_value) == 3) {
source_value = BluetoothDevice::VENDOR_ID_USB;
} else {
return;
@@ -111,16 +111,17 @@ void RecordPairingResult(BluetoothDevice::ConnectErrorCode error_code) {
pairing_result = UMA_PAIRING_RESULT_UNKNOWN_ERROR;
}
- UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingResult", pairing_result,
+ UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingResult",
+ pairing_result,
UMA_PAIRING_RESULT_COUNT);
}
} // namespace
-namespace bluez {
+namespace chromeos {
-BluetoothDeviceBlueZ::BluetoothDeviceBlueZ(
- BluetoothAdapterBlueZ* adapter,
+BluetoothDeviceChromeOS::BluetoothDeviceChromeOS(
+ BluetoothAdapterChromeOS* adapter,
const dbus::ObjectPath& object_path,
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<device::BluetoothSocketThread> socket_thread)
@@ -145,7 +146,7 @@ BluetoothDeviceBlueZ::BluetoothDeviceBlueZ(
}
}
-BluetoothDeviceBlueZ::~BluetoothDeviceBlueZ() {
+BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() {
bluez::BluezDBusManager::Get()
->GetBluetoothGattServiceClient()
->RemoveObserver(this);
@@ -158,12 +159,12 @@ BluetoothDeviceBlueZ::~BluetoothDeviceBlueZ() {
iter != gatt_services.end(); ++iter) {
DCHECK(adapter_);
adapter()->NotifyGattServiceRemoved(
- static_cast<BluetoothRemoteGattServiceBlueZ*>(iter->second));
+ static_cast<BluetoothRemoteGattServiceChromeOS*>(iter->second));
delete iter->second;
}
}
-uint32 BluetoothDeviceBlueZ::GetBluetoothClass() const {
+uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -172,7 +173,7 @@ uint32 BluetoothDeviceBlueZ::GetBluetoothClass() const {
return properties->bluetooth_class.value();
}
-std::string BluetoothDeviceBlueZ::GetDeviceName() const {
+std::string BluetoothDeviceChromeOS::GetDeviceName() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -181,19 +182,19 @@ std::string BluetoothDeviceBlueZ::GetDeviceName() const {
return properties->alias.value();
}
-void BluetoothDeviceBlueZ::CreateGattConnectionImpl() {
- // BlueZ implementation does not use the default CreateGattConnection
+void BluetoothDeviceChromeOS::CreateGattConnectionImpl() {
+ // ChromeOS implementation does not use the default CreateGattConnection
// implementation.
NOTIMPLEMENTED();
}
-void BluetoothDeviceBlueZ::DisconnectGatt() {
- // BlueZ implementation does not use the default CreateGattConnection
+void BluetoothDeviceChromeOS::DisconnectGatt() {
+ // ChromeOS implementation does not use the default CreateGattConnection
// implementation.
NOTIMPLEMENTED();
}
-std::string BluetoothDeviceBlueZ::GetAddress() const {
+std::string BluetoothDeviceChromeOS::GetAddress() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -202,32 +203,32 @@ std::string BluetoothDeviceBlueZ::GetAddress() const {
return CanonicalizeAddress(properties->address.value());
}
-BluetoothDevice::VendorIDSource BluetoothDeviceBlueZ::GetVendorIDSource()
- const {
+BluetoothDevice::VendorIDSource
+BluetoothDeviceChromeOS::GetVendorIDSource() const {
VendorIDSource vendor_id_source = VENDOR_ID_UNKNOWN;
ParseModalias(object_path_, &vendor_id_source, NULL, NULL, NULL);
return vendor_id_source;
}
-uint16 BluetoothDeviceBlueZ::GetVendorID() const {
- uint16 vendor_id = 0;
+uint16 BluetoothDeviceChromeOS::GetVendorID() const {
+ uint16 vendor_id = 0;
ParseModalias(object_path_, NULL, &vendor_id, NULL, NULL);
return vendor_id;
}
-uint16 BluetoothDeviceBlueZ::GetProductID() const {
- uint16 product_id = 0;
+uint16 BluetoothDeviceChromeOS::GetProductID() const {
+ uint16 product_id = 0;
ParseModalias(object_path_, NULL, NULL, &product_id, NULL);
return product_id;
}
-uint16 BluetoothDeviceBlueZ::GetDeviceID() const {
- uint16 device_id = 0;
+uint16 BluetoothDeviceChromeOS::GetDeviceID() const {
+ uint16 device_id = 0;
ParseModalias(object_path_, NULL, NULL, NULL, &device_id);
return device_id;
}
-bool BluetoothDeviceBlueZ::IsPaired() const {
+bool BluetoothDeviceChromeOS::IsPaired() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -239,7 +240,7 @@ bool BluetoothDeviceBlueZ::IsPaired() const {
return properties->paired.value() || properties->trusted.value();
}
-bool BluetoothDeviceBlueZ::IsConnected() const {
+bool BluetoothDeviceChromeOS::IsConnected() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -248,12 +249,12 @@ bool BluetoothDeviceBlueZ::IsConnected() const {
return properties->connected.value();
}
-bool BluetoothDeviceBlueZ::IsGattConnected() const {
+bool BluetoothDeviceChromeOS::IsGattConnected() const {
NOTIMPLEMENTED();
return false;
}
-bool BluetoothDeviceBlueZ::IsConnectable() const {
+bool BluetoothDeviceChromeOS::IsConnectable() const {
bluez::BluetoothInputClient::Properties* input_properties =
bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties(
object_path_);
@@ -265,18 +266,18 @@ bool BluetoothDeviceBlueZ::IsConnectable() const {
return input_properties->reconnect_mode.value() != "device";
}
-bool BluetoothDeviceBlueZ::IsConnecting() const {
+bool BluetoothDeviceChromeOS::IsConnecting() const {
return num_connecting_calls_ > 0;
}
-BluetoothDeviceBlueZ::UUIDList BluetoothDeviceBlueZ::GetUUIDs() const {
+BluetoothDeviceChromeOS::UUIDList BluetoothDeviceChromeOS::GetUUIDs() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
DCHECK(properties);
std::vector<device::BluetoothUUID> uuids;
- const std::vector<std::string>& dbus_uuids = properties->uuids.value();
+ const std::vector<std::string> &dbus_uuids = properties->uuids.value();
for (std::vector<std::string>::const_iterator iter = dbus_uuids.begin();
iter != dbus_uuids.end(); ++iter) {
device::BluetoothUUID uuid(*iter);
@@ -286,7 +287,7 @@ BluetoothDeviceBlueZ::UUIDList BluetoothDeviceBlueZ::GetUUIDs() const {
return uuids;
}
-int16 BluetoothDeviceBlueZ::GetInquiryRSSI() const {
+int16 BluetoothDeviceChromeOS::GetInquiryRSSI() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -298,7 +299,7 @@ int16 BluetoothDeviceBlueZ::GetInquiryRSSI() const {
return properties->rssi.value();
}
-int16 BluetoothDeviceBlueZ::GetInquiryTxPower() const {
+int16 BluetoothDeviceChromeOS::GetInquiryTxPower() const {
bluez::BluetoothDeviceClient::Properties* properties =
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
object_path_);
@@ -310,30 +311,30 @@ int16 BluetoothDeviceBlueZ::GetInquiryTxPower() const {
return properties->tx_power.value();
}
-bool BluetoothDeviceBlueZ::ExpectingPinCode() const {
+bool BluetoothDeviceChromeOS::ExpectingPinCode() const {
return pairing_.get() && pairing_->ExpectingPinCode();
}
-bool BluetoothDeviceBlueZ::ExpectingPasskey() const {
+bool BluetoothDeviceChromeOS::ExpectingPasskey() const {
return pairing_.get() && pairing_->ExpectingPasskey();
}
-bool BluetoothDeviceBlueZ::ExpectingConfirmation() const {
+bool BluetoothDeviceChromeOS::ExpectingConfirmation() const {
return pairing_.get() && pairing_->ExpectingConfirmation();
}
-void BluetoothDeviceBlueZ::GetConnectionInfo(
+void BluetoothDeviceChromeOS::GetConnectionInfo(
const ConnectionInfoCallback& callback) {
// DBus method call should gracefully return an error if the device is not
// currently connected.
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetConnInfo(
- object_path_, base::Bind(&BluetoothDeviceBlueZ::OnGetConnInfo,
+ object_path_, base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfo,
weak_ptr_factory_.GetWeakPtr(), callback),
- base::Bind(&BluetoothDeviceBlueZ::OnGetConnInfoError,
+ base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfoError,
weak_ptr_factory_.GetWeakPtr(), callback));
}
-void BluetoothDeviceBlueZ::Connect(
+void BluetoothDeviceChromeOS::Connect(
BluetoothDevice::PairingDelegate* pairing_delegate,
const base::Closure& callback,
const ConnectErrorCallback& error_callback) {
@@ -352,42 +353,42 @@ void BluetoothDeviceBlueZ::Connect(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair(
object_path_,
- base::Bind(&BluetoothDeviceBlueZ::OnPair,
+ base::Bind(&BluetoothDeviceChromeOS::OnPair,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
- base::Bind(&BluetoothDeviceBlueZ::OnPairError,
+ base::Bind(&BluetoothDeviceChromeOS::OnPairError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
}
-void BluetoothDeviceBlueZ::SetPinCode(const std::string& pincode) {
+void BluetoothDeviceChromeOS::SetPinCode(const std::string& pincode) {
if (!pairing_.get())
return;
pairing_->SetPinCode(pincode);
}
-void BluetoothDeviceBlueZ::SetPasskey(uint32 passkey) {
+void BluetoothDeviceChromeOS::SetPasskey(uint32 passkey) {
if (!pairing_.get())
return;
pairing_->SetPasskey(passkey);
}
-void BluetoothDeviceBlueZ::ConfirmPairing() {
+void BluetoothDeviceChromeOS::ConfirmPairing() {
if (!pairing_.get())
return;
pairing_->ConfirmPairing();
}
-void BluetoothDeviceBlueZ::RejectPairing() {
+void BluetoothDeviceChromeOS::RejectPairing() {
if (!pairing_.get())
return;
pairing_->RejectPairing();
}
-void BluetoothDeviceBlueZ::CancelPairing() {
+void BluetoothDeviceChromeOS::CancelPairing() {
bool canceled = false;
// If there is a callback in progress that we can reply to then use that
@@ -401,7 +402,7 @@ void BluetoothDeviceBlueZ::CancelPairing() {
<< "Sending explicit cancel";
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->CancelPairing(
object_path_, base::Bind(&base::DoNothing),
- base::Bind(&BluetoothDeviceBlueZ::OnCancelPairingError,
+ base::Bind(&BluetoothDeviceChromeOS::OnCancelPairingError,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -412,53 +413,53 @@ void BluetoothDeviceBlueZ::CancelPairing() {
EndPairing();
}
-void BluetoothDeviceBlueZ::Disconnect(const base::Closure& callback,
- const ErrorCallback& error_callback) {
+void BluetoothDeviceChromeOS::Disconnect(const base::Closure& callback,
+ const ErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Disconnecting";
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Disconnect(
- object_path_, base::Bind(&BluetoothDeviceBlueZ::OnDisconnect,
+ object_path_, base::Bind(&BluetoothDeviceChromeOS::OnDisconnect,
weak_ptr_factory_.GetWeakPtr(), callback),
- base::Bind(&BluetoothDeviceBlueZ::OnDisconnectError,
+ base::Bind(&BluetoothDeviceChromeOS::OnDisconnectError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothDeviceBlueZ::Forget(const ErrorCallback& error_callback) {
+void BluetoothDeviceChromeOS::Forget(const ErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Removing device";
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
adapter()->object_path(), object_path_, base::Bind(&base::DoNothing),
- base::Bind(&BluetoothDeviceBlueZ::OnForgetError,
+ base::Bind(&BluetoothDeviceChromeOS::OnForgetError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothDeviceBlueZ::ConnectToService(
+void BluetoothDeviceChromeOS::ConnectToService(
const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
const ConnectToServiceErrorCallback& error_callback) {
- VLOG(1) << object_path_.value()
- << ": Connecting to service: " << uuid.canonical_value();
- scoped_refptr<BluetoothSocketBlueZ> socket =
- BluetoothSocketBlueZ::CreateBluetoothSocket(ui_task_runner_,
- socket_thread_);
- socket->Connect(this, uuid, BluetoothSocketBlueZ::SECURITY_LEVEL_MEDIUM,
+ VLOG(1) << object_path_.value() << ": Connecting to service: "
+ << uuid.canonical_value();
+ scoped_refptr<BluetoothSocketChromeOS> socket =
+ BluetoothSocketChromeOS::CreateBluetoothSocket(
+ ui_task_runner_, socket_thread_);
+ socket->Connect(this, uuid, BluetoothSocketChromeOS::SECURITY_LEVEL_MEDIUM,
base::Bind(callback, socket), error_callback);
}
-void BluetoothDeviceBlueZ::ConnectToServiceInsecurely(
+void BluetoothDeviceChromeOS::ConnectToServiceInsecurely(
const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
const ConnectToServiceErrorCallback& error_callback) {
- VLOG(1) << object_path_.value()
- << ": Connecting insecurely to service: " << uuid.canonical_value();
- scoped_refptr<BluetoothSocketBlueZ> socket =
- BluetoothSocketBlueZ::CreateBluetoothSocket(ui_task_runner_,
- socket_thread_);
- socket->Connect(this, uuid, BluetoothSocketBlueZ::SECURITY_LEVEL_LOW,
+ VLOG(1) << object_path_.value() << ": Connecting insecurely to service: "
+ << uuid.canonical_value();
+ scoped_refptr<BluetoothSocketChromeOS> socket =
+ BluetoothSocketChromeOS::CreateBluetoothSocket(
+ ui_task_runner_, socket_thread_);
+ socket->Connect(this, uuid, BluetoothSocketChromeOS::SECURITY_LEVEL_LOW,
base::Bind(callback, socket), error_callback);
}
-void BluetoothDeviceBlueZ::CreateGattConnection(
- const GattConnectionCallback& callback,
- const ConnectErrorCallback& error_callback) {
+void BluetoothDeviceChromeOS::CreateGattConnection(
+ const GattConnectionCallback& callback,
+ const ConnectErrorCallback& error_callback) {
// TODO(sacomoto): Workaround to retrieve the connection for already connected
// devices. Currently, BluetoothGattConnection::Disconnect doesn't do
// anything, the unique underlying physical GATT connection is kept. This
@@ -471,30 +472,32 @@ void BluetoothDeviceBlueZ::CreateGattConnection(
// TODO(armansito): Until there is a way to create a reference counted GATT
// connection in bluetoothd, simply do a regular connect.
- Connect(NULL, base::Bind(&BluetoothDeviceBlueZ::OnCreateGattConnection,
- weak_ptr_factory_.GetWeakPtr(), callback),
+ Connect(NULL,
+ base::Bind(&BluetoothDeviceChromeOS::OnCreateGattConnection,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback),
error_callback);
}
-BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing(
+BluetoothPairingChromeOS* BluetoothDeviceChromeOS::BeginPairing(
BluetoothDevice::PairingDelegate* pairing_delegate) {
- pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate));
+ pairing_.reset(new BluetoothPairingChromeOS(this, pairing_delegate));
return pairing_.get();
}
-void BluetoothDeviceBlueZ::EndPairing() {
+void BluetoothDeviceChromeOS::EndPairing() {
pairing_.reset();
}
-BluetoothPairingBlueZ* BluetoothDeviceBlueZ::GetPairing() const {
+BluetoothPairingChromeOS* BluetoothDeviceChromeOS::GetPairing() const {
return pairing_.get();
}
-BluetoothAdapterBlueZ* BluetoothDeviceBlueZ::adapter() const {
- return static_cast<BluetoothAdapterBlueZ*>(adapter_);
+BluetoothAdapterChromeOS* BluetoothDeviceChromeOS::adapter() const {
+ return static_cast<BluetoothAdapterChromeOS*>(adapter_);
}
-void BluetoothDeviceBlueZ::GattServiceAdded(
+void BluetoothDeviceChromeOS::GattServiceAdded(
const dbus::ObjectPath& object_path) {
if (GetGattService(object_path.value())) {
VLOG(1) << "Remote GATT service already exists: " << object_path.value();
@@ -513,8 +516,8 @@ void BluetoothDeviceBlueZ::GattServiceAdded(
VLOG(1) << "Adding new remote GATT service for device: " << GetAddress();
- BluetoothRemoteGattServiceBlueZ* service =
- new BluetoothRemoteGattServiceBlueZ(adapter(), this, object_path);
+ BluetoothRemoteGattServiceChromeOS* service =
+ new BluetoothRemoteGattServiceChromeOS(adapter(), this, object_path);
gatt_services_[service->GetIdentifier()] = service;
DCHECK(service->object_path() == object_path);
@@ -524,7 +527,7 @@ void BluetoothDeviceBlueZ::GattServiceAdded(
adapter()->NotifyGattServiceAdded(service);
}
-void BluetoothDeviceBlueZ::GattServiceRemoved(
+void BluetoothDeviceChromeOS::GattServiceRemoved(
const dbus::ObjectPath& object_path) {
GattServiceMap::iterator iter = gatt_services_.find(object_path.value());
if (iter == gatt_services_.end()) {
@@ -532,8 +535,8 @@ void BluetoothDeviceBlueZ::GattServiceRemoved(
return;
}
- BluetoothRemoteGattServiceBlueZ* service =
- static_cast<BluetoothRemoteGattServiceBlueZ*>(iter->second);
+ BluetoothRemoteGattServiceChromeOS* service =
+ static_cast<BluetoothRemoteGattServiceChromeOS*>(iter->second);
VLOG(1) << "Removing remote GATT service with UUID: '"
<< service->GetUUID().canonical_value()
@@ -548,14 +551,15 @@ void BluetoothDeviceBlueZ::GattServiceRemoved(
delete service;
}
-void BluetoothDeviceBlueZ::OnGetConnInfo(const ConnectionInfoCallback& callback,
- int16 rssi,
- int16 transmit_power,
- int16 max_transmit_power) {
+void BluetoothDeviceChromeOS::OnGetConnInfo(
+ const ConnectionInfoCallback& callback,
+ int16 rssi,
+ int16 transmit_power,
+ int16 max_transmit_power) {
callback.Run(ConnectionInfo(rssi, transmit_power, max_transmit_power));
}
-void BluetoothDeviceBlueZ::OnGetConnInfoError(
+void BluetoothDeviceChromeOS::OnGetConnInfoError(
const ConnectionInfoCallback& callback,
const std::string& error_name,
const std::string& error_message) {
@@ -565,28 +569,28 @@ void BluetoothDeviceBlueZ::OnGetConnInfoError(
callback.Run(ConnectionInfo());
}
-void BluetoothDeviceBlueZ::ConnectInternal(
+void BluetoothDeviceChromeOS::ConnectInternal(
bool after_pairing,
const base::Closure& callback,
const ConnectErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Connecting";
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Connect(
object_path_,
- base::Bind(&BluetoothDeviceBlueZ::OnConnect,
+ base::Bind(&BluetoothDeviceChromeOS::OnConnect,
weak_ptr_factory_.GetWeakPtr(), after_pairing, callback),
- base::Bind(&BluetoothDeviceBlueZ::OnConnectError,
+ base::Bind(&BluetoothDeviceChromeOS::OnConnectError,
weak_ptr_factory_.GetWeakPtr(), after_pairing,
error_callback));
}
-void BluetoothDeviceBlueZ::OnConnect(bool after_pairing,
- const base::Closure& callback) {
+void BluetoothDeviceChromeOS::OnConnect(bool after_pairing,
+ const base::Closure& callback) {
if (--num_connecting_calls_ == 0)
adapter()->NotifyDeviceChanged(this);
DCHECK(num_connecting_calls_ >= 0);
VLOG(1) << object_path_.value() << ": Connected, " << num_connecting_calls_
- << " still in progress";
+ << " still in progress";
SetTrusted();
@@ -598,14 +602,15 @@ void BluetoothDeviceBlueZ::OnConnect(bool after_pairing,
callback.Run();
}
-void BluetoothDeviceBlueZ::OnCreateGattConnection(
+void BluetoothDeviceChromeOS::OnCreateGattConnection(
const GattConnectionCallback& callback) {
scoped_ptr<device::BluetoothGattConnection> conn(
- new BluetoothGattConnectionBlueZ(adapter_, GetAddress(), object_path_));
+ new BluetoothGattConnectionChromeOS(
+ adapter_, GetAddress(), object_path_));
callback.Run(conn.Pass());
}
-void BluetoothDeviceBlueZ::OnConnectError(
+void BluetoothDeviceChromeOS::OnConnectError(
bool after_pairing,
const ConnectErrorCallback& error_callback,
const std::string& error_name,
@@ -614,9 +619,8 @@ void BluetoothDeviceBlueZ::OnConnectError(
adapter()->NotifyDeviceChanged(this);
DCHECK(num_connecting_calls_ >= 0);
- LOG(WARNING) << object_path_.value()
- << ": Failed to connect device: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << object_path_.value() << ": Failed to connect device: "
+ << error_name << ": " << error_message;
VLOG(1) << object_path_.value() << ": " << num_connecting_calls_
<< " still in progress";
@@ -635,8 +639,9 @@ void BluetoothDeviceBlueZ::OnConnectError(
error_callback.Run(error_code);
}
-void BluetoothDeviceBlueZ::OnPair(const base::Closure& callback,
- const ConnectErrorCallback& error_callback) {
+void BluetoothDeviceChromeOS::OnPair(
+ const base::Closure& callback,
+ const ConnectErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Paired";
EndPairing();
@@ -644,7 +649,7 @@ void BluetoothDeviceBlueZ::OnPair(const base::Closure& callback,
ConnectInternal(true, callback, error_callback);
}
-void BluetoothDeviceBlueZ::OnPairError(
+void BluetoothDeviceChromeOS::OnPairError(
const ConnectErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -652,9 +657,8 @@ void BluetoothDeviceBlueZ::OnPairError(
adapter()->NotifyDeviceChanged(this);
DCHECK(num_connecting_calls_ >= 0);
- LOG(WARNING) << object_path_.value()
- << ": Failed to pair device: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << object_path_.value() << ": Failed to pair device: "
+ << error_name << ": " << error_message;
VLOG(1) << object_path_.value() << ": " << num_connecting_calls_
<< " still in progress";
@@ -680,15 +684,14 @@ void BluetoothDeviceBlueZ::OnPairError(
error_callback.Run(error_code);
}
-void BluetoothDeviceBlueZ::OnCancelPairingError(
+void BluetoothDeviceChromeOS::OnCancelPairingError(
const std::string& error_name,
const std::string& error_message) {
- LOG(WARNING) << object_path_.value()
- << ": Failed to cancel pairing: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << object_path_.value() << ": Failed to cancel pairing: "
+ << error_name << ": " << error_message;
}
-void BluetoothDeviceBlueZ::SetTrusted() {
+void BluetoothDeviceChromeOS::SetTrusted() {
// Unconditionally send the property change, rather than checking the value
// first; there's no harm in doing this and it solves any race conditions
// with the property becoming true or false and this call happening before
@@ -696,37 +699,36 @@ void BluetoothDeviceBlueZ::SetTrusted() {
bluez::BluezDBusManager::Get()
->GetBluetoothDeviceClient()
->GetProperties(object_path_)
- ->trusted.Set(true, base::Bind(&BluetoothDeviceBlueZ::OnSetTrusted,
+ ->trusted.Set(true, base::Bind(&BluetoothDeviceChromeOS::OnSetTrusted,
weak_ptr_factory_.GetWeakPtr()));
}
-void BluetoothDeviceBlueZ::OnSetTrusted(bool success) {
+void BluetoothDeviceChromeOS::OnSetTrusted(bool success) {
LOG_IF(WARNING, !success) << object_path_.value()
<< ": Failed to set device as trusted";
}
-void BluetoothDeviceBlueZ::OnDisconnect(const base::Closure& callback) {
+void BluetoothDeviceChromeOS::OnDisconnect(const base::Closure& callback) {
VLOG(1) << object_path_.value() << ": Disconnected";
callback.Run();
}
-void BluetoothDeviceBlueZ::OnDisconnectError(
+void BluetoothDeviceChromeOS::OnDisconnectError(
const ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- LOG(WARNING) << object_path_.value()
- << ": Failed to disconnect device: " << error_name << ": "
- << error_message;
+ LOG(WARNING) << object_path_.value() << ": Failed to disconnect device: "
+ << error_name << ": " << error_message;
error_callback.Run();
}
-void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback,
- const std::string& error_name,
- const std::string& error_message) {
- LOG(WARNING) << object_path_.value()
- << ": Failed to remove device: " << error_name << ": "
- << error_message;
+void BluetoothDeviceChromeOS::OnForgetError(
+ const ErrorCallback& error_callback,
+ const std::string& error_name,
+ const std::string& error_message) {
+ LOG(WARNING) << object_path_.value() << ": Failed to remove device: "
+ << error_name << ": " << error_message;
error_callback.Run();
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_device_bluez.h b/device/bluetooth/bluetooth_device_chromeos.h
index 42b466b..92428ac 100644
--- a/device/bluetooth/bluetooth_device_bluez.h
+++ b/device/bluetooth/bluetooth_device_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
+#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
#include <string>
@@ -21,19 +21,19 @@ namespace device {
class BluetoothSocketThread;
} // namespace device
-namespace bluez {
+namespace chromeos {
-class BluetoothAdapterBlueZ;
-class BluetoothPairingBlueZ;
+class BluetoothAdapterChromeOS;
+class BluetoothPairingChromeOS;
-// The BluetoothDeviceBlueZ class implements BluetoothDevice for the
+// The BluetoothDeviceChromeOS class implements BluetoothDevice for the
// Chrome OS platform.
//
// This class is not thread-safe, but is only called from the UI thread.
//
// A socket thread is used to create sockets but posts all callbacks on the UI
// thread.
-class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
+class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS
: public device::BluetoothDevice,
public bluez::BluetoothGattServiceClient::Observer {
public:
@@ -55,7 +55,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
bool ExpectingPinCode() const override;
bool ExpectingPasskey() const override;
bool ExpectingConfirmation() const override;
- void GetConnectionInfo(const ConnectionInfoCallback& callback) override;
+ void GetConnectionInfo(
+ const ConnectionInfoCallback& callback) override;
void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate,
const base::Closure& callback,
const ConnectErrorCallback& error_callback) override;
@@ -82,7 +83,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
// Creates a pairing object with the given delegate |pairing_delegate| and
// establishes it as the pairing context for this device. All pairing-related
// method calls will be forwarded to this object until it is released.
- BluetoothPairingBlueZ* BeginPairing(
+ BluetoothPairingChromeOS* BeginPairing(
BluetoothDevice::PairingDelegate* pairing_delegate);
// Releases the current pairing object, any pairing-related method calls will
@@ -90,13 +91,13 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
void EndPairing();
// Returns the current pairing object or NULL if no pairing is in progress.
- BluetoothPairingBlueZ* GetPairing() const;
+ BluetoothPairingChromeOS* GetPairing() const;
// Returns the object path of the device.
const dbus::ObjectPath& object_path() const { return object_path_; }
// Returns the adapter which owns this device instance.
- BluetoothAdapterBlueZ* adapter() const;
+ BluetoothAdapterChromeOS* adapter() const;
protected:
// BluetoothDevice override
@@ -105,14 +106,14 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
void DisconnectGatt() override;
private:
- friend class BluetoothAdapterBlueZ;
+ friend class BluetoothAdapterChromeOS;
- BluetoothDeviceBlueZ(
- BluetoothAdapterBlueZ* adapter,
+ BluetoothDeviceChromeOS(
+ BluetoothAdapterChromeOS* adapter,
const dbus::ObjectPath& object_path,
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<device::BluetoothSocketThread> socket_thread);
- ~BluetoothDeviceBlueZ() override;
+ ~BluetoothDeviceChromeOS() override;
// bluez::BluetoothGattServiceClient::Observer overrides.
void GattServiceAdded(const dbus::ObjectPath& object_path) override;
@@ -133,7 +134,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
void ConnectInternal(bool after_pairing,
const base::Closure& callback,
const ConnectErrorCallback& error_callback);
- void OnConnect(bool after_pairing, const base::Closure& callback);
+ void OnConnect(bool after_pairing,
+ const base::Closure& callback);
void OnCreateGattConnection(const GattConnectionCallback& callback);
void OnConnectError(bool after_pairing,
const ConnectErrorCallback& error_callback,
@@ -191,15 +193,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
// During pairing this is set to an object that we don't own, but on which
// we can make method calls to request, display or confirm PIN Codes and
// Passkeys. Generally it is the object that owns this one.
- scoped_ptr<BluetoothPairingBlueZ> pairing_;
+ scoped_ptr<BluetoothPairingChromeOS> pairing_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
diff --git a/device/bluetooth/bluetooth_discovery_session_outcome.h b/device/bluetooth/bluetooth_discovery_session_outcome.h
index 9bc83a3..38cf3a1 100644
--- a/device/bluetooth/bluetooth_discovery_session_outcome.h
+++ b/device/bluetooth/bluetooth_discovery_session_outcome.h
@@ -23,12 +23,12 @@ enum class UMABluetoothDiscoverySessionOutcome {
ACTIVE_SESSION_NOT_IN_ADAPTER = 7,
FAILED = 8,
- // BlueZ-specific failures:
- BLUEZ_DBUS_UNKNOWN_ADAPTER = 9,
- BLUEZ_DBUS_NO_RESPONSE = 10,
- BLUEZ_DBUS_IN_PROGRESS = 11,
- BLUEZ_DBUS_NOT_READY = 12,
- BLUEZ_DBUS_FAILED_MAYBE_UNSUPPORTED_TRANSPORT = 13,
+ // ChromeOS-specific failures:
+ CHROMEOS_DBUS_UNKNOWN_ADAPTER = 9,
+ CHROMEOS_DBUS_NO_RESPONSE = 10,
+ CHROMEOS_DBUS_IN_PROGRESS = 11,
+ CHROMEOS_DBUS_NOT_READY = 12,
+ CHROMEOS_DBUS_FAILED_MAYBE_UNSUPPORTED_TRANSPORT = 13,
// NOTE: Add new outcomes immediately above this line. Make sure to update the
// enum list in tools/metrics/histograms/histograms.xml accordingly.
COUNT
diff --git a/device/bluetooth/bluetooth_gatt_bluez_unittest.cc b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
index fdc9253..cc5860d 100644
--- a/device/bluetooth/bluetooth_gatt_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
@@ -36,7 +36,7 @@ using device::BluetoothGattNotifySession;
using device::BluetoothUUID;
using device::TestBluetoothAdapterObserver;
-namespace bluez {
+namespace chromeos {
namespace {
@@ -61,12 +61,13 @@ bool ValuesEqual(const std::vector<uint8>& value0,
} // namespace
-class BluetoothGattBlueZTest : public testing::Test {
+class BluetoothGattChromeOSTest : public testing::Test {
public:
- BluetoothGattBlueZTest()
+ BluetoothGattChromeOSTest()
: fake_bluetooth_gatt_service_client_(NULL),
success_callback_count_(0),
- error_callback_count_(0) {}
+ error_callback_count_(0) {
+ }
void SetUp() override {
scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
@@ -102,8 +103,10 @@ class BluetoothGattBlueZTest : public testing::Test {
GetAdapter();
- adapter_->SetPowered(true, base::Bind(&base::DoNothing),
- base::Bind(&base::DoNothing));
+ adapter_->SetPowered(
+ true,
+ base::Bind(&base::DoNothing),
+ base::Bind(&base::DoNothing));
ASSERT_TRUE(adapter_->IsPowered());
}
@@ -115,8 +118,9 @@ class BluetoothGattBlueZTest : public testing::Test {
}
void GetAdapter() {
- device::BluetoothAdapterFactory::GetAdapter(base::Bind(
- &BluetoothGattBlueZTest::AdapterCallback, base::Unretained(this)));
+ device::BluetoothAdapterFactory::GetAdapter(
+ base::Bind(&BluetoothGattChromeOSTest::AdapterCallback,
+ base::Unretained(this)));
ASSERT_TRUE(adapter_.get() != NULL);
ASSERT_TRUE(adapter_->IsInitialized());
ASSERT_TRUE(adapter_->IsPresent());
@@ -126,7 +130,9 @@ class BluetoothGattBlueZTest : public testing::Test {
adapter_ = adapter;
}
- void SuccessCallback() { ++success_callback_count_; }
+ void SuccessCallback() {
+ ++success_callback_count_;
+ }
void ValueCallback(const std::vector<uint8>& value) {
++success_callback_count_;
@@ -149,7 +155,9 @@ class BluetoothGattBlueZTest : public testing::Test {
last_service_error_ = err;
}
- void ErrorCallback() { ++error_callback_count_; }
+ void ErrorCallback() {
+ ++error_callback_count_;
+ }
void DBusErrorCallback(const std::string& error_name,
const std::string& error_message) {
@@ -185,7 +193,7 @@ class BluetoothGattBlueZTest : public testing::Test {
BluetoothGattService::GattErrorCode last_service_error_;
};
-TEST_F(BluetoothGattBlueZTest, GattConnection) {
+TEST_F(BluetoothGattChromeOSTest, GattConnection) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -198,9 +206,9 @@ TEST_F(BluetoothGattBlueZTest, GattConnection) {
ASSERT_EQ(0, error_callback_count_);
device->CreateGattConnection(
- base::Bind(&BluetoothGattBlueZTest::GattConnectionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::GattConnectionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
@@ -216,9 +224,9 @@ TEST_F(BluetoothGattBlueZTest, GattConnection) {
EXPECT_FALSE(gatt_conn_->IsConnected());
device->CreateGattConnection(
- base::Bind(&BluetoothGattBlueZTest::GattConnectionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::GattConnectionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(2, success_callback_count_);
@@ -227,10 +235,11 @@ TEST_F(BluetoothGattBlueZTest, GattConnection) {
ASSERT_TRUE(gatt_conn_.get());
EXPECT_TRUE(gatt_conn_->IsConnected());
- device->Disconnect(base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ErrorCallback,
- base::Unretained(this)));
+ device->Disconnect(
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -238,9 +247,9 @@ TEST_F(BluetoothGattBlueZTest, GattConnection) {
EXPECT_FALSE(gatt_conn_->IsConnected());
device->CreateGattConnection(
- base::Bind(&BluetoothGattBlueZTest::GattConnectionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::GattConnectionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ConnectErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
EXPECT_EQ(4, success_callback_count_);
@@ -255,7 +264,7 @@ TEST_F(BluetoothGattBlueZTest, GattConnection) {
EXPECT_FALSE(gatt_conn_->IsConnected());
}
-TEST_F(BluetoothGattBlueZTest, GattServiceAddedAndRemoved) {
+TEST_F(BluetoothGattChromeOSTest, GattServiceAddedAndRemoved) {
// Create a fake LE device. We store the device pointer here because this is a
// test. It's unsafe to do this in production as the device might get deleted.
fake_bluetooth_device_client_->CreateDevice(
@@ -348,7 +357,7 @@ TEST_F(BluetoothGattBlueZTest, GattServiceAddedAndRemoved) {
bluez::FakeBluetoothDeviceClient::kLowEnergyAddress));
}
-TEST_F(BluetoothGattBlueZTest, GattCharacteristicAddedAndRemoved) {
+TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -416,7 +425,7 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicAddedAndRemoved) {
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
}
-TEST_F(BluetoothGattBlueZTest, GattDescriptorAddedAndRemoved) {
+TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -452,20 +461,20 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorAddedAndRemoved) {
EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count());
BluetoothGattCharacteristic* characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value());
ASSERT_TRUE(characteristic);
EXPECT_TRUE(characteristic->GetDescriptors().empty());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateControlPointPath().value());
ASSERT_TRUE(characteristic);
EXPECT_TRUE(characteristic->GetDescriptors().empty());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateMeasurementPath().value());
ASSERT_TRUE(characteristic);
EXPECT_EQ(1U, characteristic->GetDescriptors().size());
@@ -506,7 +515,7 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorAddedAndRemoved) {
EXPECT_EQ(descriptor->GetIdentifier(), observer.last_gatt_descriptor_id());
}
-TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) {
+TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) {
// This unit test tests that all remote GATT objects are created for D-Bus
// objects that were already exposed.
adapter_ = NULL;
@@ -543,8 +552,8 @@ TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) {
EXPECT_EQ(3U, service->GetCharacteristics().size());
BluetoothGattCharacteristic* characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value());
ASSERT_TRUE(characteristic);
EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
kBodySensorLocationUUID),
@@ -553,8 +562,8 @@ TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) {
EXPECT_TRUE(characteristic->GetDescriptors().empty());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateControlPointPath().value());
ASSERT_TRUE(characteristic);
EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
kHeartRateControlPointUUID),
@@ -563,8 +572,8 @@ TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) {
EXPECT_TRUE(characteristic->GetDescriptors().empty());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateMeasurementPath().value());
ASSERT_TRUE(characteristic);
EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
kHeartRateMeasurementUUID),
@@ -579,7 +588,7 @@ TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) {
EXPECT_FALSE(descriptor->IsLocal());
}
-TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
+TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -608,20 +617,20 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
std::vector<uint8> write_value;
write_value.push_back(0x01);
- BluetoothGattCharacteristic* characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath()
- .value());
+ BluetoothGattCharacteristic* characteristic =
+ service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateMeasurementPath().value());
ASSERT_TRUE(characteristic);
EXPECT_FALSE(characteristic->IsNotifying());
- EXPECT_EQ(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath()
- .value(),
- characteristic->GetIdentifier());
+ EXPECT_EQ(fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateMeasurementPath().value(),
+ characteristic->GetIdentifier());
EXPECT_EQ(kHeartRateMeasurementUUID, characteristic->GetUUID());
characteristic->WriteRemoteCharacteristic(
- write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ write_value,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_TRUE(observer.last_gatt_characteristic_id().empty());
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
@@ -632,18 +641,18 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value());
ASSERT_TRUE(characteristic);
- EXPECT_EQ(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value(),
- characteristic->GetIdentifier());
+ EXPECT_EQ(fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value(),
+ characteristic->GetIdentifier());
EXPECT_EQ(kBodySensorLocationUUID, characteristic->GetUUID());
characteristic->WriteRemoteCharacteristic(
- write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ write_value,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_TRUE(observer.last_gatt_characteristic_id().empty());
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
@@ -658,18 +667,18 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// in a CharacteristicValueChanged event, thus no such event should be
// received.
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateControlPointPath().value());
ASSERT_TRUE(characteristic);
- EXPECT_EQ(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath()
- .value(),
- characteristic->GetIdentifier());
+ EXPECT_EQ(fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateControlPointPath().value(),
+ characteristic->GetIdentifier());
EXPECT_EQ(kHeartRateControlPointUUID, characteristic->GetUUID());
characteristic->WriteRemoteCharacteristic(
- write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ write_value,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_TRUE(observer.last_gatt_characteristic_id().empty());
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
@@ -684,9 +693,10 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
invalid_write_length.push_back(0x01);
invalid_write_length.push_back(0x00);
characteristic->WriteRemoteCharacteristic(
- invalid_write_length, base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ invalid_write_length,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(3, error_callback_count_);
@@ -697,9 +707,10 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
std::vector<uint8> invalid_write_value;
invalid_write_value.push_back(0x02);
characteristic->WriteRemoteCharacteristic(
- invalid_write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ invalid_write_value,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
@@ -709,18 +720,17 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// Issue a read request. A successful read results in a
// CharacteristicValueChanged notification.
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value());
ASSERT_TRUE(characteristic);
- EXPECT_EQ(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value(),
- characteristic->GetIdentifier());
+ EXPECT_EQ(fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value(),
+ characteristic->GetIdentifier());
EXPECT_EQ(kBodySensorLocationUUID, characteristic->GetUUID());
characteristic->ReadRemoteCharacteristic(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(2, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
@@ -739,9 +749,9 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
characteristic->GetIdentifier());
EXPECT_EQ(kBodySensorLocationUUID, characteristic->GetUUID());
characteristic->ReadRemoteCharacteristic(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
// Callback counts shouldn't change, this one will be delayed until after
@@ -752,9 +762,9 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// Next read should error because IN_PROGRESS
characteristic->ReadRemoteCharacteristic(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(5, error_callback_count_);
EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, last_service_error_);
@@ -768,9 +778,9 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// Test unauthorized actions.
fake_bluetooth_gatt_characteristic_client_->SetAuthorized(false);
characteristic->ReadRemoteCharacteristic(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(6, error_callback_count_);
@@ -782,9 +792,9 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// Test unauthenticated / needs login.
fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(false);
characteristic->ReadRemoteCharacteristic(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(3, success_callback_count_);
EXPECT_EQ(7, error_callback_count_);
@@ -793,7 +803,7 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(true);
}
-TEST_F(BluetoothGattBlueZTest, GattCharacteristicProperties) {
+TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -816,26 +826,26 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicProperties) {
// Run the message loop so that the characteristics appear.
base::MessageLoop::current()->Run();
- BluetoothGattCharacteristic* characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
- .value());
+ BluetoothGattCharacteristic *characteristic = service->GetCharacteristic(
+ fake_bluetooth_gatt_characteristic_client_->
+ GetBodySensorLocationPath().value());
EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_READ,
characteristic->GetProperties());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateControlPointPath().value());
EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_WRITE,
characteristic->GetProperties());
characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateMeasurementPath().value());
EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_NOTIFY,
characteristic->GetProperties());
}
-TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
+TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -866,8 +876,8 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
// Only the Heart Rate Measurement characteristic has a descriptor.
BluetoothGattCharacteristic* characteristic = service->GetCharacteristic(
- fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath()
- .value());
+ fake_bluetooth_gatt_characteristic_client_->
+ GetHeartRateMeasurementPath().value());
ASSERT_TRUE(characteristic);
EXPECT_EQ(1U, characteristic->GetDescriptors().size());
EXPECT_FALSE(characteristic->IsNotifying());
@@ -890,9 +900,9 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
// Read value. GattDescriptorValueChanged event will be sent after a
// successful read.
descriptor->ReadRemoteDescriptor(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -904,9 +914,10 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
// Write value. Writes to this descriptor will fail.
desc_value[0] = 0x03;
descriptor->WriteRemoteDescriptor(
- desc_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ desc_value,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(1, error_callback_count_);
@@ -919,9 +930,9 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
// Read value. The value should remain unchanged.
descriptor->ReadRemoteDescriptor(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(2, success_callback_count_);
EXPECT_EQ(1, error_callback_count_);
@@ -933,9 +944,9 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
// Start notifications on the descriptor's characteristic. The descriptor
// value should change.
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
base::MessageLoop::current()->Run();
EXPECT_EQ(3, success_callback_count_);
@@ -945,9 +956,9 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
// Read the new descriptor value. We should receive a value updated event.
descriptor->ReadRemoteDescriptor(
- base::Bind(&BluetoothGattBlueZTest::ValueCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ValueCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(4, success_callback_count_);
EXPECT_EQ(1, error_callback_count_);
@@ -957,7 +968,7 @@ TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) {
EXPECT_EQ(2, observer.gatt_descriptor_value_changed_count());
}
-TEST_F(BluetoothGattBlueZTest, NotifySessions) {
+TEST_F(BluetoothGattChromeOSTest, NotifySessions) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -990,9 +1001,9 @@ TEST_F(BluetoothGattBlueZTest, NotifySessions) {
// Request to start notifications.
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
// The operation still hasn't completed but we should have received the first
@@ -1004,14 +1015,14 @@ TEST_F(BluetoothGattBlueZTest, NotifySessions) {
// Send a two more requests, which should get queued.
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1036,7 +1047,7 @@ TEST_F(BluetoothGattBlueZTest, NotifySessions) {
// characteristic should still be notifying.
BluetoothGattNotifySession* session = update_sessions_[0];
EXPECT_TRUE(session->IsActive());
- session->Stop(base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
+ session->Stop(base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
base::Unretained(this)));
EXPECT_EQ(4, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1062,9 +1073,9 @@ TEST_F(BluetoothGattBlueZTest, NotifySessions) {
// Enable notifications again.
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1088,9 +1099,9 @@ TEST_F(BluetoothGattBlueZTest, NotifySessions) {
// Request another session. This should return immediately.
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(2, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1106,7 +1117,7 @@ TEST_F(BluetoothGattBlueZTest, NotifySessions) {
EXPECT_FALSE(update_sessions_[1]->IsActive());
}
-TEST_F(BluetoothGattBlueZTest, NotifySessionsMadeInactive) {
+TEST_F(BluetoothGattChromeOSTest, NotifySessionsMadeInactive) {
fake_bluetooth_device_client_->CreateDevice(
dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
@@ -1139,24 +1150,24 @@ TEST_F(BluetoothGattBlueZTest, NotifySessionsMadeInactive) {
// Send several requests to start notifications.
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
// The operation still hasn't completed but we should have received the first
@@ -1184,9 +1195,9 @@ TEST_F(BluetoothGattBlueZTest, NotifySessionsMadeInactive) {
// marked as inactive.
fake_bluetooth_gatt_characteristic_client_->StopNotify(
fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath(),
- base::Bind(&BluetoothGattBlueZTest::SuccessCallback,
+ base::Bind(&BluetoothGattChromeOSTest::SuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::DBusErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
EXPECT_EQ(5, success_callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1202,9 +1213,9 @@ TEST_F(BluetoothGattBlueZTest, NotifySessionsMadeInactive) {
success_callback_count_ = 0;
observer.Reset();
characteristic->StartNotifySession(
- base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback,
+ base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback,
base::Unretained(this)),
- base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback,
+ base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback,
base::Unretained(this)));
EXPECT_EQ(0, success_callback_count_);
@@ -1223,4 +1234,4 @@ TEST_F(BluetoothGattBlueZTest, NotifySessionsMadeInactive) {
EXPECT_TRUE(update_sessions_[0]->IsActive());
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_gatt_connection_bluez.cc b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
index 98b6a46..57aaa4d 100644
--- a/device/bluetooth/bluetooth_gatt_connection_bluez.cc
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_gatt_connection_bluez.h"
+#include "device/bluetooth/bluetooth_gatt_connection_chromeos.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -10,9 +10,9 @@
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-namespace bluez {
+namespace chromeos {
-BluetoothGattConnectionBlueZ::BluetoothGattConnectionBlueZ(
+BluetoothGattConnectionChromeOS::BluetoothGattConnectionChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter,
const std::string& device_address,
const dbus::ObjectPath& object_path)
@@ -26,13 +26,13 @@ BluetoothGattConnectionBlueZ::BluetoothGattConnectionBlueZ(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
}
-BluetoothGattConnectionBlueZ::~BluetoothGattConnectionBlueZ() {
+BluetoothGattConnectionChromeOS::~BluetoothGattConnectionChromeOS() {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
this);
Disconnect();
}
-bool BluetoothGattConnectionBlueZ::IsConnected() {
+bool BluetoothGattConnectionChromeOS::IsConnected() {
// Lazily determine the activity state of the connection. If already
// marked as inactive, then return false. Otherwise, explicitly mark
// |connected_| as false if the device is removed or disconnected. We do this,
@@ -50,7 +50,7 @@ bool BluetoothGattConnectionBlueZ::IsConnected() {
return connected_;
}
-void BluetoothGattConnectionBlueZ::Disconnect() {
+void BluetoothGattConnectionChromeOS::Disconnect() {
if (!connected_) {
VLOG(1) << "Connection already inactive.";
return;
@@ -66,7 +66,7 @@ void BluetoothGattConnectionBlueZ::Disconnect() {
connected_ = false;
}
-void BluetoothGattConnectionBlueZ::DeviceRemoved(
+void BluetoothGattConnectionChromeOS::DeviceRemoved(
const dbus::ObjectPath& object_path) {
if (object_path != object_path_)
return;
@@ -74,7 +74,7 @@ void BluetoothGattConnectionBlueZ::DeviceRemoved(
connected_ = false;
}
-void BluetoothGattConnectionBlueZ::DevicePropertyChanged(
+void BluetoothGattConnectionChromeOS::DevicePropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
if (object_path != object_path_)
@@ -102,4 +102,4 @@ void BluetoothGattConnectionBlueZ::DevicePropertyChanged(
device_address_ = properties->address.value();
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_gatt_connection_bluez.h b/device/bluetooth/bluetooth_gatt_connection_chromeos.h
index bca25f1..6e40283 100644
--- a/device/bluetooth/bluetooth_gatt_connection_bluez.h
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_CHROMEOS_H_
#include <string>
@@ -19,19 +19,19 @@ class BluetoothAdapter;
} // namespace device
-namespace bluez {
+namespace chromeos {
-// BluetoothGattConnectionBlueZ implements BluetoothGattConnection for the
+// BluetoothGattConnectionChromeOS implements BluetoothGattConnection for the
// Chrome OS platform.
-class BluetoothGattConnectionBlueZ
+class BluetoothGattConnectionChromeOS
: public device::BluetoothGattConnection,
public bluez::BluetoothDeviceClient::Observer {
public:
- explicit BluetoothGattConnectionBlueZ(
+ explicit BluetoothGattConnectionChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter,
const std::string& device_address,
const dbus::ObjectPath& object_path);
- ~BluetoothGattConnectionBlueZ() override;
+ ~BluetoothGattConnectionChromeOS() override;
// BluetoothGattConnection overrides.
bool IsConnected() override;
@@ -50,9 +50,9 @@ class BluetoothGattConnectionBlueZ
// events.
dbus::ObjectPath object_path_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattConnectionBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothGattConnectionChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_gatt_notify_session_bluez.cc b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
index 7e1cfed..02f7ed8 100644
--- a/device/bluetooth/bluetooth_gatt_notify_session_bluez.cc
+++ b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_gatt_notify_session_bluez.h"
+#include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h"
#include "base/bind.h"
#include "base/logging.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_gatt_service.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-namespace bluez {
+namespace chromeos {
-BluetoothGattNotifySessionBlueZ::BluetoothGattNotifySessionBlueZ(
+BluetoothGattNotifySessionChromeOS::BluetoothGattNotifySessionChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter,
const std::string& device_address,
const std::string& service_identifier,
@@ -37,19 +37,19 @@ BluetoothGattNotifySessionBlueZ::BluetoothGattNotifySessionBlueZ(
->AddObserver(this);
}
-BluetoothGattNotifySessionBlueZ::~BluetoothGattNotifySessionBlueZ() {
+BluetoothGattNotifySessionChromeOS::~BluetoothGattNotifySessionChromeOS() {
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
->RemoveObserver(this);
Stop(base::Bind(&base::DoNothing));
}
-std::string BluetoothGattNotifySessionBlueZ::GetCharacteristicIdentifier()
+std::string BluetoothGattNotifySessionChromeOS::GetCharacteristicIdentifier()
const {
return characteristic_id_;
}
-bool BluetoothGattNotifySessionBlueZ::IsActive() {
+bool BluetoothGattNotifySessionChromeOS::IsActive() {
// Determine if the session is active. If |active_| is false, then it's
// been explicitly marked, so return false.
if (!active_)
@@ -73,7 +73,7 @@ bool BluetoothGattNotifySessionBlueZ::IsActive() {
return active_;
}
-void BluetoothGattNotifySessionBlueZ::Stop(const base::Closure& callback) {
+void BluetoothGattNotifySessionChromeOS::Stop(const base::Closure& callback) {
if (!active_) {
VLOG(1) << "Notify session already inactive.";
callback.Run();
@@ -91,8 +91,8 @@ void BluetoothGattNotifySessionBlueZ::Stop(const base::Closure& callback) {
if (!service)
return;
- BluetoothRemoteGattCharacteristicBlueZ* chrc =
- static_cast<BluetoothRemoteGattCharacteristicBlueZ*>(
+ BluetoothRemoteGattCharacteristicChromeOS* chrc =
+ static_cast<BluetoothRemoteGattCharacteristicChromeOS*>(
service->GetCharacteristic(characteristic_id_));
if (!chrc)
return;
@@ -100,7 +100,7 @@ void BluetoothGattNotifySessionBlueZ::Stop(const base::Closure& callback) {
chrc->RemoveNotifySession(callback);
}
-void BluetoothGattNotifySessionBlueZ::GattCharacteristicRemoved(
+void BluetoothGattNotifySessionChromeOS::GattCharacteristicRemoved(
const dbus::ObjectPath& object_path) {
if (object_path != object_path_)
return;
@@ -108,7 +108,7 @@ void BluetoothGattNotifySessionBlueZ::GattCharacteristicRemoved(
active_ = false;
}
-void BluetoothGattNotifySessionBlueZ::GattCharacteristicPropertyChanged(
+void BluetoothGattNotifySessionChromeOS::GattCharacteristicPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
if (object_path != object_path_)
@@ -131,4 +131,4 @@ void BluetoothGattNotifySessionBlueZ::GattCharacteristicPropertyChanged(
active_ = false;
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_gatt_notify_session_bluez.h b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
index 6f0ea51..ef6e8da 100644
--- a/device/bluetooth/bluetooth_gatt_notify_session_bluez.h
+++ b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_CHROMEOS_H_
#include <string>
@@ -17,17 +17,17 @@ class BluetoothAdapter;
} // namespace device
-namespace bluez {
+namespace chromeos {
-class BluetoothRemoteGattCharacteristicBlueZ;
+class BluetoothRemoteGattCharacteristicChromeOS;
-// BluetoothGattNotifySessionBlueZ implements
+// BluetoothGattNotifySessionChromeOS implements
// BluetoothGattNotifySession for the Chrome OS platform.
-class BluetoothGattNotifySessionBlueZ
+class BluetoothGattNotifySessionChromeOS
: public device::BluetoothGattNotifySession,
public bluez::BluetoothGattCharacteristicClient::Observer {
public:
- ~BluetoothGattNotifySessionBlueZ() override;
+ ~BluetoothGattNotifySessionChromeOS() override;
// BluetoothGattNotifySession overrides.
std::string GetCharacteristicIdentifier() const override;
@@ -35,9 +35,9 @@ class BluetoothGattNotifySessionBlueZ
void Stop(const base::Closure& callback) override;
private:
- friend class BluetoothRemoteGattCharacteristicBlueZ;
+ friend class BluetoothRemoteGattCharacteristicChromeOS;
- explicit BluetoothGattNotifySessionBlueZ(
+ explicit BluetoothGattNotifySessionChromeOS(
scoped_refptr<device::BluetoothAdapter> adapter,
const std::string& device_address,
const std::string& service_identifier,
@@ -69,9 +69,9 @@ class BluetoothGattNotifySessionBlueZ
// observer events.
dbus::ObjectPath object_path_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySessionBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySessionChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_pairing_bluez.cc b/device/bluetooth/bluetooth_pairing_chromeos.cc
index a798694..c69bc94 100644
--- a/device/bluetooth/bluetooth_pairing_bluez.cc
+++ b/device/bluetooth/bluetooth_pairing_chromeos.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_pairing_bluez.h"
+#include "device/bluetooth/bluetooth_pairing_chromeos.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/bluetooth_device_bluez.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
using device::BluetoothDevice;
@@ -32,19 +32,21 @@ const uint16 kPasskeyMaxKeysEntered = 7;
} // namespace
-namespace bluez {
+namespace chromeos {
-BluetoothPairingBlueZ::BluetoothPairingBlueZ(
- BluetoothDeviceBlueZ* device,
+BluetoothPairingChromeOS::BluetoothPairingChromeOS(
+ BluetoothDeviceChromeOS* device,
BluetoothDevice::PairingDelegate* pairing_delegate)
: device_(device),
pairing_delegate_(pairing_delegate),
pairing_delegate_used_(false) {
- VLOG(1) << "Created BluetoothPairingBlueZ for " << device_->GetAddress();
+ VLOG(1) << "Created BluetoothPairingChromeOS for "
+ << device_->GetAddress();
}
-BluetoothPairingBlueZ::~BluetoothPairingBlueZ() {
- VLOG(1) << "Destroying BluetoothPairingBlueZ for " << device_->GetAddress();
+BluetoothPairingChromeOS::~BluetoothPairingChromeOS() {
+ VLOG(1) << "Destroying BluetoothPairingChromeOS for "
+ << device_->GetAddress();
if (!pairing_delegate_used_) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
@@ -70,7 +72,7 @@ BluetoothPairingBlueZ::~BluetoothPairingBlueZ() {
pairing_delegate_ = NULL;
}
-void BluetoothPairingBlueZ::RequestPinCode(
+void BluetoothPairingChromeOS::RequestPinCode(
const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback&
callback) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
@@ -83,11 +85,11 @@ void BluetoothPairingBlueZ::RequestPinCode(
pairing_delegate_->RequestPinCode(device_);
}
-bool BluetoothPairingBlueZ::ExpectingPinCode() const {
+bool BluetoothPairingChromeOS::ExpectingPinCode() const {
return !pincode_callback_.is_null();
}
-void BluetoothPairingBlueZ::SetPinCode(const std::string& pincode) {
+void BluetoothPairingChromeOS::SetPinCode(const std::string& pincode) {
if (pincode_callback_.is_null())
return;
@@ -102,7 +104,7 @@ void BluetoothPairingBlueZ::SetPinCode(const std::string& pincode) {
device_->EndPairing();
}
-void BluetoothPairingBlueZ::DisplayPinCode(const std::string& pincode) {
+void BluetoothPairingChromeOS::DisplayPinCode(const std::string& pincode) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
UMA_PAIRING_METHOD_DISPLAY_PINCODE,
UMA_PAIRING_METHOD_COUNT);
@@ -118,7 +120,7 @@ void BluetoothPairingBlueZ::DisplayPinCode(const std::string& pincode) {
device_->EndPairing();
}
-void BluetoothPairingBlueZ::RequestPasskey(
+void BluetoothPairingChromeOS::RequestPasskey(
const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback&
callback) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
@@ -131,11 +133,11 @@ void BluetoothPairingBlueZ::RequestPasskey(
pairing_delegate_->RequestPasskey(device_);
}
-bool BluetoothPairingBlueZ::ExpectingPasskey() const {
+bool BluetoothPairingChromeOS::ExpectingPasskey() const {
return !passkey_callback_.is_null();
}
-void BluetoothPairingBlueZ::SetPasskey(uint32 passkey) {
+void BluetoothPairingChromeOS::SetPasskey(uint32 passkey) {
if (passkey_callback_.is_null())
return;
@@ -150,7 +152,7 @@ void BluetoothPairingBlueZ::SetPasskey(uint32 passkey) {
device_->EndPairing();
}
-void BluetoothPairingBlueZ::DisplayPasskey(uint32 passkey) {
+void BluetoothPairingChromeOS::DisplayPasskey(uint32 passkey) {
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
UMA_PAIRING_METHOD_DISPLAY_PASSKEY,
UMA_PAIRING_METHOD_COUNT);
@@ -158,9 +160,10 @@ void BluetoothPairingBlueZ::DisplayPasskey(uint32 passkey) {
ResetCallbacks();
pairing_delegate_used_ = true;
pairing_delegate_->DisplayPasskey(device_, passkey);
+
}
-void BluetoothPairingBlueZ::KeysEntered(uint16 entered) {
+void BluetoothPairingChromeOS::KeysEntered(uint16 entered) {
pairing_delegate_used_ = true;
pairing_delegate_->KeysEntered(device_, entered);
@@ -171,7 +174,7 @@ void BluetoothPairingBlueZ::KeysEntered(uint16 entered) {
device_->EndPairing();
}
-void BluetoothPairingBlueZ::RequestConfirmation(
+void BluetoothPairingChromeOS::RequestConfirmation(
uint32 passkey,
const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
callback) {
@@ -185,10 +188,11 @@ void BluetoothPairingBlueZ::RequestConfirmation(
pairing_delegate_->ConfirmPasskey(device_, passkey);
}
-void BluetoothPairingBlueZ::RequestAuthorization(
+void BluetoothPairingChromeOS::RequestAuthorization(
const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
callback) {
- UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod", UMA_PAIRING_METHOD_NONE,
+ UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
+ UMA_PAIRING_METHOD_NONE,
UMA_PAIRING_METHOD_COUNT);
ResetCallbacks();
@@ -197,11 +201,11 @@ void BluetoothPairingBlueZ::RequestAuthorization(
pairing_delegate_->AuthorizePairing(device_);
}
-bool BluetoothPairingBlueZ::ExpectingConfirmation() const {
+bool BluetoothPairingChromeOS::ExpectingConfirmation() const {
return !confirmation_callback_.is_null();
}
-void BluetoothPairingBlueZ::ConfirmPairing() {
+void BluetoothPairingChromeOS::ConfirmPairing() {
if (confirmation_callback_.is_null())
return;
@@ -216,28 +220,28 @@ void BluetoothPairingBlueZ::ConfirmPairing() {
device_->EndPairing();
}
-bool BluetoothPairingBlueZ::RejectPairing() {
+bool BluetoothPairingChromeOS::RejectPairing() {
return RunPairingCallbacks(
bluez::BluetoothAgentServiceProvider::Delegate::REJECTED);
}
-bool BluetoothPairingBlueZ::CancelPairing() {
+bool BluetoothPairingChromeOS::CancelPairing() {
return RunPairingCallbacks(
bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED);
}
-BluetoothDevice::PairingDelegate* BluetoothPairingBlueZ::GetPairingDelegate()
- const {
+BluetoothDevice::PairingDelegate*
+BluetoothPairingChromeOS::GetPairingDelegate() const {
return pairing_delegate_;
}
-void BluetoothPairingBlueZ::ResetCallbacks() {
+void BluetoothPairingChromeOS::ResetCallbacks() {
pincode_callback_.Reset();
passkey_callback_.Reset();
confirmation_callback_.Reset();
}
-bool BluetoothPairingBlueZ::RunPairingCallbacks(
+bool BluetoothPairingChromeOS::RunPairingCallbacks(
bluez::BluetoothAgentServiceProvider::Delegate::Status status) {
pairing_delegate_used_ = true;
@@ -269,4 +273,4 @@ bool BluetoothPairingBlueZ::RunPairingCallbacks(
return callback_run;
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_pairing_bluez.h b/device/bluetooth/bluetooth_pairing_chromeos.h
index bda445f..0a4ddb6 100644
--- a/device/bluetooth/bluetooth_pairing_bluez.h
+++ b/device/bluetooth/bluetooth_pairing_chromeos.h
@@ -2,26 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
-namespace bluez {
+namespace chromeos {
-class BluetoothDeviceBlueZ;
+class BluetoothDeviceChromeOS;
-// The BluetoothPairingBlueZ class encapsulates the logic for an individual
-// device pairing, acting as a bridge between BluetoothAdapterBlueZ which
+// The BluetoothPairingChromeOS class encapsulates the logic for an individual
+// device pairing, acting as a bridge between BluetoothAdapterChromeOS which
// communicates with the underlying Controller and Host Subsystem, and
-// BluetoothDeviceBlueZ which presents the pairing logic to the application.
-class BluetoothPairingBlueZ {
+// BluetoothDeviceChromeOS which presents the pairing logic to the application.
+class BluetoothPairingChromeOS {
public:
- BluetoothPairingBlueZ(
- BluetoothDeviceBlueZ* device,
+ BluetoothPairingChromeOS(
+ BluetoothDeviceChromeOS* device,
device::BluetoothDevice::PairingDelegate* pairing_delegate);
- ~BluetoothPairingBlueZ();
+ ~BluetoothPairingChromeOS();
// Indicates whether the device is currently pairing and expecting a
// Passkey to be returned.
@@ -117,8 +117,8 @@ class BluetoothPairingBlueZ {
bool RunPairingCallbacks(
bluez::BluetoothAgentServiceProvider::Delegate::Status status);
- // The underlying BluetoothDeviceBlueZ that owns this pairing context.
- BluetoothDeviceBlueZ* device_;
+ // The underlying BluetoothDeviceChromeOS that owns this pairing context.
+ BluetoothDeviceChromeOS* device_;
// UI Pairing Delegate to make method calls on, this must live as long as
// the object capturing the PairingContext.
@@ -130,7 +130,7 @@ class BluetoothPairingBlueZ {
bool pairing_delegate_used_;
// During pairing these callbacks are set to those provided by method calls
- // made on the BluetoothAdapterBlueZ instance by its respective
+ // made on the BluetoothAdapterChromeOS instance by its respective
// bluez::BluetoothAgentServiceProvider instance, and are called by our own
// method calls such as SetPinCode() and SetPasskey().
bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback
@@ -140,9 +140,9 @@ class BluetoothPairingBlueZ {
bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback
confirmation_callback_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothPairingBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothPairingChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
index 75c6f1a..7374f16 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
#include <limits>
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/bluetooth_gatt_notify_session_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
+#include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
-namespace bluez {
+namespace chromeos {
namespace {
@@ -33,9 +33,10 @@ std::ostream& operator<<(std::ostream& out, const std::vector<uint8> bytes) {
} // namespace
-BluetoothRemoteGattCharacteristicBlueZ::BluetoothRemoteGattCharacteristicBlueZ(
- BluetoothRemoteGattServiceBlueZ* service,
- const dbus::ObjectPath& object_path)
+BluetoothRemoteGattCharacteristicChromeOS::
+ BluetoothRemoteGattCharacteristicChromeOS(
+ BluetoothRemoteGattServiceChromeOS* service,
+ const dbus::ObjectPath& object_path)
: object_path_(object_path),
service_(service),
num_notify_sessions_(0),
@@ -57,8 +58,8 @@ BluetoothRemoteGattCharacteristicBlueZ::BluetoothRemoteGattCharacteristicBlueZ(
GattDescriptorAdded(*iter);
}
-BluetoothRemoteGattCharacteristicBlueZ::
- ~BluetoothRemoteGattCharacteristicBlueZ() {
+BluetoothRemoteGattCharacteristicChromeOS::
+ ~BluetoothRemoteGattCharacteristicChromeOS() {
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
->RemoveObserver(this);
@@ -77,11 +78,12 @@ BluetoothRemoteGattCharacteristicBlueZ::
}
}
-std::string BluetoothRemoteGattCharacteristicBlueZ::GetIdentifier() const {
+std::string BluetoothRemoteGattCharacteristicChromeOS::GetIdentifier() const {
return object_path_.value();
}
-device::BluetoothUUID BluetoothRemoteGattCharacteristicBlueZ::GetUUID() const {
+device::BluetoothUUID
+BluetoothRemoteGattCharacteristicChromeOS::GetUUID() const {
bluez::BluetoothGattCharacteristicClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
@@ -90,12 +92,12 @@ device::BluetoothUUID BluetoothRemoteGattCharacteristicBlueZ::GetUUID() const {
return device::BluetoothUUID(properties->uuid.value());
}
-bool BluetoothRemoteGattCharacteristicBlueZ::IsLocal() const {
+bool BluetoothRemoteGattCharacteristicChromeOS::IsLocal() const {
return false;
}
-const std::vector<uint8>& BluetoothRemoteGattCharacteristicBlueZ::GetValue()
- const {
+const std::vector<uint8>&
+BluetoothRemoteGattCharacteristicChromeOS::GetValue() const {
bluez::BluetoothGattCharacteristicClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
@@ -107,12 +109,12 @@ const std::vector<uint8>& BluetoothRemoteGattCharacteristicBlueZ::GetValue()
}
device::BluetoothGattService*
-BluetoothRemoteGattCharacteristicBlueZ::GetService() const {
+BluetoothRemoteGattCharacteristicChromeOS::GetService() const {
return service_;
}
device::BluetoothGattCharacteristic::Properties
-BluetoothRemoteGattCharacteristicBlueZ::GetProperties() const {
+BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const {
bluez::BluetoothGattCharacteristicClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
@@ -122,7 +124,8 @@ BluetoothRemoteGattCharacteristicBlueZ::GetProperties() const {
Properties props = PROPERTY_NONE;
const std::vector<std::string>& flags = properties->flags.value();
for (std::vector<std::string>::const_iterator iter = flags.begin();
- iter != flags.end(); ++iter) {
+ iter != flags.end();
+ ++iter) {
if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast)
props |= PROPERTY_BROADCAST;
if (*iter == bluetooth_gatt_characteristic::kFlagRead)
@@ -149,13 +152,13 @@ BluetoothRemoteGattCharacteristicBlueZ::GetProperties() const {
}
device::BluetoothGattCharacteristic::Permissions
-BluetoothRemoteGattCharacteristicBlueZ::GetPermissions() const {
+BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const {
// TODO(armansito): Once BlueZ defines the permissions, return the correct
// values here.
return PERMISSION_NONE;
}
-bool BluetoothRemoteGattCharacteristicBlueZ::IsNotifying() const {
+bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const {
bluez::BluetoothGattCharacteristicClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
@@ -166,7 +169,7 @@ bool BluetoothRemoteGattCharacteristicBlueZ::IsNotifying() const {
}
std::vector<device::BluetoothGattDescriptor*>
-BluetoothRemoteGattCharacteristicBlueZ::GetDescriptors() const {
+BluetoothRemoteGattCharacteristicChromeOS::GetDescriptors() const {
std::vector<device::BluetoothGattDescriptor*> descriptors;
for (DescriptorMap::const_iterator iter = descriptors_.begin();
iter != descriptors_.end(); ++iter)
@@ -175,7 +178,7 @@ BluetoothRemoteGattCharacteristicBlueZ::GetDescriptors() const {
}
device::BluetoothGattDescriptor*
-BluetoothRemoteGattCharacteristicBlueZ::GetDescriptor(
+BluetoothRemoteGattCharacteristicChromeOS::GetDescriptor(
const std::string& identifier) const {
DescriptorMap::const_iterator iter =
descriptors_.find(dbus::ObjectPath(identifier));
@@ -184,19 +187,19 @@ BluetoothRemoteGattCharacteristicBlueZ::GetDescriptor(
return iter->second;
}
-bool BluetoothRemoteGattCharacteristicBlueZ::AddDescriptor(
+bool BluetoothRemoteGattCharacteristicChromeOS::AddDescriptor(
device::BluetoothGattDescriptor* descriptor) {
VLOG(1) << "Descriptors cannot be added to a remote GATT characteristic.";
return false;
}
-bool BluetoothRemoteGattCharacteristicBlueZ::UpdateValue(
+bool BluetoothRemoteGattCharacteristicChromeOS::UpdateValue(
const std::vector<uint8>& value) {
VLOG(1) << "Cannot update the value of a remote GATT characteristic.";
return false;
}
-void BluetoothRemoteGattCharacteristicBlueZ::ReadRemoteCharacteristic(
+void BluetoothRemoteGattCharacteristicChromeOS::ReadRemoteCharacteristic(
const ValueCallback& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "Sending GATT characteristic read request to characteristic: "
@@ -205,12 +208,13 @@ void BluetoothRemoteGattCharacteristicBlueZ::ReadRemoteCharacteristic(
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
- ->ReadValue(object_path_, callback,
- base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnError,
- weak_ptr_factory_.GetWeakPtr(), error_callback));
+ ->ReadValue(
+ object_path_, callback,
+ base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattCharacteristicBlueZ::WriteRemoteCharacteristic(
+void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic(
const std::vector<uint8>& new_value,
const base::Closure& callback,
const ErrorCallback& error_callback) {
@@ -220,12 +224,13 @@ void BluetoothRemoteGattCharacteristicBlueZ::WriteRemoteCharacteristic(
bluez::BluezDBusManager::Get()
->GetBluetoothGattCharacteristicClient()
- ->WriteValue(object_path_, new_value, callback,
- base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnError,
- weak_ptr_factory_.GetWeakPtr(), error_callback));
+ ->WriteValue(
+ object_path_, new_value, callback,
+ base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattCharacteristicBlueZ::StartNotifySession(
+void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession(
const NotifySessionCallback& callback,
const ErrorCallback& error_callback) {
VLOG(1) << __func__;
@@ -248,9 +253,12 @@ void BluetoothRemoteGattCharacteristicBlueZ::StartNotifySession(
DCHECK(service_->GetAdapter());
DCHECK(service_->GetDevice());
scoped_ptr<device::BluetoothGattNotifySession> session(
- new BluetoothGattNotifySessionBlueZ(
- service_->GetAdapter(), service_->GetDevice()->GetAddress(),
- service_->GetIdentifier(), GetIdentifier(), object_path_));
+ new BluetoothGattNotifySessionChromeOS(
+ service_->GetAdapter(),
+ service_->GetDevice()->GetAddress(),
+ service_->GetIdentifier(),
+ GetIdentifier(),
+ object_path_));
callback.Run(session.Pass());
return;
}
@@ -270,14 +278,14 @@ void BluetoothRemoteGattCharacteristicBlueZ::StartNotifySession(
->StartNotify(
object_path_,
base::Bind(
- &BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifySuccess,
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(
- &BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifyError,
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattCharacteristicBlueZ::RemoveNotifySession(
+void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession(
const base::Closure& callback) {
VLOG(1) << __func__;
@@ -308,13 +316,14 @@ void BluetoothRemoteGattCharacteristicBlueZ::RemoveNotifySession(
->StopNotify(
object_path_,
base::Bind(
- &BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifySuccess,
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess,
weak_ptr_factory_.GetWeakPtr(), callback),
- base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifyError,
- weak_ptr_factory_.GetWeakPtr(), callback));
+ base::Bind(
+ &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError,
+ weak_ptr_factory_.GetWeakPtr(), callback));
}
-void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorAdded(
+void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded(
const dbus::ObjectPath& object_path) {
if (descriptors_.find(object_path) != descriptors_.end()) {
VLOG(1) << "Remote GATT characteristic descriptor already exists: "
@@ -335,8 +344,8 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorAdded(
VLOG(1) << "Adding new remote GATT descriptor for GATT characteristic: "
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
- BluetoothRemoteGattDescriptorBlueZ* descriptor =
- new BluetoothRemoteGattDescriptorBlueZ(this, object_path);
+ BluetoothRemoteGattDescriptorChromeOS* descriptor =
+ new BluetoothRemoteGattDescriptorChromeOS(this, object_path);
descriptors_[object_path] = descriptor;
DCHECK(descriptor->GetIdentifier() == object_path.value());
DCHECK(descriptor->GetUUID().IsValid());
@@ -345,7 +354,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorAdded(
service_->NotifyDescriptorAddedOrRemoved(this, descriptor, true /* added */);
}
-void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorRemoved(
+void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorRemoved(
const dbus::ObjectPath& object_path) {
DescriptorMap::iterator iter = descriptors_.find(object_path);
if (iter == descriptors_.end()) {
@@ -356,7 +365,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorRemoved(
VLOG(1) << "Removing remote GATT descriptor from characteristic: "
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
- BluetoothRemoteGattDescriptorBlueZ* descriptor = iter->second;
+ BluetoothRemoteGattDescriptorChromeOS* descriptor = iter->second;
DCHECK(descriptor->object_path() == object_path);
descriptors_.erase(iter);
@@ -366,7 +375,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorRemoved(
delete descriptor;
}
-void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorPropertyChanged(
+void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
DescriptorMap::iterator iter = descriptors_.find(object_path);
@@ -390,17 +399,17 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorPropertyChanged(
properties->value.value());
}
-void BluetoothRemoteGattCharacteristicBlueZ::OnError(
+void BluetoothRemoteGattCharacteristicChromeOS::OnError(
const ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
- VLOG(1) << "Operation failed: " << error_name
- << ", message: " << error_message;
+ VLOG(1) << "Operation failed: " << error_name << ", message: "
+ << error_message;
error_callback.Run(
- BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(error_name));
+ BluetoothRemoteGattServiceChromeOS::DBusErrorToServiceError(error_name));
}
-void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifySuccess(
+void BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess(
const NotifySessionCallback& callback) {
VLOG(1) << "Started notifications from characteristic: "
<< object_path_.value();
@@ -414,15 +423,18 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifySuccess(
DCHECK(service_);
DCHECK(service_->GetDevice());
scoped_ptr<device::BluetoothGattNotifySession> session(
- new BluetoothGattNotifySessionBlueZ(
- service_->GetAdapter(), service_->GetDevice()->GetAddress(),
- service_->GetIdentifier(), GetIdentifier(), object_path_));
+ new BluetoothGattNotifySessionChromeOS(
+ service_->GetAdapter(),
+ service_->GetDevice()->GetAddress(),
+ service_->GetIdentifier(),
+ GetIdentifier(),
+ object_path_));
callback.Run(session.Pass());
ProcessStartNotifyQueue();
}
-void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifyError(
+void BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError(
const ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -435,12 +447,12 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifyError(
notify_call_pending_ = false;
error_callback.Run(
- BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(error_name));
+ BluetoothRemoteGattServiceChromeOS::DBusErrorToServiceError(error_name));
ProcessStartNotifyQueue();
}
-void BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifySuccess(
+void BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess(
const base::Closure& callback) {
DCHECK(notify_call_pending_);
DCHECK(num_notify_sessions_ == 1);
@@ -452,7 +464,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifySuccess(
ProcessStartNotifyQueue();
}
-void BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifyError(
+void BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError(
const base::Closure& callback,
const std::string& error_name,
const std::string& error_message) {
@@ -464,7 +476,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifyError(
OnStopNotifySuccess(callback);
}
-void BluetoothRemoteGattCharacteristicBlueZ::ProcessStartNotifyQueue() {
+void BluetoothRemoteGattCharacteristicChromeOS::ProcessStartNotifyQueue() {
while (!pending_start_notify_calls_.empty()) {
PendingStartNotifyCall callbacks = pending_start_notify_calls_.front();
pending_start_notify_calls_.pop();
@@ -472,4 +484,4 @@ void BluetoothRemoteGattCharacteristicBlueZ::ProcessStartNotifyQueue() {
}
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
index c366574..361b319 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
#include <map>
#include <queue>
@@ -24,15 +24,15 @@ class BluetoothGattService;
} // namespace device
-namespace bluez {
+namespace chromeos {
-class BluetoothRemoteGattDescriptorBlueZ;
-class BluetoothRemoteGattServiceBlueZ;
+class BluetoothRemoteGattDescriptorChromeOS;
+class BluetoothRemoteGattServiceChromeOS;
-// The BluetoothRemoteGattCharacteristicBlueZ class implements
+// The BluetoothRemoteGattCharacteristicChromeOS class implements
// BluetoothGattCharacteristic for remote GATT characteristics on the Chrome OS
// platform.
-class BluetoothRemoteGattCharacteristicBlueZ
+class BluetoothRemoteGattCharacteristicChromeOS
: public device::BluetoothGattCharacteristic,
public bluez::BluetoothGattDescriptorClient::Observer {
public:
@@ -68,15 +68,15 @@ class BluetoothRemoteGattCharacteristicBlueZ
const dbus::ObjectPath& object_path() const { return object_path_; }
private:
- friend class BluetoothRemoteGattServiceBlueZ;
+ friend class BluetoothRemoteGattServiceChromeOS;
typedef std::pair<NotifySessionCallback, ErrorCallback>
PendingStartNotifyCall;
- BluetoothRemoteGattCharacteristicBlueZ(
- BluetoothRemoteGattServiceBlueZ* service,
+ BluetoothRemoteGattCharacteristicChromeOS(
+ BluetoothRemoteGattServiceChromeOS* service,
const dbus::ObjectPath& object_path);
- ~BluetoothRemoteGattCharacteristicBlueZ() override;
+ ~BluetoothRemoteGattCharacteristicChromeOS() override;
// bluez::BluetoothGattDescriptorClient::Observer overrides.
void GattDescriptorAdded(const dbus::ObjectPath& object_path) override;
@@ -117,7 +117,7 @@ class BluetoothRemoteGattCharacteristicBlueZ
dbus::ObjectPath object_path_;
// The GATT service this GATT characteristic belongs to.
- BluetoothRemoteGattServiceBlueZ* service_;
+ BluetoothRemoteGattServiceChromeOS* service_;
// The total number of currently active value update sessions.
size_t num_notify_sessions_;
@@ -133,18 +133,18 @@ class BluetoothRemoteGattCharacteristicBlueZ
// this characteristic. Since the Chrome OS implementation uses object paths
// as unique identifiers, we also use this mapping to return descriptors by
// identifier.
- typedef std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorBlueZ*>
+ typedef std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorChromeOS*>
DescriptorMap;
DescriptorMap descriptors_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothRemoteGattCharacteristicBlueZ>
+ base::WeakPtrFactory<BluetoothRemoteGattCharacteristicChromeOS>
weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
index 4bf9ab0..f864c3b 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-namespace bluez {
+namespace chromeos {
namespace {
@@ -28,8 +28,8 @@ std::ostream& operator<<(std::ostream& out, const std::vector<uint8> bytes) {
} // namespace
-BluetoothRemoteGattDescriptorBlueZ::BluetoothRemoteGattDescriptorBlueZ(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
+BluetoothRemoteGattDescriptorChromeOS::BluetoothRemoteGattDescriptorChromeOS(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
const dbus::ObjectPath& object_path)
: object_path_(object_path),
characteristic_(characteristic),
@@ -38,13 +38,15 @@ BluetoothRemoteGattDescriptorBlueZ::BluetoothRemoteGattDescriptorBlueZ(
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
}
-BluetoothRemoteGattDescriptorBlueZ::~BluetoothRemoteGattDescriptorBlueZ() {}
+BluetoothRemoteGattDescriptorChromeOS::
+ ~BluetoothRemoteGattDescriptorChromeOS() {
+}
-std::string BluetoothRemoteGattDescriptorBlueZ::GetIdentifier() const {
+std::string BluetoothRemoteGattDescriptorChromeOS::GetIdentifier() const {
return object_path_.value();
}
-device::BluetoothUUID BluetoothRemoteGattDescriptorBlueZ::GetUUID() const {
+device::BluetoothUUID BluetoothRemoteGattDescriptorChromeOS::GetUUID() const {
bluez::BluetoothGattDescriptorClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
@@ -53,11 +55,12 @@ device::BluetoothUUID BluetoothRemoteGattDescriptorBlueZ::GetUUID() const {
return device::BluetoothUUID(properties->uuid.value());
}
-bool BluetoothRemoteGattDescriptorBlueZ::IsLocal() const {
+bool BluetoothRemoteGattDescriptorChromeOS::IsLocal() const {
return false;
}
-const std::vector<uint8>& BluetoothRemoteGattDescriptorBlueZ::GetValue() const {
+const std::vector<uint8>&
+BluetoothRemoteGattDescriptorChromeOS::GetValue() const {
bluez::BluetoothGattDescriptorClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
@@ -69,47 +72,47 @@ const std::vector<uint8>& BluetoothRemoteGattDescriptorBlueZ::GetValue() const {
}
device::BluetoothGattCharacteristic*
-BluetoothRemoteGattDescriptorBlueZ::GetCharacteristic() const {
+BluetoothRemoteGattDescriptorChromeOS::GetCharacteristic() const {
return characteristic_;
}
device::BluetoothGattCharacteristic::Permissions
-BluetoothRemoteGattDescriptorBlueZ::GetPermissions() const {
+BluetoothRemoteGattDescriptorChromeOS::GetPermissions() const {
// TODO(armansito): Once BlueZ defines the permissions, return the correct
// values here.
return device::BluetoothGattCharacteristic::PERMISSION_NONE;
}
-void BluetoothRemoteGattDescriptorBlueZ::ReadRemoteDescriptor(
+void BluetoothRemoteGattDescriptorChromeOS::ReadRemoteDescriptor(
const ValueCallback& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "Sending GATT characteristic descriptor read request to "
- << "descriptor: " << GetIdentifier()
- << ", UUID: " << GetUUID().canonical_value();
+ << "descriptor: " << GetIdentifier() << ", UUID: "
+ << GetUUID().canonical_value();
bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
object_path_, callback,
- base::Bind(&BluetoothRemoteGattDescriptorBlueZ::OnError,
+ base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattDescriptorBlueZ::WriteRemoteDescriptor(
+void BluetoothRemoteGattDescriptorChromeOS::WriteRemoteDescriptor(
const std::vector<uint8>& new_value,
const base::Closure& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "Sending GATT characteristic descriptor write request to "
- << "characteristic: " << GetIdentifier()
- << ", UUID: " << GetUUID().canonical_value()
- << ", with value: " << new_value << ".";
+ << "characteristic: " << GetIdentifier() << ", UUID: "
+ << GetUUID().canonical_value() << ", with value: "
+ << new_value << ".";
bluez::BluezDBusManager::Get()
->GetBluetoothGattDescriptorClient()
->WriteValue(object_path_, new_value, callback,
- base::Bind(&BluetoothRemoteGattDescriptorBlueZ::OnError,
+ base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothRemoteGattDescriptorBlueZ::OnError(
+void BluetoothRemoteGattDescriptorChromeOS::OnError(
const ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -117,7 +120,7 @@ void BluetoothRemoteGattDescriptorBlueZ::OnError(
<< ", message: " << error_message;
error_callback.Run(
- BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(error_name));
+ BluetoothRemoteGattServiceChromeOS::DBusErrorToServiceError(error_name));
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h
index 138bffb..b32dd87 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_
#include <string>
#include <vector>
@@ -19,14 +19,14 @@ class BluetoothGattCharacteristic;
} // namespace device
-namespace bluez {
+namespace chromeos {
-class BluetoothRemoteGattCharacteristicBlueZ;
+class BluetoothRemoteGattCharacteristicChromeOS;
-// The BluetoothRemoteGattDescriptorBlueZ class implements
+// The BluetoothRemoteGattDescriptorChromeOS class implements
// BluetoothGattDescriptor for remote GATT characteristic descriptors on the
// Chrome OS platform.
-class BluetoothRemoteGattDescriptorBlueZ
+class BluetoothRemoteGattDescriptorChromeOS
: public device::BluetoothGattDescriptor {
public:
// device::BluetoothGattDescriptor overrides.
@@ -47,12 +47,12 @@ class BluetoothRemoteGattDescriptorBlueZ
const dbus::ObjectPath& object_path() const { return object_path_; }
private:
- friend class BluetoothRemoteGattCharacteristicBlueZ;
+ friend class BluetoothRemoteGattCharacteristicChromeOS;
- BluetoothRemoteGattDescriptorBlueZ(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
+ BluetoothRemoteGattDescriptorChromeOS(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
const dbus::ObjectPath& object_path);
- ~BluetoothRemoteGattDescriptorBlueZ() override;
+ ~BluetoothRemoteGattDescriptorChromeOS() override;
// Called by dbus:: on unsuccessful completion of a request to read or write
// the descriptor value.
@@ -64,15 +64,15 @@ class BluetoothRemoteGattDescriptorBlueZ
dbus::ObjectPath object_path_;
// The GATT characteristic this descriptor belongs to.
- BluetoothRemoteGattCharacteristicBlueZ* characteristic_;
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothRemoteGattDescriptorBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattDescriptorChromeOS> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_bluez.cc b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
index e3fb5b1..8a57fa2 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_bluez.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
-#include "device/bluetooth/bluetooth_device_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
-#include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-namespace bluez {
+namespace chromeos {
namespace {
@@ -28,9 +28,9 @@ const char kErrorNotPermitted[] = "org.bluez.Error.NotPermitted";
} // namespace
-BluetoothRemoteGattServiceBlueZ::BluetoothRemoteGattServiceBlueZ(
- BluetoothAdapterBlueZ* adapter,
- BluetoothDeviceBlueZ* device,
+BluetoothRemoteGattServiceChromeOS::BluetoothRemoteGattServiceChromeOS(
+ BluetoothAdapterChromeOS* adapter,
+ BluetoothDeviceChromeOS* device,
const dbus::ObjectPath& object_path)
: object_path_(object_path),
adapter_(adapter),
@@ -57,7 +57,7 @@ BluetoothRemoteGattServiceBlueZ::BluetoothRemoteGattServiceBlueZ(
GattCharacteristicAdded(*iter);
}
-BluetoothRemoteGattServiceBlueZ::~BluetoothRemoteGattServiceBlueZ() {
+BluetoothRemoteGattServiceChromeOS::~BluetoothRemoteGattServiceChromeOS() {
bluez::BluezDBusManager::Get()
->GetBluetoothGattServiceClient()
->RemoveObserver(this);
@@ -79,11 +79,11 @@ BluetoothRemoteGattServiceBlueZ::~BluetoothRemoteGattServiceBlueZ() {
}
}
-std::string BluetoothRemoteGattServiceBlueZ::GetIdentifier() const {
+std::string BluetoothRemoteGattServiceChromeOS::GetIdentifier() const {
return object_path_.value();
}
-device::BluetoothUUID BluetoothRemoteGattServiceBlueZ::GetUUID() const {
+device::BluetoothUUID BluetoothRemoteGattServiceChromeOS::GetUUID() const {
bluez::BluetoothGattServiceClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattServiceClient()
@@ -92,11 +92,11 @@ device::BluetoothUUID BluetoothRemoteGattServiceBlueZ::GetUUID() const {
return device::BluetoothUUID(properties->uuid.value());
}
-bool BluetoothRemoteGattServiceBlueZ::IsLocal() const {
+bool BluetoothRemoteGattServiceChromeOS::IsLocal() const {
return false;
}
-bool BluetoothRemoteGattServiceBlueZ::IsPrimary() const {
+bool BluetoothRemoteGattServiceChromeOS::IsPrimary() const {
bluez::BluetoothGattServiceClient::Properties* properties =
bluez::BluezDBusManager::Get()
->GetBluetoothGattServiceClient()
@@ -105,12 +105,12 @@ bool BluetoothRemoteGattServiceBlueZ::IsPrimary() const {
return properties->primary.value();
}
-device::BluetoothDevice* BluetoothRemoteGattServiceBlueZ::GetDevice() const {
+device::BluetoothDevice* BluetoothRemoteGattServiceChromeOS::GetDevice() const {
return device_;
}
std::vector<device::BluetoothGattCharacteristic*>
-BluetoothRemoteGattServiceBlueZ::GetCharacteristics() const {
+BluetoothRemoteGattServiceChromeOS::GetCharacteristics() const {
std::vector<device::BluetoothGattCharacteristic*> characteristics;
for (CharacteristicMap::const_iterator iter = characteristics_.begin();
iter != characteristics_.end(); ++iter) {
@@ -120,13 +120,13 @@ BluetoothRemoteGattServiceBlueZ::GetCharacteristics() const {
}
std::vector<device::BluetoothGattService*>
-BluetoothRemoteGattServiceBlueZ::GetIncludedServices() const {
+BluetoothRemoteGattServiceChromeOS::GetIncludedServices() const {
// TODO(armansito): Return the actual included services here.
return std::vector<device::BluetoothGattService*>();
}
device::BluetoothGattCharacteristic*
-BluetoothRemoteGattServiceBlueZ::GetCharacteristic(
+BluetoothRemoteGattServiceChromeOS::GetCharacteristic(
const std::string& identifier) const {
CharacteristicMap::const_iterator iter =
characteristics_.find(dbus::ObjectPath(identifier));
@@ -135,26 +135,26 @@ BluetoothRemoteGattServiceBlueZ::GetCharacteristic(
return iter->second;
}
-bool BluetoothRemoteGattServiceBlueZ::AddCharacteristic(
+bool BluetoothRemoteGattServiceChromeOS::AddCharacteristic(
device::BluetoothGattCharacteristic* characteristic) {
VLOG(1) << "Characteristics cannot be added to a remote GATT service.";
return false;
}
-bool BluetoothRemoteGattServiceBlueZ::AddIncludedService(
+bool BluetoothRemoteGattServiceChromeOS::AddIncludedService(
device::BluetoothGattService* service) {
VLOG(1) << "Included services cannot be added to a remote GATT service.";
return false;
}
-void BluetoothRemoteGattServiceBlueZ::Register(
+void BluetoothRemoteGattServiceChromeOS::Register(
const base::Closure& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "A remote GATT service cannot be registered.";
error_callback.Run();
}
-void BluetoothRemoteGattServiceBlueZ::Unregister(
+void BluetoothRemoteGattServiceChromeOS::Unregister(
const base::Closure& callback,
const ErrorCallback& error_callback) {
VLOG(1) << "A remote GATT service cannot be unregistered.";
@@ -163,7 +163,7 @@ void BluetoothRemoteGattServiceBlueZ::Unregister(
// static
device::BluetoothGattService::GattErrorCode
-BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(
+BluetoothRemoteGattServiceChromeOS::DBusErrorToServiceError(
std::string error_name) {
device::BluetoothGattService::GattErrorCode code = GATT_ERROR_UNKNOWN;
if (error_name == kErrorFailed) {
@@ -184,11 +184,12 @@ BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(
return code;
}
-BluetoothAdapterBlueZ* BluetoothRemoteGattServiceBlueZ::GetAdapter() const {
+BluetoothAdapterChromeOS*
+BluetoothRemoteGattServiceChromeOS::GetAdapter() const {
return adapter_;
}
-void BluetoothRemoteGattServiceBlueZ::NotifyServiceChanged() {
+void BluetoothRemoteGattServiceChromeOS::NotifyServiceChanged() {
// Don't send service changed unless we know that all characteristics have
// already been discovered. This is to prevent spammy events before sending
// out the first Gatt
@@ -199,9 +200,9 @@ void BluetoothRemoteGattServiceBlueZ::NotifyServiceChanged() {
adapter_->NotifyGattServiceChanged(this);
}
-void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorAddedOrRemoved(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
- BluetoothRemoteGattDescriptorBlueZ* descriptor,
+void BluetoothRemoteGattServiceChromeOS::NotifyDescriptorAddedOrRemoved(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
bool added) {
DCHECK(characteristic->GetService() == this);
DCHECK(descriptor->GetCharacteristic() == characteristic);
@@ -215,9 +216,9 @@ void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorAddedOrRemoved(
adapter_->NotifyGattDescriptorRemoved(descriptor);
}
-void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorValueChanged(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
- BluetoothRemoteGattDescriptorBlueZ* descriptor,
+void BluetoothRemoteGattServiceChromeOS::NotifyDescriptorValueChanged(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
const std::vector<uint8>& value) {
DCHECK(characteristic->GetService() == this);
DCHECK(descriptor->GetCharacteristic() == characteristic);
@@ -225,9 +226,9 @@ void BluetoothRemoteGattServiceBlueZ::NotifyDescriptorValueChanged(
adapter_->NotifyGattDescriptorValueChanged(descriptor, value);
}
-void BluetoothRemoteGattServiceBlueZ::GattServicePropertyChanged(
+void BluetoothRemoteGattServiceChromeOS::GattServicePropertyChanged(
const dbus::ObjectPath& object_path,
- const std::string& property_name) {
+ const std::string& property_name){
if (object_path != object_path_)
return;
@@ -254,7 +255,7 @@ void BluetoothRemoteGattServiceBlueZ::GattServicePropertyChanged(
adapter_->NotifyGattDiscoveryComplete(this);
}
-void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded(
+void BluetoothRemoteGattServiceChromeOS::GattCharacteristicAdded(
const dbus::ObjectPath& object_path) {
if (characteristics_.find(object_path) != characteristics_.end()) {
VLOG(1) << "Remote GATT characteristic already exists: "
@@ -275,8 +276,8 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded(
VLOG(1) << "Adding new remote GATT characteristic for GATT service: "
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
- BluetoothRemoteGattCharacteristicBlueZ* characteristic =
- new BluetoothRemoteGattCharacteristicBlueZ(this, object_path);
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic =
+ new BluetoothRemoteGattCharacteristicChromeOS(this, object_path);
characteristics_[object_path] = characteristic;
DCHECK(characteristic->GetIdentifier() == object_path.value());
DCHECK(characteristic->GetUUID().IsValid());
@@ -285,7 +286,7 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded(
adapter_->NotifyGattCharacteristicAdded(characteristic);
}
-void BluetoothRemoteGattServiceBlueZ::GattCharacteristicRemoved(
+void BluetoothRemoteGattServiceChromeOS::GattCharacteristicRemoved(
const dbus::ObjectPath& object_path) {
CharacteristicMap::iterator iter = characteristics_.find(object_path);
if (iter == characteristics_.end()) {
@@ -296,7 +297,7 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicRemoved(
VLOG(1) << "Removing remote GATT characteristic from service: "
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
- BluetoothRemoteGattCharacteristicBlueZ* characteristic = iter->second;
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic = iter->second;
DCHECK(characteristic->object_path() == object_path);
characteristics_.erase(iter);
@@ -306,7 +307,7 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicRemoved(
delete characteristic;
}
-void BluetoothRemoteGattServiceBlueZ::GattCharacteristicPropertyChanged(
+void BluetoothRemoteGattServiceChromeOS::GattCharacteristicPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
CharacteristicMap::iterator iter = characteristics_.find(object_path);
@@ -335,4 +336,4 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicPropertyChanged(
properties->value.value());
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_bluez.h b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
index ce525f8..bc35cb7 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_bluez.h
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
#include <map>
#include <string>
@@ -25,16 +25,16 @@ class BluetoothGattCharacteristic;
} // namespace device
-namespace bluez {
+namespace chromeos {
-class BluetoothAdapterBlueZ;
-class BluetoothDeviceBlueZ;
-class BluetoothRemoteGattCharacteristicBlueZ;
-class BluetoothRemoteGattDescriptorBlueZ;
+class BluetoothAdapterChromeOS;
+class BluetoothDeviceChromeOS;
+class BluetoothRemoteGattCharacteristicChromeOS;
+class BluetoothRemoteGattDescriptorChromeOS;
-// The BluetoothRemoteGattServiceBlueZ class implements BluetootGattService
+// The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService
// for remote GATT services on the Chrome OS platform.
-class BluetoothRemoteGattServiceBlueZ
+class BluetoothRemoteGattServiceChromeOS
: public device::BluetoothGattService,
public bluez::BluetoothGattServiceClient::Observer,
public bluez::BluetoothGattCharacteristicClient::Observer {
@@ -67,42 +67,42 @@ class BluetoothRemoteGattServiceBlueZ
const std::string error_name);
// Returns the adapter associated with this service.
- BluetoothAdapterBlueZ* GetAdapter() const;
+ BluetoothAdapterChromeOS* GetAdapter() const;
// Notifies its observers that the GATT service has changed. This is mainly
- // used by BluetoothRemoteGattCharacteristicBlueZ instances to notify
+ // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify
// service observers when characteristic descriptors get added and removed.
void NotifyServiceChanged();
// Notifies its observers that a descriptor |descriptor| belonging to
// characteristic |characteristic| has been added or removed. This is used
- // by BluetoothRemoteGattCharacteristicBlueZ instances to notify service
+ // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service
// observers when characteristic descriptors get added and removed. If |added|
// is true, an "Added" event will be sent. Otherwise, a "Removed" event will
// be sent.
void NotifyDescriptorAddedOrRemoved(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
- BluetoothRemoteGattDescriptorBlueZ* descriptor,
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
bool added);
// Notifies its observers that the value of a descriptor has changed. Called
- // by BluetoothRemoteGattCharacteristicBlueZ instances to notify service
+ // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service
// observers.
void NotifyDescriptorValueChanged(
- BluetoothRemoteGattCharacteristicBlueZ* characteristic,
- BluetoothRemoteGattDescriptorBlueZ* descriptor,
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
const std::vector<uint8>& value);
private:
- friend class BluetoothDeviceBlueZ;
+ friend class BluetoothDeviceChromeOS;
- typedef std::map<dbus::ObjectPath, BluetoothRemoteGattCharacteristicBlueZ*>
+ typedef std::map<dbus::ObjectPath, BluetoothRemoteGattCharacteristicChromeOS*>
CharacteristicMap;
- BluetoothRemoteGattServiceBlueZ(BluetoothAdapterBlueZ* adapter,
- BluetoothDeviceBlueZ* device,
- const dbus::ObjectPath& object_path);
- ~BluetoothRemoteGattServiceBlueZ() override;
+ BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter,
+ BluetoothDeviceChromeOS* device,
+ const dbus::ObjectPath& object_path);
+ ~BluetoothRemoteGattServiceChromeOS() override;
// bluez::BluetoothGattServiceClient::Observer override.
void GattServicePropertyChanged(const dbus::ObjectPath& object_path,
@@ -120,11 +120,11 @@ class BluetoothRemoteGattServiceBlueZ
// The adapter associated with this service. It's ok to store a raw pointer
// here since |adapter_| indirectly owns this instance.
- BluetoothAdapterBlueZ* adapter_;
+ BluetoothAdapterChromeOS* adapter_;
// The device this GATT service belongs to. It's ok to store a raw pointer
// here since |device_| owns this instance.
- BluetoothDeviceBlueZ* device_;
+ BluetoothDeviceChromeOS* device_;
// Mapping from GATT characteristic object paths to characteristic objects.
// owned by this service. Since the Chrome OS implementation uses object
@@ -138,11 +138,11 @@ class BluetoothRemoteGattServiceBlueZ
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothRemoteGattServiceBlueZ> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_socket_bluez.cc b/device/bluetooth/bluetooth_socket_chromeos.cc
index 46269c9..b3e357d 100644
--- a/device/bluetooth/bluetooth_socket_bluez.cc
+++ b/device/bluetooth/bluetooth_socket_chromeos.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/bluetooth/bluetooth_socket_bluez.h"
+#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include <queue>
#include <string>
@@ -24,10 +24,10 @@
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
-#include "device/bluetooth/bluetooth_adapter_profile_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/bluetooth_device_bluez.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_socket.h"
#include "device/bluetooth/bluetooth_socket_net.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
@@ -52,33 +52,36 @@ const char kSocketNotListening[] = "Socket is not listening.";
} // namespace
-namespace bluez {
+namespace chromeos {
// static
-scoped_refptr<BluetoothSocketBlueZ> BluetoothSocketBlueZ::CreateBluetoothSocket(
+scoped_refptr<BluetoothSocketChromeOS>
+BluetoothSocketChromeOS::CreateBluetoothSocket(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<BluetoothSocketThread> socket_thread) {
DCHECK(ui_task_runner->RunsTasksOnCurrentThread());
return make_scoped_refptr(
- new BluetoothSocketBlueZ(ui_task_runner, socket_thread));
+ new BluetoothSocketChromeOS(ui_task_runner, socket_thread));
}
-BluetoothSocketBlueZ::AcceptRequest::AcceptRequest() {}
+BluetoothSocketChromeOS::AcceptRequest::AcceptRequest() {}
-BluetoothSocketBlueZ::AcceptRequest::~AcceptRequest() {}
+BluetoothSocketChromeOS::AcceptRequest::~AcceptRequest() {}
-BluetoothSocketBlueZ::ConnectionRequest::ConnectionRequest()
- : accepting(false), cancelled(false) {}
+BluetoothSocketChromeOS::ConnectionRequest::ConnectionRequest()
+ : accepting(false),
+ cancelled(false) {}
-BluetoothSocketBlueZ::ConnectionRequest::~ConnectionRequest() {}
+BluetoothSocketChromeOS::ConnectionRequest::~ConnectionRequest() {}
-BluetoothSocketBlueZ::BluetoothSocketBlueZ(
+BluetoothSocketChromeOS::BluetoothSocketChromeOS(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<BluetoothSocketThread> socket_thread)
- : BluetoothSocketNet(ui_task_runner, socket_thread), profile_(nullptr) {}
+ : BluetoothSocketNet(ui_task_runner, socket_thread), profile_(nullptr) {
+}
-BluetoothSocketBlueZ::~BluetoothSocketBlueZ() {
+BluetoothSocketChromeOS::~BluetoothSocketChromeOS() {
DCHECK(!profile_);
if (adapter_.get()) {
@@ -87,8 +90,8 @@ BluetoothSocketBlueZ::~BluetoothSocketBlueZ() {
}
}
-void BluetoothSocketBlueZ::Connect(
- const BluetoothDeviceBlueZ* device,
+void BluetoothSocketChromeOS::Connect(
+ const BluetoothDeviceChromeOS* device,
const BluetoothUUID& uuid,
SecurityLevel security_level,
const base::Closure& success_callback,
@@ -113,7 +116,7 @@ void BluetoothSocketBlueZ::Connect(
RegisterProfile(device->adapter(), success_callback, error_callback);
}
-void BluetoothSocketBlueZ::Listen(
+void BluetoothSocketChromeOS::Listen(
scoped_refptr<BluetoothAdapter> adapter,
SocketType socket_type,
const BluetoothUUID& uuid,
@@ -149,11 +152,11 @@ void BluetoothSocketBlueZ::Listen(
NOTREACHED();
}
- RegisterProfile(static_cast<BluetoothAdapterBlueZ*>(adapter.get()),
+ RegisterProfile(static_cast<BluetoothAdapterChromeOS*>(adapter.get()),
success_callback, error_callback);
}
-void BluetoothSocketBlueZ::Close() {
+void BluetoothSocketChromeOS::Close() {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
if (profile_)
@@ -175,7 +178,7 @@ void BluetoothSocketBlueZ::Close() {
}
}
-void BluetoothSocketBlueZ::Disconnect(const base::Closure& callback) {
+void BluetoothSocketChromeOS::Disconnect(const base::Closure& callback) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
if (profile_)
@@ -189,7 +192,7 @@ void BluetoothSocketBlueZ::Disconnect(const base::Closure& callback) {
}
}
-void BluetoothSocketBlueZ::Accept(
+void BluetoothSocketChromeOS::Accept(
const AcceptCompletionCallback& success_callback,
const ErrorCompletionCallback& error_callback) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
@@ -214,8 +217,8 @@ void BluetoothSocketBlueZ::Accept(
}
}
-void BluetoothSocketBlueZ::RegisterProfile(
- BluetoothAdapterBlueZ* adapter,
+void BluetoothSocketChromeOS::RegisterProfile(
+ BluetoothAdapterChromeOS* adapter,
const base::Closure& success_callback,
const ErrorCompletionCallback& error_callback) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
@@ -235,17 +238,18 @@ void BluetoothSocketBlueZ::RegisterProfile(
VLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
<< ": Acquiring profile.";
- adapter->UseProfile(uuid_, device_path_, *options_, this,
- base::Bind(&BluetoothSocketBlueZ::OnRegisterProfile, this,
- success_callback, error_callback),
- base::Bind(&BluetoothSocketBlueZ::OnRegisterProfileError,
- this, error_callback));
+ adapter->UseProfile(
+ uuid_, device_path_, *options_, this,
+ base::Bind(&BluetoothSocketChromeOS::OnRegisterProfile, this,
+ success_callback, error_callback),
+ base::Bind(&BluetoothSocketChromeOS::OnRegisterProfileError, this,
+ error_callback));
}
-void BluetoothSocketBlueZ::OnRegisterProfile(
+void BluetoothSocketChromeOS::OnRegisterProfile(
const base::Closure& success_callback,
const ErrorCompletionCallback& error_callback,
- BluetoothAdapterProfileBlueZ* profile) {
+ BluetoothAdapterProfileChromeOS* profile) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(!profile_);
@@ -262,13 +266,13 @@ void BluetoothSocketBlueZ::OnRegisterProfile(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
device_path_, uuid_.canonical_value(),
- base::Bind(&BluetoothSocketBlueZ::OnConnectProfile, this,
+ base::Bind(&BluetoothSocketChromeOS::OnConnectProfile, this,
success_callback),
- base::Bind(&BluetoothSocketBlueZ::OnConnectProfileError, this,
+ base::Bind(&BluetoothSocketChromeOS::OnConnectProfileError, this,
error_callback));
}
-void BluetoothSocketBlueZ::OnRegisterProfileError(
+void BluetoothSocketChromeOS::OnRegisterProfileError(
const ErrorCompletionCallback& error_callback,
const std::string& error_message) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
@@ -278,7 +282,7 @@ void BluetoothSocketBlueZ::OnRegisterProfileError(
error_callback.Run(error_message);
}
-void BluetoothSocketBlueZ::OnConnectProfile(
+void BluetoothSocketChromeOS::OnConnectProfile(
const base::Closure& success_callback) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(profile_);
@@ -288,7 +292,7 @@ void BluetoothSocketBlueZ::OnConnectProfile(
success_callback.Run();
}
-void BluetoothSocketBlueZ::OnConnectProfileError(
+void BluetoothSocketChromeOS::OnConnectProfileError(
const ErrorCompletionCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
@@ -302,8 +306,8 @@ void BluetoothSocketBlueZ::OnConnectProfileError(
error_callback.Run(error_message);
}
-void BluetoothSocketBlueZ::AdapterPresentChanged(BluetoothAdapter* adapter,
- bool present) {
+void BluetoothSocketChromeOS::AdapterPresentChanged(BluetoothAdapter* adapter,
+ bool present) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
if (!present) {
@@ -317,14 +321,15 @@ void BluetoothSocketBlueZ::AdapterPresentChanged(BluetoothAdapter* adapter,
VLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
<< ": Acquiring profile.";
- static_cast<BluetoothAdapterBlueZ*>(adapter)->UseProfile(
+ static_cast<BluetoothAdapterChromeOS*>(adapter)->UseProfile(
uuid_, device_path_, *options_, this,
- base::Bind(&BluetoothSocketBlueZ::OnInternalRegisterProfile, this),
- base::Bind(&BluetoothSocketBlueZ::OnInternalRegisterProfileError, this));
+ base::Bind(&BluetoothSocketChromeOS::OnInternalRegisterProfile, this),
+ base::Bind(&BluetoothSocketChromeOS::OnInternalRegisterProfileError,
+ this));
}
-void BluetoothSocketBlueZ::OnInternalRegisterProfile(
- BluetoothAdapterProfileBlueZ* profile) {
+void BluetoothSocketChromeOS::OnInternalRegisterProfile(
+ BluetoothAdapterProfileChromeOS* profile) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(!profile_);
@@ -333,21 +338,21 @@ void BluetoothSocketBlueZ::OnInternalRegisterProfile(
VLOG(1) << uuid_.canonical_value() << ": Profile re-registered";
}
-void BluetoothSocketBlueZ::OnInternalRegisterProfileError(
+void BluetoothSocketChromeOS::OnInternalRegisterProfileError(
const std::string& error_message) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
LOG(WARNING) << "Failed to re-register profile: " << error_message;
}
-void BluetoothSocketBlueZ::Released() {
+void BluetoothSocketChromeOS::Released() {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(profile_);
VLOG(1) << profile_->object_path().value() << ": Release";
}
-void BluetoothSocketBlueZ::NewConnection(
+void BluetoothSocketChromeOS::NewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
@@ -362,8 +367,13 @@ void BluetoothSocketBlueZ::NewConnection(
socket_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(&BluetoothSocketBlueZ::DoNewConnection, this, device_path_,
- base::Passed(&fd), options, callback));
+ base::Bind(
+ &BluetoothSocketChromeOS::DoNewConnection,
+ this,
+ device_path_,
+ base::Passed(&fd),
+ options,
+ callback));
} else {
linked_ptr<ConnectionRequest> request(new ConnectionRequest());
request->device_path = device_path;
@@ -379,7 +389,7 @@ void BluetoothSocketBlueZ::NewConnection(
}
}
-void BluetoothSocketBlueZ::RequestDisconnection(
+void BluetoothSocketChromeOS::RequestDisconnection(
const dbus::ObjectPath& device_path,
const ConfirmationCallback& callback) {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
@@ -389,7 +399,7 @@ void BluetoothSocketBlueZ::RequestDisconnection(
callback.Run(SUCCESS);
}
-void BluetoothSocketBlueZ::Cancel() {
+void BluetoothSocketChromeOS::Cancel() {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(profile_);
@@ -408,7 +418,7 @@ void BluetoothSocketBlueZ::Cancel() {
}
}
-void BluetoothSocketBlueZ::AcceptConnectionRequest() {
+void BluetoothSocketChromeOS::AcceptConnectionRequest() {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(accept_request_.get());
DCHECK(connection_request_queue_.size() >= 1);
@@ -420,14 +430,14 @@ void BluetoothSocketBlueZ::AcceptConnectionRequest() {
linked_ptr<ConnectionRequest> request = connection_request_queue_.front();
request->accepting = true;
- BluetoothDeviceBlueZ* device =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get())
- ->GetDeviceWithPath(request->device_path);
+ BluetoothDeviceChromeOS* device =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get())->
+ GetDeviceWithPath(request->device_path);
DCHECK(device);
- scoped_refptr<BluetoothSocketBlueZ> client_socket =
- BluetoothSocketBlueZ::CreateBluetoothSocket(ui_task_runner(),
- socket_thread());
+ scoped_refptr<BluetoothSocketChromeOS> client_socket =
+ BluetoothSocketChromeOS::CreateBluetoothSocket(
+ ui_task_runner(), socket_thread());
client_socket->device_address_ = device->GetAddress();
client_socket->device_path_ = request->device_path;
@@ -435,14 +445,19 @@ void BluetoothSocketBlueZ::AcceptConnectionRequest() {
socket_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(&BluetoothSocketBlueZ::DoNewConnection, client_socket,
- request->device_path, base::Passed(&request->fd),
- request->options,
- base::Bind(&BluetoothSocketBlueZ::OnNewConnection, this,
- client_socket, request->callback)));
+ base::Bind(
+ &BluetoothSocketChromeOS::DoNewConnection,
+ client_socket,
+ request->device_path,
+ base::Passed(&request->fd),
+ request->options,
+ base::Bind(&BluetoothSocketChromeOS::OnNewConnection,
+ this,
+ client_socket,
+ request->callback)));
}
-void BluetoothSocketBlueZ::DoNewConnection(
+void BluetoothSocketChromeOS::DoNewConnection(
const dbus::ObjectPath& device_path,
scoped_ptr<dbus::FileDescriptor> fd,
const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
@@ -455,15 +470,15 @@ void BluetoothSocketBlueZ::DoNewConnection(
if (!fd->is_valid()) {
LOG(WARNING) << uuid_.canonical_value() << " :" << fd->value()
<< ": Invalid file descriptor received from Bluetooth Daemon.";
- ui_task_runner()->PostTask(FROM_HERE, base::Bind(callback, REJECTED));
- ;
+ ui_task_runner()->PostTask(FROM_HERE,
+ base::Bind(callback, REJECTED));;
return;
}
if (tcp_socket()) {
LOG(WARNING) << uuid_.canonical_value() << ": Already connected";
- ui_task_runner()->PostTask(FROM_HERE, base::Bind(callback, REJECTED));
- ;
+ ui_task_runner()->PostTask(FROM_HERE,
+ base::Bind(callback, REJECTED));;
return;
}
@@ -471,24 +486,24 @@ void BluetoothSocketBlueZ::DoNewConnection(
// Note: We don't have a meaningful |IPEndPoint|, but that is ok since the
// TCPSocket implementation does not actually require one.
- int net_result =
- tcp_socket()->AdoptConnectedSocket(fd->value(), net::IPEndPoint());
+ int net_result = tcp_socket()->AdoptConnectedSocket(fd->value(),
+ net::IPEndPoint());
if (net_result != net::OK) {
LOG(WARNING) << uuid_.canonical_value() << ": Error adopting socket: "
<< std::string(net::ErrorToString(net_result));
- ui_task_runner()->PostTask(FROM_HERE, base::Bind(callback, REJECTED));
- ;
+ ui_task_runner()->PostTask(FROM_HERE,
+ base::Bind(callback, REJECTED));;
return;
}
VLOG(2) << uuid_.canonical_value()
<< ": Taking descriptor, confirming success.";
fd->TakeValue();
- ui_task_runner()->PostTask(FROM_HERE, base::Bind(callback, SUCCESS));
- ;
+ ui_task_runner()->PostTask(FROM_HERE,
+ base::Bind(callback, SUCCESS));;
}
-void BluetoothSocketBlueZ::OnNewConnection(
+void BluetoothSocketChromeOS::OnNewConnection(
scoped_refptr<BluetoothSocket> socket,
const ConfirmationCallback& callback,
Status status) {
@@ -498,9 +513,9 @@ void BluetoothSocketBlueZ::OnNewConnection(
linked_ptr<ConnectionRequest> request = connection_request_queue_.front();
if (status == SUCCESS && !request->cancelled) {
- BluetoothDeviceBlueZ* device =
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get())
- ->GetDeviceWithPath(request->device_path);
+ BluetoothDeviceChromeOS* device =
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get())->
+ GetDeviceWithPath(request->device_path);
DCHECK(device);
accept_request_->success_callback.Run(device, socket);
@@ -514,7 +529,7 @@ void BluetoothSocketBlueZ::OnNewConnection(
callback.Run(status);
}
-void BluetoothSocketBlueZ::DoCloseListening() {
+void BluetoothSocketChromeOS::DoCloseListening() {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
if (accept_request_) {
@@ -530,15 +545,15 @@ void BluetoothSocketBlueZ::DoCloseListening() {
}
}
-void BluetoothSocketBlueZ::UnregisterProfile() {
+void BluetoothSocketChromeOS::UnregisterProfile() {
DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
DCHECK(profile_);
VLOG(1) << profile_->object_path().value() << ": Release profile";
- static_cast<BluetoothAdapterBlueZ*>(adapter_.get())
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get())
->ReleaseProfile(device_path_, profile_);
profile_ = nullptr;
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_socket_bluez.h b/device/bluetooth/bluetooth_socket_chromeos.h
index 7ba23839..a1c76ee2 100644
--- a/device/bluetooth/bluetooth_socket_bluez.h
+++ b/device/bluetooth/bluetooth_socket_chromeos.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_BLUEZ_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_BLUEZ_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_
#include <queue>
#include <string>
@@ -23,24 +23,27 @@ namespace dbus {
class FileDescriptor;
} // namespace dbus
-namespace bluez {
+namespace chromeos {
-class BluetoothDeviceBlueZ;
-class BluetoothAdapterBlueZ;
-class BluetoothAdapterProfileBlueZ;
+class BluetoothDeviceChromeOS;
+class BluetoothAdapterChromeOS;
+class BluetoothAdapterProfileChromeOS;
-// The BluetoothSocketBlueZ class implements BluetoothSocket for the
+// The BluetoothSocketChromeOS class implements BluetoothSocket for the
// Chrome OS platform.
//
// This class is not thread-safe, but is only called from the UI thread.
-class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ
+class DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS
: public device::BluetoothSocketNet,
public device::BluetoothAdapter::Observer,
public bluez::BluetoothProfileServiceProvider::Delegate {
public:
- enum SecurityLevel { SECURITY_LEVEL_LOW, SECURITY_LEVEL_MEDIUM };
+ enum SecurityLevel {
+ SECURITY_LEVEL_LOW,
+ SECURITY_LEVEL_MEDIUM
+ };
- static scoped_refptr<BluetoothSocketBlueZ> CreateBluetoothSocket(
+ static scoped_refptr<BluetoothSocketChromeOS> CreateBluetoothSocket(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<device::BluetoothSocketThread> socket_thread);
@@ -49,7 +52,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ
// discovery. On a successful connection the socket properties will be updated
// and |success_callback| called. On failure |error_callback| will be called
// with a message explaining the cause of the failure.
- virtual void Connect(const BluetoothDeviceBlueZ* device,
+ virtual void Connect(const BluetoothDeviceChromeOS* device,
const device::BluetoothUUID& uuid,
SecurityLevel security_level,
const base::Closure& success_callback,
@@ -77,20 +80,20 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ
const ErrorCompletionCallback& error_callback) override;
protected:
- ~BluetoothSocketBlueZ() override;
+ ~BluetoothSocketChromeOS() override;
private:
- BluetoothSocketBlueZ(
+ BluetoothSocketChromeOS(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<device::BluetoothSocketThread> socket_thread);
// Register the underlying profile client object with the Bluetooth Daemon.
- void RegisterProfile(BluetoothAdapterBlueZ* adapter,
+ void RegisterProfile(BluetoothAdapterChromeOS* adapter,
const base::Closure& success_callback,
const ErrorCompletionCallback& error_callback);
void OnRegisterProfile(const base::Closure& success_callback,
const ErrorCompletionCallback& error_callback,
- BluetoothAdapterProfileBlueZ* profile);
+ BluetoothAdapterProfileChromeOS* profile);
void OnRegisterProfileError(const ErrorCompletionCallback& error_callback,
const std::string& error_message);
@@ -106,7 +109,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ
// Called by dbus:: on completion of the RegisterProfile() method call
// triggered as a result of the adapter becoming present again.
- void OnInternalRegisterProfile(BluetoothAdapterProfileBlueZ* profile);
+ void OnInternalRegisterProfile(BluetoothAdapterProfileChromeOS* profile);
void OnInternalRegisterProfileError(const std::string& error_message);
// bluez::BluetoothProfileServiceProvider::Delegate:
@@ -166,7 +169,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ
scoped_ptr<bluez::BluetoothProfileManagerClient::Options> options_;
// The profile registered with the adapter for this socket.
- BluetoothAdapterProfileBlueZ* profile_;
+ BluetoothAdapterProfileChromeOS* profile_;
// Pending request to an Accept() call.
struct AcceptRequest {
@@ -190,11 +193,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ
bool accepting;
bool cancelled;
};
- std::queue<linked_ptr<ConnectionRequest>> connection_request_queue_;
+ std::queue<linked_ptr<ConnectionRequest> > connection_request_queue_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothSocketBlueZ);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS);
};
-} // namespace bluez
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_BLUEZ_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_
diff --git a/device/bluetooth/bluetooth_socket_bluez_unittest.cc b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
index e72468f..0bdc3be 100644
--- a/device/bluetooth/bluetooth_socket_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
@@ -6,12 +6,12 @@
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/bluetooth_device_bluez.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_socket.h"
-#include "device/bluetooth/bluetooth_socket_bluez.h"
+#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
@@ -39,11 +39,11 @@ void DoNothingDBusErrorCallback(const std::string& error_name,
} // namespace
-namespace bluez {
+namespace chromeos {
-class BluetoothSocketBlueZTest : public testing::Test {
+class BluetoothSocketChromeOSTest : public testing::Test {
public:
- BluetoothSocketBlueZTest()
+ BluetoothSocketChromeOSTest()
: success_callback_count_(0),
error_callback_count_(0),
last_bytes_sent_(0),
@@ -76,15 +76,18 @@ class BluetoothSocketBlueZTest : public testing::Test {
BluetoothSocketThread::Get();
// Grab a pointer to the adapter.
- device::BluetoothAdapterFactory::GetAdapter(base::Bind(
- &BluetoothSocketBlueZTest::AdapterCallback, base::Unretained(this)));
+ device::BluetoothAdapterFactory::GetAdapter(
+ base::Bind(&BluetoothSocketChromeOSTest::AdapterCallback,
+ base::Unretained(this)));
ASSERT_TRUE(adapter_.get() != nullptr);
ASSERT_TRUE(adapter_->IsInitialized());
ASSERT_TRUE(adapter_->IsPresent());
// Turn on the adapter.
- adapter_->SetPowered(true, base::Bind(&base::DoNothing),
- base::Bind(&base::DoNothing));
+ adapter_->SetPowered(
+ true,
+ base::Bind(&base::DoNothing),
+ base::Bind(&base::DoNothing));
ASSERT_TRUE(adapter_->IsPowered());
}
@@ -160,7 +163,9 @@ class BluetoothSocketBlueZTest : public testing::Test {
message_loop_.Quit();
}
- void ImmediateSuccessCallback() { ++success_callback_count_; }
+ void ImmediateSuccessCallback() {
+ ++success_callback_count_;
+ }
protected:
base::MessageLoop message_loop_;
@@ -179,16 +184,16 @@ class BluetoothSocketBlueZTest : public testing::Test {
const BluetoothDevice* last_device_;
};
-TEST_F(BluetoothSocketBlueZTest, Connect) {
+TEST_F(BluetoothSocketChromeOSTest, Connect) {
BluetoothDevice* device = adapter_->GetDevice(
bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
device->ConnectToService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
- base::Bind(&BluetoothSocketBlueZTest::ConnectToServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -207,9 +212,9 @@ TEST_F(BluetoothSocketBlueZTest, Connect) {
new net::StringIOBuffer("test"));
socket->Send(write_buffer.get(), write_buffer->size(),
- base::Bind(&BluetoothSocketBlueZTest::SendSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::SendSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -222,11 +227,12 @@ TEST_F(BluetoothSocketBlueZTest, Connect) {
// Receive data from the socket, and fetch the buffer from the callback; since
// the fake is an echo server, we expect to receive what we wrote.
- socket->Receive(4096,
- base::Bind(&BluetoothSocketBlueZTest::ReceiveSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ReceiveErrorCallback,
- base::Unretained(this)));
+ socket->Receive(
+ 4096,
+ base::Bind(&BluetoothSocketChromeOSTest::ReceiveSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothSocketChromeOSTest::ReceiveErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(1U, success_callback_count_);
@@ -247,11 +253,12 @@ TEST_F(BluetoothSocketBlueZTest, Connect) {
// Receive data again; the socket will have been closed, this should cause a
// disconnected error to be returned via the error callback.
- socket->Receive(4096,
- base::Bind(&BluetoothSocketBlueZTest::ReceiveSuccessCallback,
- base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ReceiveErrorCallback,
- base::Unretained(this)));
+ socket->Receive(
+ 4096,
+ base::Bind(&BluetoothSocketChromeOSTest::ReceiveSuccessCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothSocketChromeOSTest::ReceiveErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(0U, success_callback_count_);
@@ -267,9 +274,9 @@ TEST_F(BluetoothSocketBlueZTest, Connect) {
write_buffer = new net::StringIOBuffer("second test");
socket->Send(write_buffer.get(), write_buffer->size(),
- base::Bind(&BluetoothSocketBlueZTest::SendSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::SendSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -281,20 +288,20 @@ TEST_F(BluetoothSocketBlueZTest, Connect) {
error_callback_count_ = 0;
// Close our end of the socket.
- socket->Disconnect(base::Bind(&BluetoothSocketBlueZTest::SuccessCallback,
+ socket->Disconnect(base::Bind(&BluetoothSocketChromeOSTest::SuccessCallback,
base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(1U, success_callback_count_);
}
-TEST_F(BluetoothSocketBlueZTest, Listen) {
+TEST_F(BluetoothSocketChromeOSTest, Listen) {
adapter_->CreateRfcommService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
- base::Bind(&BluetoothSocketBlueZTest::CreateServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -322,16 +329,16 @@ TEST_F(BluetoothSocketBlueZTest, Listen) {
bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
fake_bluetooth_device_client->ConnectProfile(
- static_cast<BluetoothDeviceBlueZ*>(device)->object_path(),
+ static_cast<BluetoothDeviceChromeOS*>(device)->object_path(),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
message_loop_.RunUntilIdle();
server_socket->Accept(
- base::Bind(&BluetoothSocketBlueZTest::AcceptSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -347,8 +354,9 @@ TEST_F(BluetoothSocketBlueZTest, Listen) {
error_callback_count_ = 0;
// Close our end of the client socket.
- client_socket->Disconnect(base::Bind(
- &BluetoothSocketBlueZTest::SuccessCallback, base::Unretained(this)));
+ client_socket->Disconnect(
+ base::Bind(&BluetoothSocketChromeOSTest::SuccessCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -360,15 +368,15 @@ TEST_F(BluetoothSocketBlueZTest, Listen) {
// Run a second connection test, this time calling Accept() before the
// incoming connection comes in.
server_socket->Accept(
- base::Bind(&BluetoothSocketBlueZTest::AcceptSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
fake_bluetooth_device_client->ConnectProfile(
- static_cast<BluetoothDeviceBlueZ*>(device)->object_path(),
+ static_cast<BluetoothDeviceChromeOS*>(device)->object_path(),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
@@ -385,8 +393,9 @@ TEST_F(BluetoothSocketBlueZTest, Listen) {
error_callback_count_ = 0;
// Close our end of the client socket.
- client_socket->Disconnect(base::Bind(
- &BluetoothSocketBlueZTest::SuccessCallback, base::Unretained(this)));
+ client_socket->Disconnect(
+ base::Bind(&BluetoothSocketChromeOSTest::SuccessCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -397,7 +406,7 @@ TEST_F(BluetoothSocketBlueZTest, Listen) {
// Now close the server socket.
server_socket->Disconnect(
- base::Bind(&BluetoothSocketBlueZTest::ImmediateSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -405,7 +414,7 @@ TEST_F(BluetoothSocketBlueZTest, Listen) {
EXPECT_EQ(1U, success_callback_count_);
}
-TEST_F(BluetoothSocketBlueZTest, ListenBeforeAdapterStart) {
+TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) {
// Start off with an invisible adapter, register the profile, then make
// the adapter visible.
bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
@@ -416,9 +425,9 @@ TEST_F(BluetoothSocketBlueZTest, ListenBeforeAdapterStart) {
adapter_->CreateRfcommService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
- base::Bind(&BluetoothSocketBlueZTest::CreateServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -455,7 +464,7 @@ TEST_F(BluetoothSocketBlueZTest, ListenBeforeAdapterStart) {
// Cleanup the socket.
socket->Disconnect(
- base::Bind(&BluetoothSocketBlueZTest::ImmediateSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -463,7 +472,7 @@ TEST_F(BluetoothSocketBlueZTest, ListenBeforeAdapterStart) {
EXPECT_EQ(1U, success_callback_count_);
}
-TEST_F(BluetoothSocketBlueZTest, ListenAcrossAdapterRestart) {
+TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) {
// The fake adapter starts off visible by default.
bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
static_cast<bluez::FakeBluetoothAdapterClient*>(
@@ -472,9 +481,9 @@ TEST_F(BluetoothSocketBlueZTest, ListenAcrossAdapterRestart) {
adapter_->CreateRfcommService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
- base::Bind(&BluetoothSocketBlueZTest::CreateServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -517,7 +526,7 @@ TEST_F(BluetoothSocketBlueZTest, ListenAcrossAdapterRestart) {
// Cleanup the socket.
socket->Disconnect(
- base::Bind(&BluetoothSocketBlueZTest::ImmediateSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -525,16 +534,16 @@ TEST_F(BluetoothSocketBlueZTest, ListenAcrossAdapterRestart) {
EXPECT_EQ(1U, success_callback_count_);
}
-TEST_F(BluetoothSocketBlueZTest, PairedConnectFails) {
+TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) {
BluetoothDevice* device = adapter_->GetDevice(
bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress);
ASSERT_TRUE(device != nullptr);
device->ConnectToService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
- base::Bind(&BluetoothSocketBlueZTest::ConnectToServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -544,9 +553,9 @@ TEST_F(BluetoothSocketBlueZTest, PairedConnectFails) {
device->ConnectToService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
- base::Bind(&BluetoothSocketBlueZTest::ConnectToServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -555,13 +564,13 @@ TEST_F(BluetoothSocketBlueZTest, PairedConnectFails) {
EXPECT_TRUE(last_socket_.get() == nullptr);
}
-TEST_F(BluetoothSocketBlueZTest, SocketListenTwice) {
+TEST_F(BluetoothSocketChromeOSTest, SocketListenTwice) {
adapter_->CreateRfcommService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
- base::Bind(&BluetoothSocketBlueZTest::CreateServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -575,9 +584,9 @@ TEST_F(BluetoothSocketBlueZTest, SocketListenTwice) {
server_socket.swap(last_socket_);
server_socket->Accept(
- base::Bind(&BluetoothSocketBlueZTest::AcceptSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
server_socket->Close();
@@ -592,9 +601,9 @@ TEST_F(BluetoothSocketBlueZTest, SocketListenTwice) {
adapter_->CreateRfcommService(
BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
BluetoothAdapter::ServiceOptions(),
- base::Bind(&BluetoothSocketBlueZTest::CreateServiceSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
message_loop_.Run();
@@ -607,9 +616,9 @@ TEST_F(BluetoothSocketBlueZTest, SocketListenTwice) {
server_socket.swap(last_socket_);
server_socket->Accept(
- base::Bind(&BluetoothSocketBlueZTest::AcceptSuccessCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback,
base::Unretained(this)),
- base::Bind(&BluetoothSocketBlueZTest::ErrorCallback,
+ base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
base::Unretained(this)));
server_socket->Close();
@@ -622,4 +631,4 @@ TEST_F(BluetoothSocketBlueZTest, SocketListenTwice) {
EXPECT_EQ(2U, error_callback_count_);
}
-} // namespace bluez
+} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_socket_thread.h b/device/bluetooth/bluetooth_socket_thread.h
index 0c7b65c..244640f 100644
--- a/device/bluetooth/bluetooth_socket_thread.h
+++ b/device/bluetooth/bluetooth_socket_thread.h
@@ -17,7 +17,7 @@ class Thread;
namespace device {
-// Thread abstraction used by |BluetoothSocketBlueZ| and |BluetoothSocketWin|
+// Thread abstraction used by |BluetoothSocketChromeOS| and |BluetoothSocketWin|
// to perform IO operations on the underlying platform sockets. An instance of
// this class can be shared by many active sockets.
class DEVICE_BLUETOOTH_EXPORT BluetoothSocketThread
diff --git a/device/bluetooth/dbus/bluetooth_agent_service_provider.h b/device/bluetooth/dbus/bluetooth_agent_service_provider.h
index 162cf7e..e31ef8f 100644
--- a/device/bluetooth/dbus/bluetooth_agent_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_agent_service_provider.h
@@ -21,10 +21,10 @@ namespace bluez {
//
// Instantiate with a chosen D-Bus object path and delegate object, and pass
// the D-Bus object path as the |agent_path| argument to the
-// bluez::BluetoothAgentManagerClient::RegisterAgent() method.
+// chromeos::BluetoothAgentManagerClient::RegisterAgent() method.
//
// After initiating the pairing process with a device, using the
-// bluez::BluetoothDeviceClient::Pair() method, the Bluetooth daemon will
+// chromeos::BluetoothDeviceClient::Pair() method, the Bluetooth daemon will
// make calls to this agent object and they will be passed on to your Delegate
// object for handling. Responses should be returned using the callbacks
// supplied to those methods.
diff --git a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
index 1d53d8a..29a4ce8 100644
--- a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
+++ b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
+#include "chromeos/chromeos_switches.h"
#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
#include "device/bluetooth/dbus/bluetooth_device_client.h"
diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc b/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc
index d6229a3a..6000a52 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc
@@ -210,7 +210,7 @@ class BluetoothGattCharacteristicClientImpl
}
protected:
- // bluez::DBusClient override.
+ // chromeos::DBusClient override.
void Init(dbus::Bus* bus) override {
object_manager_ = bus->GetObjectManager(
bluetooth_object_manager::kBluetoothObjectManagerServiceName,
diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc b/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
index d3f9e5f..f3ba343 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
@@ -159,7 +159,7 @@ class BluetoothGattDescriptorClientImpl
}
protected:
- // bluez::DBusClient override.
+ // chromeos::DBusClient override.
void Init(dbus::Bus* bus) override {
object_manager_ = bus->GetObjectManager(
bluetooth_object_manager::kBluetoothObjectManagerServiceName,
diff --git a/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc b/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc
index 94f79f5..7e471a5 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc
@@ -73,7 +73,7 @@ class BluetoothGattManagerClientImpl : public BluetoothGattManagerClient {
}
protected:
- // bluez::DBusClient override.
+ // chromeos::DBusClient override.
void Init(dbus::Bus* bus) override {
DCHECK(bus);
object_proxy_ = bus->GetObjectProxy(
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_client.cc b/device/bluetooth/dbus/bluetooth_gatt_service_client.cc
index b13e5fb..dc3ef5a 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_client.cc
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_client.cc
@@ -95,7 +95,7 @@ class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient,
}
protected:
- // bluez::DBusClient override.
+ // chromeos::DBusClient override.
void Init(dbus::Bus* bus) override {
object_manager_ = bus->GetObjectManager(
bluetooth_object_manager::kBluetoothObjectManagerServiceName,
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
index 16460ce..828f096 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
@@ -21,7 +21,7 @@ namespace bluez {
// Instantiate with a chosen D-Bus object path (that conforms to the BlueZ GATT
// service specification), service UUID, and the list of included services, and
// pass the D-Bus object path as the |service_path| argument to the
-// bluez::BluetoothGattManagerClient::RegisterService method. Make sure to
+// chromeos::BluetoothGattManagerClient::RegisterService method. Make sure to
// create characteristic and descriptor objects using the appropriate service
// providers before registering a GATT service with the Bluetooth daemon.
class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider {
diff --git a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
index d42cd94..df17f09 100644
--- a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
@@ -21,7 +21,7 @@ namespace bluez {
//
// Instantiate with a chosen D-Bus object path and a delegate object, and pass
// the D-Bus object path as |endpoint_path| argument to the
-// bluez::BluetoothMediaClient::RegisterEndoint() method.
+// chromeos::BluetoothMediaClient::RegisterEndoint() method.
//
// After initiating a connection between an audio source and an audio sink, the
// Bluetooth daemon will make calls to this endpoint object and they will be
diff --git a/device/bluetooth/dbus/bluetooth_profile_service_provider.h b/device/bluetooth/dbus/bluetooth_profile_service_provider.h
index 109bcaf..f2db22c 100644
--- a/device/bluetooth/dbus/bluetooth_profile_service_provider.h
+++ b/device/bluetooth/dbus/bluetooth_profile_service_provider.h
@@ -22,10 +22,10 @@ namespace bluez {
//
// Instantiate with a chosen D-Bus object path and delegate object, and pass
// the D-Bus object path as the |agent_path| argument to the
-// bluez::BluetoothProfileManagerClient::RegisterProfile() method.
+// chromeos::BluetoothProfileManagerClient::RegisterProfile() method.
//
// When an incoming profile connection occurs, or after initiating a connection
-// using the bluez::BluetoothDeviceClient::ConnectProfile() method, the
+// using the chromeos::BluetoothDeviceClient::ConnectProfile() method, the
// Bluetooth daemon will make calls to this profile object and they will be
// passed on to your Delegate object for handling. Responses should be returned
// using the callbacks supplied to those methods.
diff --git a/device/bluetooth/dbus/bluez_dbus_manager.h b/device/bluetooth/dbus/bluez_dbus_manager.h
index d59dddb..6f75f96 100644
--- a/device/bluetooth/dbus/bluez_dbus_manager.h
+++ b/device/bluetooth/dbus/bluez_dbus_manager.h
@@ -56,7 +56,7 @@ class DEVICE_BLUETOOTH_EXPORT BluezDBusManager {
// We explicitly initialize and shut down the global object, rather than
// making it a Singleton, to ensure clean startup and shutdown.
// This will initialize real or stub DBusClients depending on command-line
- // arguments and whether this process runs in a real or test environment.
+ // arguments and whether this process runs in a ChromeOS environment.
static void Initialize(dbus::Bus* bus, bool use_dbus_stub);
// Returns a BluezDBusManagerSetter instance that allows tests to
diff --git a/device/bluetooth/dbus/dbus_thread_manager_linux.cc b/device/bluetooth/dbus/dbus_thread_manager_linux.cc
deleted file mode 100644
index adffe9b..0000000
--- a/device/bluetooth/dbus/dbus_thread_manager_linux.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/bluetooth/dbus/dbus_thread_manager_linux.h"
-
-#include "base/threading/thread.h"
-#include "dbus/bus.h"
-
-namespace bluez {
-
-static DBusThreadManagerLinux* g_linux_dbus_manager = NULL;
-
-DBusThreadManagerLinux::DBusThreadManagerLinux() {
- base::Thread::Options thread_options;
- thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
- dbus_thread_.reset(new base::Thread("D-Bus thread"));
- dbus_thread_->StartWithOptions(thread_options);
-
- // Create the connection to the system bus.
- dbus::Bus::Options system_bus_options;
- system_bus_options.bus_type = dbus::Bus::SYSTEM;
- system_bus_options.connection_type = dbus::Bus::PRIVATE;
- system_bus_options.dbus_task_runner = dbus_thread_->task_runner();
- system_bus_ = new dbus::Bus(system_bus_options);
-}
-
-DBusThreadManagerLinux::~DBusThreadManagerLinux() {
- // Shut down the bus. During the browser shutdown, it's ok to shut down
- // the bus synchronously.
- if (system_bus_.get())
- system_bus_->ShutdownOnDBusThreadAndBlock();
-
- // Stop the D-Bus thread.
- if (dbus_thread_)
- dbus_thread_->Stop();
-
- if (!g_linux_dbus_manager)
- return; // Called form Shutdown() or local test instance.
-
- // There should never be both a global instance and a local instance.
- CHECK(this == g_linux_dbus_manager);
-}
-
-dbus::Bus* DBusThreadManagerLinux::GetSystemBus() {
- return system_bus_.get();
-}
-
-// static
-void DBusThreadManagerLinux::Initialize() {
- CHECK(!g_linux_dbus_manager);
- g_linux_dbus_manager = new DBusThreadManagerLinux();
-}
-
-// static
-void DBusThreadManagerLinux::Shutdown() {
- // Ensure that we only shutdown LinuxDBusManager once.
- CHECK(g_linux_dbus_manager);
- DBusThreadManagerLinux* dbus_thread_manager = g_linux_dbus_manager;
- g_linux_dbus_manager = NULL;
- delete dbus_thread_manager;
- VLOG(1) << "LinuxDBusManager Shutdown completed";
-}
-
-// static
-DBusThreadManagerLinux* DBusThreadManagerLinux::Get() {
- CHECK(g_linux_dbus_manager)
- << "LinuxDBusManager::Get() called before Initialize()";
- return g_linux_dbus_manager;
-}
-
-} // namespace bluez
diff --git a/device/bluetooth/dbus/dbus_thread_manager_linux.h b/device/bluetooth/dbus/dbus_thread_manager_linux.h
deleted file mode 100644
index 56fdb1c..0000000
--- a/device/bluetooth/dbus/dbus_thread_manager_linux.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef DEVICE_BLUETOOTH_DBUS_LINUX_DBUS_MANAGER_H_
-#define DEVICE_BLUETOOTH_DBUS_LINUX_DBUS_MANAGER_H_
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "device/bluetooth/bluetooth_export.h"
-
-namespace base {
-class Thread;
-} // namespace base
-
-namespace dbus {
-class Bus;
-} // namespace dbus
-
-namespace bluez {
-
-// LinuxDBusManager manages the D-Bus thread, the thread dedicated to
-// handling asynchronous D-Bus operations.
-class DEVICE_BLUETOOTH_EXPORT DBusThreadManagerLinux {
- public:
- // Sets the global instance. Must be called before any calls to Get().
- // We explicitly initialize and shut down the global object, rather than
- // making it a Singleton, to ensure clean startup and shutdown.
- static void Initialize();
-
- // Destroys the global instance.
- static void Shutdown();
-
- // Gets the global instance. Initialize() must be called first.
- static DBusThreadManagerLinux* Get();
-
- // Returns various D-Bus bus instances, owned by LinuxDBusManager.
- dbus::Bus* GetSystemBus();
-
- private:
- explicit DBusThreadManagerLinux();
- ~DBusThreadManagerLinux();
-
- // Creates a global instance of LinuxDBusManager with the real
- // implementations for all clients that are listed in |unstub_client_mask| and
- // stub implementations for all clients that are not included. Cannot be
- // called more than once.
- static void CreateGlobalInstance();
-
- scoped_ptr<base::Thread> dbus_thread_;
- scoped_refptr<dbus::Bus> system_bus_;
-
- DISALLOW_COPY_AND_ASSIGN(DBusThreadManagerLinux);
-};
-
-} // namespace bluez
-
-#endif // DEVICE_BLUETOOTH_DBUS_LINUX_DBUS_MANAGER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_adapter_client.h b/device/bluetooth/dbus/fake_bluetooth_adapter_client.h
index 0dced89..51cd808 100644
--- a/device/bluetooth/dbus/fake_bluetooth_adapter_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_adapter_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
#include <vector>
@@ -115,4 +115,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAdapterClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
index d5c83cf..8d7e30c 100644
--- a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
#include "base/bind.h"
#include "base/callback.h"
@@ -54,4 +54,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentManagerClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
index e3c8cd4..37e1ce6 100644
--- a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
#include "base/bind.h"
#include "base/callback.h"
@@ -65,4 +65,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
index 4af707e..5dd589b 100644
--- a/device/bluetooth/dbus/fake_bluetooth_device_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_device_client.cc
@@ -959,7 +959,7 @@ void FakeBluetoothDeviceClient::RemoveDevice(
// Remove the Input interface if it exists. This should be called before the
// BluetoothDeviceClient::Observer::DeviceRemoved because it deletes the
- // BluetoothDeviceBlueZ object, including the device_path referenced here.
+ // BluetoothDeviceChromeOS object, including the device_path referenced here.
FakeBluetoothInputClient* fake_bluetooth_input_client =
static_cast<FakeBluetoothInputClient*>(
bluez::BluezDBusManager::Get()->GetBluetoothInputClient());
diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.h b/device/bluetooth/dbus/fake_bluetooth_device_client.h
index 04597e8..edc8ee6 100644
--- a/device/bluetooth/dbus/fake_bluetooth_device_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_device_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
#include <map>
#include <vector>
@@ -313,4 +313,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothDeviceClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
index 89fefcc..dc5196d 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
#include <string>
#include <vector>
@@ -191,4 +191,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
index eadde4b..a67d6c95 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
@@ -63,4 +63,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
index 80fdc49..e933664 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
#include <map>
#include <string>
@@ -100,4 +100,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
index 22e3ad2..7e53625 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
@@ -64,4 +64,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
index b181f07..32209df 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
#include <map>
#include <string>
@@ -97,4 +97,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattManagerClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
index 2950dda..d25e9d2 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
#include <string>
#include <vector>
@@ -103,4 +103,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
index 2e9fb2d..69b71fd 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
#include <string>
#include <vector>
@@ -44,4 +44,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_SERVICE_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_input_client.h b/device/bluetooth/dbus/fake_bluetooth_input_client.h
index a72be52..e7a3b0a 100644
--- a/device/bluetooth/dbus/fake_bluetooth_input_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_input_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
#include "base/callback.h"
#include "base/observer_list.h"
@@ -62,4 +62,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothInputClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
index fb5d62c..66df2c2 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
#include "base/bind.h"
#include "base/callback.h"
@@ -46,4 +46,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisementServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
index 308a703..e3090e6 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
#include <map>
#include <string>
@@ -76,4 +76,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisingManagerClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_client.h b/device/bluetooth/dbus/fake_bluetooth_media_client.h
index ff80b07..3d6d84e 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_media_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
#include <map>
@@ -74,4 +74,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
index 528a736..1f4383f 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
#include <vector>
@@ -54,4 +54,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaEndpointServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
index 0a0af40..8403c36 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
#include <map>
#include <string>
@@ -144,4 +144,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaTransportClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h b/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
index 8ed7826..62af0f1 100644
--- a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
+++ b/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
#include <map>
#include <string>
@@ -71,4 +71,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileManagerClient
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
index 6eefb80..1259927 100644
--- a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
+++ b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
#include "base/bind.h"
#include "base/callback.h"
@@ -57,4 +57,4 @@ class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileServiceProvider
} // namespace bluez
-#endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.cc b/device/bluetooth/test/mock_bluetooth_adapter.cc
index 4b060e5..26ae68b 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.cc
+++ b/device/bluetooth/test/mock_bluetooth_adapter.cc
@@ -27,7 +27,7 @@ MockBluetoothAdapter::MockBluetoothAdapter() {
MockBluetoothAdapter::~MockBluetoothAdapter() {}
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS)
void MockBluetoothAdapter::Shutdown() {
}
#endif
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.h b/device/bluetooth/test/mock_bluetooth_adapter.h
index c5427c2..775adee 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.h
+++ b/device/bluetooth/test/mock_bluetooth_adapter.h
@@ -37,7 +37,7 @@ class MockBluetoothAdapter : public BluetoothAdapter {
virtual bool IsInitialized() const { return true; }
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS)
void Shutdown() override;
#endif
MOCK_METHOD1(AddObserver, void(BluetoothAdapter::Observer*));
diff --git a/device/bluetooth/test/mock_bluetooth_advertisement.cc b/device/bluetooth/test/mock_bluetooth_advertisement.cc
index 746108a..ddba516 100644
--- a/device/bluetooth/test/mock_bluetooth_advertisement.cc
+++ b/device/bluetooth/test/mock_bluetooth_advertisement.cc
@@ -18,4 +18,4 @@ void MockBluetoothAdvertisement::Unregister(
success_callback.Run();
}
-} // namespace device
+} // namespace chromeos
diff --git a/device/bluetooth/test/mock_bluetooth_advertisement.h b/device/bluetooth/test/mock_bluetooth_advertisement.h
index 2079cf0..ddaeef4 100644
--- a/device/bluetooth/test/mock_bluetooth_advertisement.h
+++ b/device/bluetooth/test/mock_bluetooth_advertisement.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADVERTISEMENT_H_
-#define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADVERTISEMENT_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
#include "base/macros.h"
#include "device/bluetooth/bluetooth_advertisement.h"
@@ -24,6 +24,6 @@ class MockBluetoothAdvertisement : public device::BluetoothAdvertisement {
DISALLOW_COPY_AND_ASSIGN(MockBluetoothAdvertisement);
};
-} // namespace device
+} // namespace chromeos
-#endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADVERTISEMENT_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
diff --git a/device/device_tests.gyp b/device/device_tests.gyp
index 126fada..864a320 100644
--- a/device/device_tests.gyp
+++ b/device/device_tests.gyp
@@ -36,14 +36,20 @@
'battery/battery_status_manager_win_unittest.cc',
'battery/battery_status_service_unittest.cc',
'bluetooth/bluetooth_adapter_mac_unittest.mm',
+ 'bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc',
'bluetooth/bluetooth_adapter_unittest.cc',
'bluetooth/bluetooth_adapter_win_unittest.cc',
+ 'bluetooth/bluetooth_advertisement_chromeos_unittest.cc',
'bluetooth/bluetooth_advertisement_unittest.cc',
+ 'bluetooth/bluetooth_audio_sink_chromeos_unittest.cc',
+ 'bluetooth/bluetooth_chromeos_unittest.cc',
'bluetooth/bluetooth_device_unittest.cc',
'bluetooth/bluetooth_device_win_unittest.cc',
'bluetooth/bluetooth_discovery_filter_unittest.cc',
+ 'bluetooth/bluetooth_gatt_chromeos_unittest.cc',
'bluetooth/bluetooth_low_energy_win_unittest.cc',
'bluetooth/bluetooth_service_record_win_unittest.cc',
+ 'bluetooth/bluetooth_socket_chromeos_unittest.cc',
'bluetooth/bluetooth_task_manager_win_unittest.cc',
'bluetooth/bluetooth_uuid_unittest.cc',
'bluetooth/test/bluetooth_test.cc',
@@ -84,27 +90,15 @@
'conditions': [
['chromeos==1', {
'dependencies': [
+ '../build/linux/system.gyp:dbus',
'../chromeos/chromeos.gyp:chromeos_test_support',
'../chromeos/chromeos.gyp:chromeos_test_support_without_gmock',
+ '../dbus/dbus.gyp:dbus',
],
'sources!': [
'battery/battery_status_manager_linux_unittest.cc',
],
}],
- ['chromeos==1 or OS=="linux"', {
- 'dependencies': [
- '../build/linux/system.gyp:dbus',
- '../dbus/dbus.gyp:dbus',
- ],
- 'sources': [
- 'bluetooth/bluetooth_adapter_profile_bluez_unittest.cc',
- 'bluetooth/bluetooth_advertisement_bluez_unittest.cc',
- 'bluetooth/bluetooth_audio_sink_bluez_unittest.cc',
- 'bluetooth/bluetooth_bluez_unittest.cc',
- 'bluetooth/bluetooth_gatt_bluez_unittest.cc',
- 'bluetooth/bluetooth_socket_bluez_unittest.cc',
- ],
- }],
['OS=="android"', {
'dependencies!': [
'../tools/usb_gadget/usb_gadget.gyp:usb_gadget',
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router.cc b/extensions/browser/api/bluetooth/bluetooth_event_router.cc
index c55a23d..9302f7c 100644
--- a/extensions/browser/api/bluetooth/bluetooth_event_router.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_event_router.cc
@@ -59,9 +59,6 @@ BluetoothEventRouter::~BluetoothEventRouter() {
}
bool BluetoothEventRouter::IsBluetoothSupported() const {
-#if defined(OS_LINUX)
- return true;
-#endif
return adapter_.get() ||
device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable();
}