Index: device/bluetooth/bluetooth_experimental_chromeos_unittest.cc |
diff --git a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc b/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc |
index 7bd7c25fd3582280afff2caef24636298934ad15..4b855f1b912fd37c41bb1a308cef6a5985053e42 100644 |
--- a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc |
+++ b/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc |
@@ -8,6 +8,7 @@ |
#include "chromeos/chromeos_switches.h" |
#include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
#include "chromeos/dbus/fake_bluetooth_device_client.h" |
+#include "chromeos/dbus/fake_bluetooth_input_client.h" |
#include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" |
#include "dbus/object_path.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
@@ -209,6 +210,8 @@ class BluetoothExperimentalChromeOSTest : public testing::Test { |
mock_dbus_thread_manager_->fake_bluetooth_adapter_client(); |
fake_bluetooth_device_client_ = |
mock_dbus_thread_manager_->fake_bluetooth_device_client(); |
+ fake_bluetooth_input_client_ = |
+ mock_dbus_thread_manager_->fake_bluetooth_input_client(); |
callback_count_ = 0; |
error_callback_count_ = 0; |
@@ -306,6 +309,7 @@ class BluetoothExperimentalChromeOSTest : public testing::Test { |
protected: |
FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; |
FakeBluetoothDeviceClient* fake_bluetooth_device_client_; |
+ FakeBluetoothInputClient* fake_bluetooth_input_client_; |
MockDBusThreadManagerWithoutGMock* mock_dbus_thread_manager_; |
scoped_refptr<BluetoothAdapter> adapter_; |
@@ -742,9 +746,11 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceProperties) { |
EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType()); |
EXPECT_TRUE(devices[0]->IsPaired()); |
EXPECT_FALSE(devices[0]->IsConnected()); |
- EXPECT_FALSE(devices[0]->IsConnectable()); |
EXPECT_FALSE(devices[0]->IsConnecting()); |
+ // Non HID devices are always connectable. |
+ EXPECT_TRUE(devices[0]->IsConnectable()); |
+ |
BluetoothDevice::ServiceList uuids = devices[0]->GetServices(); |
ASSERT_EQ(2U, uuids.size()); |
EXPECT_EQ(uuids[0], "00001800-0000-1000-8000-00805f9b34fb"); |
@@ -1114,6 +1120,8 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleMouse) { |
EXPECT_TRUE(device->IsConnecting()); |
message_loop.Run(); |
+ fake_bluetooth_input_client_->AddInputDevice( |
+ dbus::ObjectPath(FakeBluetoothDeviceClient::kAppleMousePath)); |
keybuk
2013/04/18 20:50:25
This should be handled by the FakeBluetoothDeviceC
deymo
2013/04/18 22:19:55
Done. This is emulated by FakeBluetoothDeviceClien
|
EXPECT_EQ(1, callback_count_); |
EXPECT_EQ(0, error_callback_count_); |
@@ -1126,6 +1134,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleMouse) { |
EXPECT_FALSE(device->IsConnecting()); |
EXPECT_TRUE(device->IsPaired()); |
+ EXPECT_TRUE(device->IsConnectable()); |
// Pairing dialog should be dismissed |
EXPECT_EQ(1, pairing_delegate.call_count_); |
@@ -1169,6 +1178,8 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleKeyboard) { |
EXPECT_TRUE(device->IsConnecting()); |
message_loop.Run(); |
+ fake_bluetooth_input_client_->AddInputDevice( |
+ dbus::ObjectPath(FakeBluetoothDeviceClient::kAppleKeyboardPath)); |
keybuk
2013/04/18 20:50:25
ditto
|
EXPECT_EQ(1, callback_count_); |
EXPECT_EQ(0, error_callback_count_); |
@@ -1181,6 +1192,7 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairAppleKeyboard) { |
EXPECT_FALSE(device->IsConnecting()); |
EXPECT_TRUE(device->IsPaired()); |
+ EXPECT_TRUE(device->IsConnectable()); |
// Pairing dialog should be dismissed |
EXPECT_EQ(2, pairing_delegate.call_count_); |
@@ -1226,6 +1238,8 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) { |
// TODO(keybuk): verify we get typing notifications |
message_loop.Run(); |
+ fake_bluetooth_input_client_->AddInputDevice( |
+ dbus::ObjectPath(FakeBluetoothDeviceClient::kMotorolaKeyboardPath)); |
EXPECT_EQ(1, callback_count_); |
EXPECT_EQ(0, error_callback_count_); |
@@ -1239,6 +1253,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) { |
EXPECT_TRUE(device->IsPaired()); |
+ // Fake MotorolaKeyboard is not connectable. |
+ EXPECT_FALSE(device->IsConnectable()); |
+ |
// Pairing dialog should be dismissed |
EXPECT_EQ(2, pairing_delegate.call_count_); |
EXPECT_EQ(1, pairing_delegate.dismiss_count_); |
@@ -1294,6 +1311,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairSonyHeadphones) { |
EXPECT_TRUE(device->IsPaired()); |
+ // Non HID devices are always connectable. |
+ EXPECT_TRUE(device->IsConnectable()); |
+ |
// Pairing dialog should be dismissed |
EXPECT_EQ(2, pairing_delegate.call_count_); |
EXPECT_EQ(1, pairing_delegate.dismiss_count_); |
@@ -1350,6 +1370,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairPhone) { |
EXPECT_TRUE(device->IsPaired()); |
+ // Non HID devices are always connectable. |
+ EXPECT_TRUE(device->IsConnectable()); |
+ |
// Pairing dialog should be dismissed |
EXPECT_EQ(2, pairing_delegate.call_count_); |
EXPECT_EQ(1, pairing_delegate.dismiss_count_); |
@@ -1407,6 +1430,9 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairWeirdDevice) { |
EXPECT_TRUE(device->IsPaired()); |
+ // Non HID devices are always connectable. |
+ EXPECT_TRUE(device->IsConnectable()); |
+ |
// Pairing dialog should be dismissed |
EXPECT_EQ(2, pairing_delegate.call_count_); |
EXPECT_EQ(1, pairing_delegate.dismiss_count_); |