Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1506 base::RunLoop().RunUntilIdle(); | 1506 base::RunLoop().RunUntilIdle(); |
| 1507 SimulateGattNotifySessionStopped(characteristic1_); | 1507 SimulateGattNotifySessionStopped(characteristic1_); |
| 1508 base::RunLoop().RunUntilIdle(); | 1508 base::RunLoop().RunUntilIdle(); |
| 1509 | 1509 |
| 1510 // Check that the state is correct. | 1510 // Check that the state is correct. |
| 1511 EXPECT_TRUE("Did not crash!"); | 1511 EXPECT_TRUE("Did not crash!"); |
| 1512 EXPECT_FALSE(characteristic1_->IsNotifying()); | 1512 EXPECT_FALSE(characteristic1_->IsNotifying()); |
| 1513 } | 1513 } |
| 1514 #endif // defined(OS_ANDROID) | 1514 #endif // defined(OS_ANDROID) |
| 1515 | 1515 |
| 1516 #if defined(OS_ANDROID) | 1516 #if defined(OS_ANDROID) |
|
scheib
2017/01/20 18:00:59
Why only Android?
ortuno
2017/01/22 23:57:43
Added TODO for mac and windows.
| |
| 1517 // Tests that cancelling StopNotifySession works. | |
| 1518 TEST_F(BluetoothRemoteGattCharacteristicTest, StopNotifySession_Cancelled) { | |
| 1519 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( | |
| 1520 /* properties: NOTIFY */ 0x10, | |
| 1521 /* expected_config_descriptor_value: NOTIFY */ 1)); | |
| 1522 | |
| 1523 // Check that the session is correctly setup. | |
| 1524 std::string characteristic_identifier = characteristic1_->GetIdentifier(); | |
| 1525 EXPECT_EQ(characteristic_identifier, | |
| 1526 notify_sessions_[0]->GetCharacteristicIdentifier()); | |
| 1527 EXPECT_EQ(characteristic1_, notify_sessions_[0]->GetCharacteristic()); | |
| 1528 EXPECT_TRUE(notify_sessions_[0]->IsActive()); | |
| 1529 | |
| 1530 // Queue a Stop request. | |
| 1531 notify_sessions_[0]->Stop(GetStopNotifyCallback(Call::EXPECTED)); | |
| 1532 | |
| 1533 // Cancel Stop by deleting the device before Stop finishes. | |
| 1534 DeleteDevice(device_); // TODO(576906) delete only the characteristic. | |
| 1535 } | |
| 1536 #endif // defined(OS_ANDROID) | |
| 1537 | |
| 1538 #if defined(OS_ANDROID) | |
| 1517 // Tests that deleted sessions are stopped. | 1539 // Tests that deleted sessions are stopped. |
| 1518 TEST_F(BluetoothRemoteGattCharacteristicTest, StopNotifySession_AfterDeleted) { | 1540 TEST_F(BluetoothRemoteGattCharacteristicTest, StopNotifySession_AfterDeleted) { |
| 1519 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( | 1541 ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate( |
| 1520 /* properties: NOTIFY */ 0x10, | 1542 /* properties: NOTIFY */ 0x10, |
| 1521 /* expected_config_descriptor_value: NOTIFY */ 1)); | 1543 /* expected_config_descriptor_value: NOTIFY */ 1)); |
| 1522 | 1544 |
| 1523 // Check that the session is correctly setup | 1545 // Check that the session is correctly setup |
| 1524 std::string characteristic_identifier = characteristic1_->GetIdentifier(); | 1546 std::string characteristic_identifier = characteristic1_->GetIdentifier(); |
| 1525 EXPECT_EQ(characteristic_identifier, | 1547 EXPECT_EQ(characteristic_identifier, |
| 1526 notify_sessions_[0]->GetCharacteristicIdentifier()); | 1548 notify_sessions_[0]->GetCharacteristicIdentifier()); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2134 EXPECT_EQ(1u, characteristic1_->GetDescriptorsByUUID(id2).size()); | 2156 EXPECT_EQ(1u, characteristic1_->GetDescriptorsByUUID(id2).size()); |
| 2135 EXPECT_EQ(2u, characteristic2_->GetDescriptorsByUUID(id3).size()); | 2157 EXPECT_EQ(2u, characteristic2_->GetDescriptorsByUUID(id3).size()); |
| 2136 | 2158 |
| 2137 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id1).size()); | 2159 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id1).size()); |
| 2138 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id2).size()); | 2160 EXPECT_EQ(0u, characteristic2_->GetDescriptorsByUUID(id2).size()); |
| 2139 EXPECT_EQ(0u, characteristic1_->GetDescriptorsByUUID(id3).size()); | 2161 EXPECT_EQ(0u, characteristic1_->GetDescriptorsByUUID(id3).size()); |
| 2140 } | 2162 } |
| 2141 #endif // defined(OS_ANDROID) || defined(OS_WIN) | 2163 #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| 2142 | 2164 |
| 2143 } // namespace device | 2165 } // namespace device |
| OLD | NEW |