| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 6 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 7 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 9 #include "dbus/object_path.h" | 12 #include "dbus/object_path.h" |
| 10 #include "device/bluetooth/bluetooth_adapter.h" | 13 #include "device/bluetooth/bluetooth_adapter.h" |
| 11 #include "device/bluetooth/bluetooth_adapter_bluez.h" | 14 #include "device/bluetooth/bluetooth_adapter_bluez.h" |
| 12 #include "device/bluetooth/bluetooth_adapter_factory.h" | 15 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 13 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device.h" |
| 14 #include "device/bluetooth/bluetooth_device_bluez.h" | 17 #include "device/bluetooth/bluetooth_device_bluez.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 109 } |
| 107 | 110 |
| 108 void DisplayPinCode(BluetoothDevice* device, | 111 void DisplayPinCode(BluetoothDevice* device, |
| 109 const std::string& pincode) override { | 112 const std::string& pincode) override { |
| 110 ++call_count_; | 113 ++call_count_; |
| 111 ++display_pincode_count_; | 114 ++display_pincode_count_; |
| 112 last_pincode_ = pincode; | 115 last_pincode_ = pincode; |
| 113 QuitMessageLoop(); | 116 QuitMessageLoop(); |
| 114 } | 117 } |
| 115 | 118 |
| 116 void DisplayPasskey(BluetoothDevice* device, uint32 passkey) override { | 119 void DisplayPasskey(BluetoothDevice* device, uint32_t passkey) override { |
| 117 ++call_count_; | 120 ++call_count_; |
| 118 ++display_passkey_count_; | 121 ++display_passkey_count_; |
| 119 last_passkey_ = passkey; | 122 last_passkey_ = passkey; |
| 120 QuitMessageLoop(); | 123 QuitMessageLoop(); |
| 121 } | 124 } |
| 122 | 125 |
| 123 void KeysEntered(BluetoothDevice* device, uint32 entered) override { | 126 void KeysEntered(BluetoothDevice* device, uint32_t entered) override { |
| 124 ++call_count_; | 127 ++call_count_; |
| 125 ++keys_entered_count_; | 128 ++keys_entered_count_; |
| 126 last_entered_ = entered; | 129 last_entered_ = entered; |
| 127 QuitMessageLoop(); | 130 QuitMessageLoop(); |
| 128 } | 131 } |
| 129 | 132 |
| 130 void ConfirmPasskey(BluetoothDevice* device, uint32 passkey) override { | 133 void ConfirmPasskey(BluetoothDevice* device, uint32_t passkey) override { |
| 131 ++call_count_; | 134 ++call_count_; |
| 132 ++confirm_passkey_count_; | 135 ++confirm_passkey_count_; |
| 133 last_passkey_ = passkey; | 136 last_passkey_ = passkey; |
| 134 QuitMessageLoop(); | 137 QuitMessageLoop(); |
| 135 } | 138 } |
| 136 | 139 |
| 137 void AuthorizePairing(BluetoothDevice* device) override { | 140 void AuthorizePairing(BluetoothDevice* device) override { |
| 138 ++call_count_; | 141 ++call_count_; |
| 139 ++authorize_pairing_count_; | 142 ++authorize_pairing_count_; |
| 140 QuitMessageLoop(); | 143 QuitMessageLoop(); |
| 141 } | 144 } |
| 142 | 145 |
| 143 int call_count_; | 146 int call_count_; |
| 144 int request_pincode_count_; | 147 int request_pincode_count_; |
| 145 int request_passkey_count_; | 148 int request_passkey_count_; |
| 146 int display_pincode_count_; | 149 int display_pincode_count_; |
| 147 int display_passkey_count_; | 150 int display_passkey_count_; |
| 148 int keys_entered_count_; | 151 int keys_entered_count_; |
| 149 int confirm_passkey_count_; | 152 int confirm_passkey_count_; |
| 150 int authorize_pairing_count_; | 153 int authorize_pairing_count_; |
| 151 uint32 last_passkey_; | 154 uint32_t last_passkey_; |
| 152 uint32 last_entered_; | 155 uint32_t last_entered_; |
| 153 std::string last_pincode_; | 156 std::string last_pincode_; |
| 154 | 157 |
| 155 private: | 158 private: |
| 156 // Some tests use a message loop since background processing is simulated; | 159 // Some tests use a message loop since background processing is simulated; |
| 157 // break out of those loops. | 160 // break out of those loops. |
| 158 void QuitMessageLoop() { | 161 void QuitMessageLoop() { |
| 159 if (base::MessageLoop::current() && | 162 if (base::MessageLoop::current() && |
| 160 base::MessageLoop::current()->is_running()) { | 163 base::MessageLoop::current()->is_running()) { |
| 161 base::MessageLoop::current()->QuitWhenIdle(); | 164 base::MessageLoop::current()->QuitWhenIdle(); |
| 162 } | 165 } |
| (...skipping 4123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4286 adapter_->Shutdown(); | 4289 adapter_->Shutdown(); |
| 4287 adapter_chrome_os->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); | 4290 adapter_chrome_os->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); |
| 4288 | 4291 |
| 4289 // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError, | 4292 // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError, |
| 4290 // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession. | 4293 // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession. |
| 4291 EXPECT_EQ(0, callback_count_); | 4294 EXPECT_EQ(0, callback_count_); |
| 4292 EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_); | 4295 EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_); |
| 4293 } | 4296 } |
| 4294 | 4297 |
| 4295 } // namespace bluez | 4298 } // namespace bluez |
| OLD | NEW |