From: chen Date: Tue, 14 Mar 2023 07:31:15 +0000 (+0800) Subject: [commom][mmpipeline][fix possible timing issue for pipeline] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cd03da362aed5c63953ebb11bf2ff68194cb048;p=test%2Ftct%2Fweb%2Fapi.git [commom][mmpipeline][fix possible timing issue for pipeline] Change-Id: Ida2433c0cc72ef25ca48f9ef5693aad5a60646d3 Signed-off-by: chen --- diff --git a/common/tct-mlpipeline-tizen-tests/mlpipeline/Pipeline_stop.html b/common/tct-mlpipeline-tizen-tests/mlpipeline/Pipeline_stop.html index 1e19bfd26..39e2087af 100755 --- a/common/tct-mlpipeline-tizen-tests/mlpipeline/Pipeline_stop.html +++ b/common/tct-mlpipeline-tizen-tests/mlpipeline/Pipeline_stop.html @@ -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); }); + \ No newline at end of file