OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "device/bluetooth/bluetooth_adapter.h" | 8 #include "device/bluetooth/bluetooth_adapter.h" |
9 #include "device/bluetooth/bluetooth_device.h" | 9 #include "device/bluetooth/bluetooth_device.h" |
10 #include "device/bluetooth/bluetooth_discovery_session.h" | 10 #include "device/bluetooth/bluetooth_discovery_session.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 InitWithFakeAdapter(); | 437 InitWithFakeAdapter(); |
438 EXPECT_EQ(adapter_->GetAddress(), "A1:B2:C3:D4:E5:F6"); | 438 EXPECT_EQ(adapter_->GetAddress(), "A1:B2:C3:D4:E5:F6"); |
439 EXPECT_EQ(adapter_->GetName(), "FakeBluetoothAdapter"); | 439 EXPECT_EQ(adapter_->GetName(), "FakeBluetoothAdapter"); |
440 EXPECT_TRUE(adapter_->IsPresent()); | 440 EXPECT_TRUE(adapter_->IsPresent()); |
441 EXPECT_TRUE(adapter_->IsPowered()); | 441 EXPECT_TRUE(adapter_->IsPowered()); |
442 EXPECT_FALSE(adapter_->IsDiscoverable()); | 442 EXPECT_FALSE(adapter_->IsDiscoverable()); |
443 EXPECT_FALSE(adapter_->IsDiscovering()); | 443 EXPECT_FALSE(adapter_->IsDiscovering()); |
444 } | 444 } |
445 #endif | 445 #endif |
446 | 446 |
447 // TODO(scheib): Enable BluetoothTest fixture tests on all platforms. | |
448 #if defined(OS_ANDROID) | |
449 TEST_F(BluetoothTest, DiscoverySession) { | |
450 InitWithFakeAdapter(); | |
451 EXPECT_FALSE(adapter_->IsDiscovering()); | |
452 | |
453 adapter_->StartDiscoverySession(GetDiscoverySessionCallback(), | |
454 GetErrorCallback()); | |
455 base::RunLoop().RunUntilIdle(); | |
456 EXPECT_EQ(1, callback_count_--); | |
457 EXPECT_EQ(0, error_callback_count_); | |
458 EXPECT_TRUE(adapter_->IsDiscovering()); | |
459 ASSERT_EQ((size_t)1, discovery_sessions_.size()); | |
460 EXPECT_TRUE(discovery_sessions_[0]->IsActive()); | |
461 | |
462 discovery_sessions_[0]->Stop(GetCallback(), GetErrorCallback()); | |
463 base::RunLoop().RunUntilIdle(); | |
464 EXPECT_EQ(1, callback_count_--); | |
465 EXPECT_EQ(0, error_callback_count_); | |
466 EXPECT_FALSE(adapter_->IsDiscovering()); | |
467 EXPECT_FALSE(discovery_sessions_[0]->IsActive()); | |
468 } | |
469 #endif | |
armansito
2015/06/30 20:52:14
#endif // defined(OS_ANDROID)
| |
470 | |
447 } // namespace device | 471 } // namespace device |
OLD | NEW |