VTS: Check return status of initialize and close
authorJack He <siyuanh@google.com>
Fri, 5 Oct 2018 01:42:37 +0000 (18:42 -0700)
committerJack He <siyuanh@google.com>
Tue, 9 Oct 2018 00:06:06 +0000 (17:06 -0700)
Test: atest VtsHalBluetoothV1_0TargetTest
Change-Id: I579c4d5f4c6e24b358c67c3dc8a8a8ceb1f936e2

bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp

index bf8b547f99a2b1f23a46818c042295751b6e4c81..439c5fb1422464963238da865075fda545d63355 100644 (file)
@@ -170,8 +170,9 @@ class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {
     acl_cb_count = 0;
     sco_cb_count = 0;
 
-    ASSERT_EQ(initialized, false);
-    bluetooth->initialize(bluetooth_cb);
+    ASSERT_FALSE(initialized);
+    // Should not be checked in production code
+    ASSERT_TRUE(bluetooth->initialize(bluetooth_cb).isOk());
 
     bluetooth_cb->SetWaitTimeout(kCallbackNameInitializationComplete,
                                  WAIT_FOR_INIT_TIMEOUT);
@@ -186,15 +187,16 @@ class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {
         bluetooth_cb->WaitForCallback(kCallbackNameInitializationComplete)
             .no_timeout);
 
-    ASSERT_EQ(initialized, true);
+    ASSERT_TRUE(initialized);
   }
 
   virtual void TearDown() override {
-    bluetooth->close();
-    handle_no_ops();
-    EXPECT_EQ(static_cast<size_t>(0), event_queue.size());
-    EXPECT_EQ(static_cast<size_t>(0), sco_queue.size());
-    EXPECT_EQ(static_cast<size_t>(0), acl_queue.size());
+      // Should not be checked in production code
+      ASSERT_TRUE(bluetooth->close().isOk());
+      handle_no_ops();
+      EXPECT_EQ(static_cast<size_t>(0), event_queue.size());
+      EXPECT_EQ(static_cast<size_t>(0), sco_queue.size());
+      EXPECT_EQ(static_cast<size_t>(0), acl_queue.size());
   }
 
   void setBufferSizes();