Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de3a24f6 authored by Hui Peng's avatar Hui Peng
Browse files

Add a test bta_create_dip_sdp_record

Add a test to verify that zero size for boolean
is not accepted.

Bug: 303497884
Test: Test: atest net_test_stack_a2dp_native
Flag: EXEMPT, test only
Change-Id: I8bb2c21518dee6daba988ee14045403939be59c1
parent e65a8cc0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -194,6 +194,16 @@ TEST_F(BtaDipTest, test_invalid_size_checks) {
  ASSERT_EQ(record.dip.product, 0);
  ASSERT_EQ(record.dip.version, 0);
  ASSERT_EQ(record.dip.primary_record, true);

  // a size zero for boolean won't be accepted
  g_attr_vendor_product_primary_record.attr_len_type =
      (BOOLEAN_DESC_TYPE << 12) | 0;

  record = {};

  g_attr_vendor_product_primary_record.attr_value.v.u8 = 1;
  bluetooth::testing::bta_create_dip_sdp_record(&record, &g_rec);
  ASSERT_EQ(record.dip.primary_record, false);
}