[UTC][bluetooth][Non-ACR][Add the support checking for avrcp]
authorTaejin Woo <tt.woo@samsung.com>
Tue, 7 Jun 2016 07:56:25 +0000 (16:56 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Wed, 8 Jun 2016 01:42:46 +0000 (10:42 +0900)
Change-Id: I6fa7e794be27899933049b889ad85aa0d6d758dd
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
src/utc/bluetooth/utc_bluetooth_audio_negative.c
src/utc/bluetooth/utc_bluetooth_audio_positive.c [changed mode: 0755->0644]

index a253fa9..057d13c 100755 (executable)
@@ -31,6 +31,7 @@ static bool call_supported = false;
  * @function           utc_bluetooth_bt_audio_negative_startup
  * @description        check if bluetooth is supported, initialize bluetooth.
  *                             check if media or call feature is supported, then initialize the audio profiles.
+ * @scenario           initializes the bluetooth API and audio profiles, this needs to be called before each test.
  * @parameter          NA
  * @return                     NA
  */
@@ -51,7 +52,7 @@ void utc_bluetooth_bt_audio_negative_startup(void)
     system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.audio.call", &call_supported);
 #endif
 
-    if(bt_supported) {
+    if (bt_supported) {
         startup_flag = BT_ERROR_NONE;
         ret = bt_initialize();
         if(BT_ERROR_NONE != ret) {
@@ -61,7 +62,7 @@ void utc_bluetooth_bt_audio_negative_startup(void)
             return;
         }
 
-        if(media_supported || call_supported) {
+        if (media_supported || call_supported) {
             ret = bt_audio_initialize();
             if(BT_ERROR_NONE != ret) {
                 fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
@@ -77,15 +78,17 @@ void utc_bluetooth_bt_audio_negative_startup(void)
  * @function           utc_bluetooth_bt_audio_negative_cleanup
  * @description        check if media or call feature is supported, then de-initialize the audio profiles
  *                             check if bluetooth is supported, de-initialize bluetooth.
+ * @scenario           de-initializes the audio profiles and Rrelease all resources of bluetooth, this needs to be called after each test.
+
  * @parameter          NA
  * @return                     NA
  */
 void utc_bluetooth_bt_audio_negative_cleanup(void)
 {
-    if(media_supported || call_supported)
+    if (media_supported || call_supported)
         bt_audio_deinitialize();
 
-    if(bt_supported)
+    if (bt_supported)
         bt_deinitialize();
 }
 
@@ -99,11 +102,10 @@ void utc_bluetooth_bt_audio_negative_cleanup(void)
  */
 int utc_bluetooth_bt_audio_connect_n(void)
 {
-    if(media_supported) {
+    if (media_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_deinitialize();
-        assert_eq(ret,BT_ERROR_NONE);
 
         ret = bt_audio_connect("DummyAddress", BT_AUDIO_PROFILE_TYPE_A2DP);
         assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -125,11 +127,10 @@ int utc_bluetooth_bt_audio_connect_n(void)
  */
 int utc_bluetooth_bt_audio_disconnect_n(void)
 {
-    if(media_supported) {
+    if (media_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_deinitialize();
-        assert_eq(ret,BT_ERROR_NONE);
 
         ret = bt_audio_disconnect(NULL, BT_AUDIO_PROFILE_TYPE_A2DP);
         assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -150,11 +151,10 @@ int utc_bluetooth_bt_audio_disconnect_n(void)
  */
 int utc_bluetooth_bt_audio_set_connection_state_changed_cb_n(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_deinitialize();
-        assert_eq(ret,BT_ERROR_NONE);
 
         ret = bt_audio_set_connection_state_changed_cb(NULL, NULL);
         assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -175,7 +175,7 @@ int utc_bluetooth_bt_audio_set_connection_state_changed_cb_n(void)
  */
 int utc_bluetooth_bt_audio_set_connection_state_changed_cb_n1(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_audio_set_connection_state_changed_cb(NULL, NULL);
@@ -197,11 +197,10 @@ int utc_bluetooth_bt_audio_set_connection_state_changed_cb_n1(void)
  */
 int utc_bluetooth_bt_audio_deinitialize_n(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_deinitialize();
-        assert_eq(ret, BT_ERROR_NONE);
 
         ret = bt_audio_deinitialize();
         assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -222,11 +221,10 @@ int utc_bluetooth_bt_audio_deinitialize_n(void)
  */
 int utc_bluetooth_bt_audio_initialize_n(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_deinitialize();
-        assert_eq(ret, BT_ERROR_NONE);
 
         ret = bt_audio_initialize();
         assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -247,11 +245,10 @@ int utc_bluetooth_bt_audio_initialize_n(void)
  */
 int utc_bluetooth_bt_audio_unset_connection_state_changed_cb_n(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_deinitialize();
-        assert_eq(ret, BT_ERROR_NONE);
 
         ret = bt_audio_unset_connection_state_changed_cb();
         assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -279,13 +276,17 @@ static void __bt_avrcp_equalizer_state_changed_cb(bt_avrcp_equalizer_state_e equ
  */
 int utc_bluetooth_bt_avrcp_set_equalizer_state_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_set_equalizer_state_changed_cb(__bt_avrcp_equalizer_state_changed_cb, NULL);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_set_equalizer_state_changed_cb(__bt_avrcp_equalizer_state_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_set_equalizer_state_changed_cb(__bt_avrcp_equalizer_state_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
     return 0;
 }
@@ -304,13 +305,17 @@ static void __bt_avrcp_repeat_mode_changed_cb(bt_avrcp_repeat_mode_e repeat, voi
  */
 int utc_bluetooth_bt_avrcp_set_repeat_mode_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_repeat_mode_changed_cb, NULL);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_repeat_mode_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_repeat_mode_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -329,13 +334,17 @@ static void __bt_avrcp_scan_mode_changed_cb(bt_avrcp_scan_mode_e scan, void *use
  */
 int utc_bluetooth_bt_avrcp_set_scan_mode_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_set_scan_mode_changed_cb(__bt_avrcp_scan_mode_changed_cb, NULL);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_set_scan_mode_changed_cb(__bt_avrcp_scan_mode_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_set_scan_mode_changed_cb(__bt_avrcp_scan_mode_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -354,13 +363,17 @@ static void __bt_avrcp_set_shuffle_mode_changed_cb(bt_avrcp_scan_mode_e scan, vo
  */
 int utc_bluetooth_bt_avrcp_set_shuffle_mode_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_scan_mode_changed_cb, NULL);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_set_shuffle_mode_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_set_shuffle_mode_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -374,14 +387,17 @@ int utc_bluetooth_bt_avrcp_set_shuffle_mode_changed_cb_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_deinitialize_n(void)
 {
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       assert_eq(startup_flag, BT_ERROR_NONE);
-
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_scan_mode_changed_cb, NULL);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_deinitialize();
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_deinitialize();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -400,13 +416,17 @@ static void __bt_avrcp_target_connection_state_changed_cb(bool connected, const
  */
 int utc_bluetooth_bt_avrcp_target_initialize_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_target_initialize(__bt_avrcp_target_connection_state_changed_cb, NULL);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_initialize(__bt_avrcp_target_connection_state_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_initialize(__bt_avrcp_target_connection_state_changed_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -420,14 +440,17 @@ int utc_bluetooth_bt_avrcp_target_initialize_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_equalizer_state_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
-
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_avrcp_target_notify_equalizer_state(0x01);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_deinitialize();
 
+               ret = bt_avrcp_target_notify_equalizer_state(0x01);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_equalizer_state(0x01);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
        return 0;
 }
 
@@ -440,13 +463,17 @@ int utc_bluetooth_bt_avrcp_target_notify_equalizer_state_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_player_state_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_target_notify_equalizer_state(0x01);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_notify_player_state(0x01);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_player_state(0x01);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -460,13 +487,17 @@ int utc_bluetooth_bt_avrcp_target_notify_player_state_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_position_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_target_notify_position(0x01);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_notify_position(0x01);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_position(0x01);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -480,14 +511,17 @@ int utc_bluetooth_bt_avrcp_target_notify_position_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_repeat_mode_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
-
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_avrcp_target_notify_repeat_mode(0x01);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_deinitialize();
 
+               ret = bt_avrcp_target_notify_repeat_mode(0x01);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_repeat_mode(0x01);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
        return 0;
 }
 
@@ -500,13 +534,17 @@ int utc_bluetooth_bt_avrcp_target_notify_repeat_mode_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_scan_mode_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_target_notify_scan_mode(0x01);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_notify_scan_mode(0x01);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_scan_mode(0x01);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -520,13 +558,17 @@ int utc_bluetooth_bt_avrcp_target_notify_scan_mode_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_shuffle_mode_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_target_notify_shuffle_mode(0x01);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_notify_shuffle_mode(0x01);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_shuffle_mode(0x01);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -540,13 +582,17 @@ int utc_bluetooth_bt_avrcp_target_notify_shuffle_mode_n(void)
  */
 int utc_bluetooth_bt_avrcp_target_notify_track_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_target_notify_track("title", "artist", "album", "genre", 5, 20, 2);
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_target_notify_track("title", "artist", "album", "genre", 5, 20, 2);
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_target_notify_track("title", "artist", "album", "genre", 5, 20, 2);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -561,13 +607,17 @@ int utc_bluetooth_bt_avrcp_target_notify_track_n(void)
  */
 int utc_bluetooth_bt_avrcp_unset_equalizer_state_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_unset_equalizer_state_changed_cb();
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_unset_equalizer_state_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_unset_equalizer_state_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -582,13 +632,17 @@ int utc_bluetooth_bt_avrcp_unset_equalizer_state_changed_cb_n(void)
  */
 int utc_bluetooth_bt_avrcp_unset_repeat_mode_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_unset_repeat_mode_changed_cb();
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_unset_repeat_mode_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_unset_repeat_mode_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -603,13 +657,17 @@ int utc_bluetooth_bt_avrcp_unset_repeat_mode_changed_cb_n(void)
  */
 int utc_bluetooth_bt_avrcp_unset_scan_mode_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_unset_scan_mode_changed_cb();
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_unset_scan_mode_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_unset_scan_mode_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -624,13 +682,17 @@ int utc_bluetooth_bt_avrcp_unset_scan_mode_changed_cb_n(void)
  */
 int utc_bluetooth_bt_avrcp_unset_shuffle_mode_changed_cb_n(void)
 {
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_deinitialize();
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_deinitialize();
 
-       ret = bt_avrcp_unset_shuffle_mode_changed_cb();
-       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+               ret = bt_avrcp_unset_shuffle_mode_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+       } else {
+               ret = bt_avrcp_unset_shuffle_mode_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
 
        return 0;
 }
@@ -643,11 +705,10 @@ int utc_bluetooth_bt_avrcp_unset_shuffle_mode_changed_cb_n(void)
  */
 int utc_bluetooth_bt_ag_open_sco_n(void)
 {
-       if(call_supported) {
+       if (call_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                ret = bt_deinitialize();
-               assert_eq(ret, BT_ERROR_NONE);
 
                ret = bt_ag_open_sco();
                assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -666,11 +727,10 @@ int utc_bluetooth_bt_ag_open_sco_n(void)
  */
 int utc_bluetooth_bt_ag_close_sco_n(void)
 {
-       if(call_supported) {
+       if (call_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                ret = bt_deinitialize();
-               assert_eq(ret, BT_ERROR_NONE);
 
                ret = bt_ag_close_sco();
                assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -691,11 +751,10 @@ int utc_bluetooth_bt_ag_is_sco_opened_n(void)
 {
        bool is_sco = false;
 
-       if(call_supported) {
+       if (call_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                ret = bt_deinitialize();
-               assert_eq(ret, BT_ERROR_NONE);
 
                ret = bt_ag_is_sco_opened(&is_sco);
                assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -716,11 +775,10 @@ int utc_bluetooth_bt_ag_notify_voice_recognition_state_n(void)
 {
        bool state = false;
 
-       if(call_supported) {
+       if (call_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                ret = bt_deinitialize();
-               assert_eq(ret, BT_ERROR_NONE);
 
                ret = bt_ag_notify_voice_recognition_state(state);
                assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
@@ -744,11 +802,10 @@ static void __bt_ag_sco_state_changed_cb(int result, bool opened, void *user_dat
  */
 int utc_bluetooth_bt_ag_set_sco_state_changed_cb_n(void)
 {
-       if(call_supported) {
+       if (call_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                ret = bt_deinitialize();
-               assert_eq(ret, BT_ERROR_NONE);
 
                ret = bt_ag_set_sco_state_changed_cb(
                                __bt_ag_sco_state_changed_cb, NULL);
@@ -769,11 +826,10 @@ int utc_bluetooth_bt_ag_set_sco_state_changed_cb_n(void)
  */
 int utc_bluetooth_bt_ag_unset_sco_state_changed_cb_n(void)
 {
-       if(call_supported) {
+       if (call_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                ret = bt_deinitialize();
-               assert_eq(ret, BT_ERROR_NONE);
 
                ret = bt_ag_unset_sco_state_changed_cb();
                assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
old mode 100755 (executable)
new mode 100644 (file)
index ad330bc..5415bca
@@ -65,7 +65,7 @@ void utc_bluetooth_audio_positive_startup(void)
     system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.audio.call", &call_supported);
 #endif
 
-    if(bt_supported) {
+    if (bt_supported) {
         startup_flag = BT_ERROR_NONE;
         ret = bt_initialize();
         if(BT_ERROR_NONE != ret) {
@@ -75,7 +75,7 @@ void utc_bluetooth_audio_positive_startup(void)
             return;
         }
 
-        if(media_supported || call_supported) {
+        if (media_supported || call_supported) {
             ret = bt_audio_initialize();
             if(BT_ERROR_NONE != ret) {
                 fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
@@ -96,16 +96,16 @@ void utc_bluetooth_audio_positive_startup(void)
 
 /**
  * @function            utc_bluetooth_audio_positive_cleanup
- * @description         Called after each test
+ * @description         Called before each test
  * @parameter           NA
  * @return              NA
  */
 void utc_bluetooth_audio_positive_cleanup(void)
 {
-    if(media_supported || call_supported)
+    if (media_supported || call_supported)
         bt_audio_deinitialize();
 
-    if(bt_supported)
+    if (bt_supported)
         bt_deinitialize();
 }
 
@@ -126,11 +126,10 @@ static void connection_state_changed_cb_for_audio_p(int result, bool connected,
  */
 int utc_bluetooth_bt_audio_initialize_p(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_audio_deinitialize();
-        assert_eq(ret, BT_ERROR_NONE);
 
         ret = bt_audio_initialize();
         assert_eq(ret, BT_ERROR_NONE);
@@ -151,7 +150,7 @@ int utc_bluetooth_bt_audio_initialize_p(void)
  */
 int utc_bluetooth_bt_audio_set_connection_state_changed_cb_p(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_audio_set_connection_state_changed_cb
@@ -175,12 +174,11 @@ int utc_bluetooth_bt_audio_set_connection_state_changed_cb_p(void)
  */
 int utc_bluetooth_bt_audio_unset_connection_state_changed_cb_p(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_audio_set_connection_state_changed_cb
             (connection_state_changed_cb_for_audio_p, NULL);
-        assert_eq(ret, BT_ERROR_NONE);
 
         ret = bt_audio_unset_connection_state_changed_cb();
         assert_eq(ret, BT_ERROR_NONE);
@@ -202,7 +200,7 @@ int utc_bluetooth_bt_audio_unset_connection_state_changed_cb_p(void)
  */
 int utc_bluetooth_bt_audio_deinitialize_p(void)
 {
-    if(media_supported || call_supported) {
+    if (media_supported || call_supported) {
         assert_eq(startup_flag, BT_ERROR_NONE);
 
         ret = bt_audio_deinitialize();
@@ -230,16 +228,21 @@ static void __bt_avrcp_target_connection_state_changed_cb(bool connected, const
 int utc_bluetooth_bt_avrcp_targe_initialize_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       result = bt_avrcp_target_initialize(
-                       __bt_avrcp_target_connection_state_changed_cb,
-                       NULL);
-       assert_eq(result, BT_ERROR_NONE);
+               result = bt_avrcp_target_initialize(
+                               __bt_avrcp_target_connection_state_changed_cb,
+                               NULL);
+               assert_eq(result, BT_ERROR_NONE);
 
-       if(result == BT_ERROR_NONE)
                ret = bt_avrcp_target_deinitialize();
-
+       } else {
+               result = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
+       }
        return 0;
 }
 
@@ -253,16 +256,18 @@ int utc_bluetooth_bt_avrcp_targe_initialize_p(void)
 int utc_bluetooth_bt_avrcp_target_deinitialize_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
 
-       ret = bt_avrcp_target_initialize(
-                               __bt_avrcp_target_connection_state_changed_cb,
-                               NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                       __bt_avrcp_target_connection_state_changed_cb,
+                                       NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_deinitialize();
                assert_eq(result, BT_ERROR_NONE);
+       } else {
+               result = bt_avrcp_target_deinitialize();
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -278,16 +283,19 @@ int utc_bluetooth_bt_avrcp_target_deinitialize_p(void)
 int utc_bluetooth_bt_avrcp_target_notify_equalizer_state_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
                                        NULL);
-       assert_eq(ret, BT_ERROR_NONE);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_notify_equalizer_state(BT_AVRCP_EQUALIZER_STATE_ON);
                assert_eq(result, BT_ERROR_NONE);
+
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_target_notify_equalizer_state(BT_AVRCP_EQUALIZER_STATE_ON);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -303,16 +311,19 @@ int utc_bluetooth_bt_avrcp_target_notify_equalizer_state_p(void)
 int utc_bluetooth_bt_avrcp_target_notify_repeat_mode_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_notify_repeat_mode(BT_AVRCP_REPEAT_MODE_SINGLE_TRACK);
                assert_eq(result, BT_ERROR_NONE);
+
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_target_notify_repeat_mode(BT_AVRCP_REPEAT_MODE_SINGLE_TRACK);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -328,16 +339,21 @@ int utc_bluetooth_bt_avrcp_target_notify_repeat_mode_p(void)
 int utc_bluetooth_bt_avrcp_target_notify_shuffle_mode_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
-
-       if(ret == BT_ERROR_NONE) {
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               if(ret == BT_ERROR_NONE) {
+                       result = bt_avrcp_target_notify_shuffle_mode(BT_AVRCP_SHUFFLE_MODE_ALL_TRACK);
+                       assert_eq(result, BT_ERROR_NONE);
+                       ret = bt_avrcp_target_deinitialize();
+               }
+       } else {
                result = bt_avrcp_target_notify_shuffle_mode(BT_AVRCP_SHUFFLE_MODE_ALL_TRACK);
-               assert_eq(result, BT_ERROR_NONE);
-               ret = bt_avrcp_target_deinitialize();
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -353,16 +369,19 @@ int utc_bluetooth_bt_avrcp_target_notify_shuffle_mode_p(void)
 int utc_bluetooth_bt_avrcp_target_notify_scan_mode_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_notify_scan_mode(BT_AVRCP_SCAN_MODE_ALL_TRACK);
                assert_eq(result, BT_ERROR_NONE);
+
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_target_notify_scan_mode(BT_AVRCP_SCAN_MODE_ALL_TRACK);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -378,16 +397,19 @@ int utc_bluetooth_bt_avrcp_target_notify_scan_mode_p(void)
 int utc_bluetooth_bt_avrcp_target_notify_player_state_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_notify_player_state(BT_AVRCP_PLAYER_STATE_STOPPED);
                assert_eq(result, BT_ERROR_NONE);
+
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_target_notify_player_state(BT_AVRCP_PLAYER_STATE_STOPPED);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -404,16 +426,19 @@ int utc_bluetooth_bt_avrcp_target_notify_position_p(void)
 {
        int result;
        unsigned int position = 0;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_notify_position(position);
                assert_eq(result, BT_ERROR_NONE);
+
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_target_notify_position(position);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -429,16 +454,19 @@ int utc_bluetooth_bt_avrcp_target_notify_position_p(void)
 int utc_bluetooth_bt_avrcp_target_notify_track_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_target_notify_track("title", "artist", "album", "genre", 5, 20, 2);
                assert_eq(result, BT_ERROR_NONE);
+
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_target_notify_track("title", "artist", "album", "genre", 5, 20, 2);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -462,17 +490,20 @@ static void __bt_avrcp_set_equalizer_state_changed_cb(
 int utc_bluetooth_bt_avrcp_set_equalizer_state_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_equalizer_state_changed_cb(__bt_avrcp_set_equalizer_state_changed_cb, NULL);
                assert_eq(result, BT_ERROR_NONE);
+
                result = bt_avrcp_unset_equalizer_state_changed_cb();
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_set_equalizer_state_changed_cb(__bt_avrcp_set_equalizer_state_changed_cb, NULL);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -489,19 +520,20 @@ int utc_bluetooth_bt_avrcp_set_equalizer_state_changed_p(void)
 int utc_bluetooth_bt_avrcp_unset_equalizer_state_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_equalizer_state_changed_cb(__bt_avrcp_set_equalizer_state_changed_cb, NULL);
-               assert_eq(result, BT_ERROR_NONE);
 
                result = bt_avrcp_unset_equalizer_state_changed_cb();
                assert_eq(result, BT_ERROR_NONE);
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_unset_equalizer_state_changed_cb();
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -524,17 +556,19 @@ static void __bt_avrcp_set_repeat_mode_changed_cb(bt_avrcp_repeat_mode_e repeat,
 int utc_bluetooth_bt_avrcp_set_repeat_mode_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_set_repeat_mode_changed_cb, NULL);
                assert_eq(result, BT_ERROR_NONE);
                result = bt_avrcp_unset_repeat_mode_changed_cb();
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_set_repeat_mode_changed_cb, NULL);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -551,19 +585,19 @@ int utc_bluetooth_bt_avrcp_set_repeat_mode_changed_p(void)
 int utc_bluetooth_bt_avrcp_unset_repeat_mode_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_set_repeat_mode_changed_cb, NULL);
-               assert_eq(result, BT_ERROR_NONE);
-
                result = bt_avrcp_unset_repeat_mode_changed_cb();
                assert_eq(result, BT_ERROR_NONE);
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_set_repeat_mode_changed_cb(__bt_avrcp_set_repeat_mode_changed_cb, NULL);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -585,17 +619,19 @@ static void __bt_avrcp_set_shuffle_mode_changed_cb(bt_avrcp_shuffle_mode_e shuff
 int utc_bluetooth_bt_avrcp_set_shuffle_mode_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_set_shuffle_mode_changed_cb, NULL);
                assert_eq(result, BT_ERROR_NONE);
                result = bt_avrcp_unset_shuffle_mode_changed_cb();
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_set_shuffle_mode_changed_cb, NULL);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -612,19 +648,20 @@ int utc_bluetooth_bt_avrcp_set_shuffle_mode_changed_p(void)
 int utc_bluetooth_bt_avrcp_unset_shuffle_mode_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if(media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_shuffle_mode_changed_cb(__bt_avrcp_set_shuffle_mode_changed_cb, NULL);
-               assert_eq(result, BT_ERROR_NONE);
 
                result = bt_avrcp_unset_shuffle_mode_changed_cb();
                assert_eq(result, BT_ERROR_NONE);
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_unset_shuffle_mode_changed_cb();
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -647,18 +684,21 @@ static void __bt_avrcp_set_scan_mode_changed_cb(bt_avrcp_scan_mode_e scan,
 int utc_bluetooth_bt_avrcp_set_scan_mode_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_scan_mode_changed_cb(
                                __bt_avrcp_set_scan_mode_changed_cb, NULL);
                assert_eq(result, BT_ERROR_NONE);
                result = bt_avrcp_unset_scan_mode_changed_cb();
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_set_scan_mode_changed_cb(
+                               __bt_avrcp_set_scan_mode_changed_cb, NULL);
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;
@@ -675,20 +715,21 @@ int utc_bluetooth_bt_avrcp_set_scan_mode_changed_p(void)
 int utc_bluetooth_bt_avrcp_unset_scan_mode_changed_p(void)
 {
        int result;
-       assert_eq(startup_flag, BT_ERROR_NONE);
-       ret = bt_avrcp_target_initialize(
-                                       __bt_avrcp_target_connection_state_changed_cb,
-                                       NULL);
-       assert_eq(ret, BT_ERROR_NONE);
+       if (media_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_avrcp_target_initialize(
+                                               __bt_avrcp_target_connection_state_changed_cb,
+                                               NULL);
 
-       if(ret == BT_ERROR_NONE) {
                result = bt_avrcp_set_scan_mode_changed_cb(
                                __bt_avrcp_set_scan_mode_changed_cb, NULL);
-               assert_eq(result, BT_ERROR_NONE);
 
                result = bt_avrcp_unset_scan_mode_changed_cb();
                assert_eq(result, BT_ERROR_NONE);
                ret = bt_avrcp_target_deinitialize();
+       } else {
+               result = bt_avrcp_unset_scan_mode_changed_cb();
+               assert_eq(result, BT_ERROR_NOT_SUPPORTED);
        }
 
        return 0;