OSDN Git Service

gd: gd/hci/le_address_manager_test::ASSERT_LOG when command queue is empty
authorChris Manton <cmanton@google.com>
Tue, 3 Nov 2020 18:53:33 +0000 (10:53 -0800)
committerChris Manton <cmanton@google.com>
Wed, 4 Nov 2020 18:30:05 +0000 (10:30 -0800)
Returning an empty vector causes debug headaches

Bug: 171568335
Test: CtsVerifier
Test: gd/cert/run --host
Test: atest --host bluetooth_test_gd
Tag: #refactor
Change-Id: I9d5f2ecacfe2bbcea7a333d3701523a6d9cfcaae

gd/hci/le_address_manager_test.cc

index 9d000e8..99fe8bc 100644 (file)
@@ -76,10 +76,8 @@ class TestHciLayer : public HciLayer {
       auto result = command_future_->wait_for(std::chrono::milliseconds(1000));
       EXPECT_NE(std::future_status::timeout, result);
     }
-    if (command_queue_.empty()) {
-      return ConnectionManagementCommandView::Create(
-          CommandPacketView::Create(PacketView<kLittleEndian>(std::make_shared<std::vector<uint8_t>>())));
-    }
+    ASSERT_LOG(
+        !command_queue_.empty(), "Expecting command %s but command queue was empty", OpCodeText(op_code).c_str());
     CommandPacketView command_packet_view = GetLastCommand();
     EXPECT_TRUE(command_packet_view.IsValid());
     EXPECT_EQ(command_packet_view.GetOpCode(), op_code);