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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 message_loop_.Run(); | 699 message_loop_.Run(); |
700 EXPECT_EQ(2, callback_count_); | 700 EXPECT_EQ(2, callback_count_); |
701 EXPECT_EQ(0, error_callback_count_); | 701 EXPECT_EQ(0, error_callback_count_); |
702 callback_count_ = 0; | 702 callback_count_ = 0; |
703 | 703 |
704 ASSERT_TRUE(adapter_->IsPowered()); | 704 ASSERT_TRUE(adapter_->IsPowered()); |
705 ASSERT_TRUE(adapter_->IsDiscovering()); | 705 ASSERT_TRUE(adapter_->IsDiscovering()); |
706 ASSERT_EQ((size_t)1, discovery_sessions_.size()); | 706 ASSERT_EQ((size_t)1, discovery_sessions_.size()); |
707 ASSERT_TRUE(discovery_sessions_[0]->IsActive()); | 707 ASSERT_TRUE(discovery_sessions_[0]->IsActive()); |
708 | 708 |
709 // First device to appear. | 709 // First two devices to appear. |
710 message_loop_.Run(); | 710 message_loop_.Run(); |
711 | 711 |
712 EXPECT_EQ(1, observer.device_added_count_); | 712 EXPECT_EQ(2, observer.device_added_count_); |
713 EXPECT_EQ(FakeBluetoothDeviceClient::kLegacyAutopairAddress, | 713 EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress, |
714 observer.last_device_address_); | 714 observer.last_device_address_); |
715 | 715 |
716 // Next we should get another two devices... | 716 // Next we should get another two devices... |
717 message_loop_.Run(); | 717 message_loop_.Run(); |
718 EXPECT_EQ(3, observer.device_added_count_); | 718 EXPECT_EQ(4, observer.device_added_count_); |
719 | 719 |
720 // Okay, let's run forward until a device is actually removed... | 720 // Okay, let's run forward until a device is actually removed... |
721 while (!observer.device_removed_count_) | 721 while (!observer.device_removed_count_) |
722 message_loop_.Run(); | 722 message_loop_.Run(); |
723 | 723 |
724 EXPECT_EQ(1, observer.device_removed_count_); | 724 EXPECT_EQ(1, observer.device_removed_count_); |
725 EXPECT_EQ(FakeBluetoothDeviceClient::kVanishingDeviceAddress, | 725 EXPECT_EQ(FakeBluetoothDeviceClient::kVanishingDeviceAddress, |
726 observer.last_device_address_); | 726 observer.last_device_address_); |
727 } | 727 } |
728 | 728 |
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 // Unknown vendor specification identifier. | 3161 // Unknown vendor specification identifier. |
3162 properties->modalias.ReplaceValue("chrome:v00E0p2400d0400"); | 3162 properties->modalias.ReplaceValue("chrome:v00E0p2400d0400"); |
3163 | 3163 |
3164 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); | 3164 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); |
3165 EXPECT_EQ(0, device->GetVendorID()); | 3165 EXPECT_EQ(0, device->GetVendorID()); |
3166 EXPECT_EQ(0, device->GetProductID()); | 3166 EXPECT_EQ(0, device->GetProductID()); |
3167 EXPECT_EQ(0, device->GetDeviceID()); | 3167 EXPECT_EQ(0, device->GetDeviceID()); |
3168 } | 3168 } |
3169 | 3169 |
3170 } // namespace chromeos | 3170 } // namespace chromeos |
OLD | NEW |