[UTC][webrtc][ACR-1776] Apply display feature 84/295584/2
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 11 Jul 2023 07:37:09 +0000 (16:37 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 18 Jul 2023 06:56:47 +0000 (15:56 +0900)
Change-Id: I65ba6ccd1e8d5c78d643a2743b2c577f1244a053
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
src/utc/webrtc/utc-media-webrtc.c

index 7e4d79e9bf9e9e4dab4622837a29501c1f1f2c6f..d54ef252eb5788f99e5374429848d221805d356f 100644 (file)
@@ -23,6 +23,7 @@
 #define API_NAMESPACE                 "WEBRTC_UTC"
 #define MICROPHONE_FEATURE            "http://tizen.org/feature/microphone"
 #define CAMERA_FEATURE                "http://tizen.org/feature/camera"
+#define DISPLAY_FEATURE               "http://tizen.org/feature/display"
 #define TIMEOUT_MS                     5000
 #define TEST_WIDTH                     640
 #define TEST_HEIGHT                    480
@@ -38,6 +39,7 @@
 
 static bool g_bIsMicrophoneFeatureSupported;
 static bool g_bIsCameraFeatureSupported;
+static bool g_bIsDisplayFeatureSupported;
 static GMainLoop *g_mainloop = NULL;
 static int g_timeout_id = 0;
 static Evas_Object *g_win = NULL;
@@ -179,6 +181,9 @@ void utc_media_webrtc_startup_only_check_features(void)
 
        g_bIsCameraFeatureSupported = false;
        IS_FEATURE_SUPPORTED(CAMERA_FEATURE, g_bIsCameraFeatureSupported, API_NAMESPACE);
+
+       g_bIsDisplayFeatureSupported = false;
+       IS_FEATURE_SUPPORTED(DISPLAY_FEATURE, g_bIsDisplayFeatureSupported, API_NAMESPACE);
 }
 
 /**
@@ -2365,7 +2370,10 @@ int utc_media_webrtc_media_source_set_video_loopback_p(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, NULL);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_start(g_webrtc);
        assert_eq(ret, WEBRTC_ERROR_NONE);
@@ -2398,7 +2406,10 @@ int utc_media_webrtc_media_source_set_video_loopback_n1(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_EVAS, NULL, NULL);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2414,7 +2425,10 @@ int utc_media_webrtc_media_source_set_video_loopback_n1(void)
 int utc_media_webrtc_media_source_set_video_loopback_n2(void)
 {
        int ret = webrtc_media_source_set_video_loopback(g_webrtc, 0, WEBRTC_DISPLAY_TYPE_EVAS, NULL, NULL);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2436,7 +2450,10 @@ int utc_media_webrtc_media_source_set_video_loopback_n3(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_EVAS + 1, NULL, NULL);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2466,10 +2483,16 @@ int utc_media_webrtc_media_source_unset_video_loopback_p(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, NULL);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_unset_video_loopback(g_webrtc, id);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        return 0;
 }
@@ -2495,7 +2518,10 @@ int utc_media_webrtc_media_source_unset_video_loopback_n1(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_unset_video_loopback(g_webrtc, 0);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2521,7 +2547,10 @@ int utc_media_webrtc_media_source_unset_video_loopback_n2(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_unset_video_loopback(g_webrtc, id);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_OPERATION);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_OPERATION);
 
        return 0;
 }
@@ -2602,7 +2631,10 @@ int utc_media_webrtc_get_audio_mute_n(void)
 int utc_media_webrtc_set_display_n(void)
 {
        int ret = webrtc_set_display(g_webrtc, 0, WEBRTC_DISPLAY_TYPE_EVAS, NULL);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2633,7 +2665,10 @@ int utc_media_webrtc_set_display_mode_p(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &track_id);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_start(g_webrtc);
        assert_eq(ret, WEBRTC_ERROR_NONE);
@@ -2641,9 +2676,17 @@ int utc_media_webrtc_set_display_mode_p(void)
        __run_mainloop();
 
        ret = webrtc_set_display_mode(g_webrtc, track_id, WEBRTC_DISPLAY_MODE_FULL);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_get_display_mode(g_webrtc, track_id, &mode);
+       if (!g_bIsDisplayFeatureSupported) {
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+               webrtc_stop(g_webrtc);
+               return 0;
+       }
        assert_eq(ret, WEBRTC_ERROR_NONE);
        assert_eq(mode, WEBRTC_DISPLAY_MODE_FULL);
 
@@ -2662,7 +2705,10 @@ int utc_media_webrtc_set_display_mode_p(void)
 int utc_media_webrtc_set_display_mode_n(void)
 {
        int ret = webrtc_set_display_mode(g_webrtc, 0, WEBRTC_DISPLAY_MODE_ORIGIN_SIZE);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2693,7 +2739,10 @@ int utc_media_webrtc_get_display_mode_p(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &track_id);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_start(g_webrtc);
        assert_eq(ret, WEBRTC_ERROR_NONE);
@@ -2701,6 +2750,11 @@ int utc_media_webrtc_get_display_mode_p(void)
        __run_mainloop();
 
        ret = webrtc_get_display_mode(g_webrtc, track_id, &mode);
+       if (!g_bIsDisplayFeatureSupported) {
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+               webrtc_stop(g_webrtc);
+               return 0;
+       }
        assert_eq(ret, WEBRTC_ERROR_NONE);
        assert_eq(mode, WEBRTC_DISPLAY_MODE_LETTER_BOX); /* check the default value */
 
@@ -2719,7 +2773,10 @@ int utc_media_webrtc_get_display_mode_p(void)
 int utc_media_webrtc_get_display_mode_n(void)
 {
        int ret = webrtc_get_display_mode(g_webrtc, 0, NULL);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2750,7 +2807,10 @@ int utc_media_webrtc_set_display_visible_p(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &track_id);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_start(g_webrtc);
        assert_eq(ret, WEBRTC_ERROR_NONE);
@@ -2758,9 +2818,17 @@ int utc_media_webrtc_set_display_visible_p(void)
        __run_mainloop();
 
        ret = webrtc_set_display_visible(g_webrtc, track_id, false);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_get_display_visible(g_webrtc, track_id, &visible);
+       if (!g_bIsDisplayFeatureSupported) {
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+               webrtc_stop(g_webrtc);
+               return 0;
+       }
        assert_eq(ret, WEBRTC_ERROR_NONE);
        assert_eq(visible, false);
 
@@ -2779,7 +2847,10 @@ int utc_media_webrtc_set_display_visible_p(void)
 int utc_media_webrtc_set_display_visible_n(void)
 {
        int ret = webrtc_set_display_visible(g_webrtc, 0, true);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }
@@ -2810,7 +2881,10 @@ int utc_media_webrtc_get_display_visible_p(void)
        assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_media_source_set_video_loopback(g_webrtc, id, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &track_id);
-       assert_eq(ret, WEBRTC_ERROR_NONE);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_NONE);
 
        ret = webrtc_start(g_webrtc);
        assert_eq(ret, WEBRTC_ERROR_NONE);
@@ -2818,6 +2892,11 @@ int utc_media_webrtc_get_display_visible_p(void)
        __run_mainloop();
 
        ret = webrtc_get_display_visible(g_webrtc, track_id, &visible);
+       if (!g_bIsDisplayFeatureSupported) {
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+               webrtc_stop(g_webrtc);
+               return 0;
+       }
        assert_eq(ret, WEBRTC_ERROR_NONE);
        assert_eq(visible, true); /* check the default value */
 
@@ -2836,7 +2915,10 @@ int utc_media_webrtc_get_display_visible_p(void)
 int utc_media_webrtc_get_display_visible_n(void)
 {
        int ret = webrtc_get_display_visible(g_webrtc, 0, NULL);
-       assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(ret, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               assert_eq(ret, WEBRTC_ERROR_INVALID_PARAMETER);
 
        return 0;
 }