[commom][mmpipeline][fix possible timing issue for pipeline] 74/289774/2
authorchen <chen89.chen@samsung.com>
Tue, 14 Mar 2023 07:31:15 +0000 (15:31 +0800)
committerchen <chen89.chen@samsung.com>
Tue, 14 Mar 2023 07:42:39 +0000 (15:42 +0800)
Change-Id: Ida2433c0cc72ef25ca48f9ef5693aad5a60646d3
Signed-off-by: chen <chen89.chen@samsung.com>
common/tct-mlpipeline-tizen-tests/mlpipeline/Pipeline_stop.html

index 1e19bfd26e02a0b6162771169178b3b35080b172..39e2087afef93fad9b5ec98414cd509286ea05d0 100755 (executable)
@@ -35,26 +35,35 @@ Authors:
 //==== TEST_CRITERIA MR MNA MNAST
 
 setup({timeout: 90000});
-var t = async_test(document.title, {timeout: 90000}), pipeline, pipelineDefinition, listener;
+var t = async_test(document.title, {timeout: 90000}), pipeline, pipelineDefinition, stateListener;
 
 t.step(function () {
-    listener = t.step_func(function (newState) {
-        if (newState === "PAUSED") {
-            pipeline.start();
-            assert_equals(pipeline.state, "PLAYING", "Incorrect pipeline state");
-            retValue = pipeline.stop();
-            assert_type(retValue, "undefined", "Incorrect return type.");
+    var isCreated = false;
+    var isTest = false;
+    function stateListener(state) {
+        if (isTest) {
             assert_equals(pipeline.state, "PAUSED", "Incorrect pipeline state.");
             pipeline.dispose();
             t.done();
         }
-    });
+        if (state === "PAUSED") {
+            if(!isCreated) {
+                isCreated = true;
+                pipeline.start();
+            }
+        }
+        if (state === "PLAYING") {
+            isTest = true;
+            retValue = pipeline.stop();
+            assert_type(retValue, "undefined", "Incorrect return type.");
+        }
+    }
 
     pipelineDefinition = "videotestsrc ! tizenwlsink";
-    pipeline = tizen.ml.pipeline.createPipeline(pipelineDefinition, listener);
-    assert_type(pipeline, "object", "Incorrect return type.");
+    pipeline = tizen.ml.pipeline.createPipeline(pipelineDefinition, stateListener);
 });
 
+
 </script>
 </body>
 </html>
\ No newline at end of file