From: wei625.zhang Date: Fri, 11 Sep 2020 08:27:15 +0000 (+0800) Subject: [common][mediacontroller][DPTTIZEN-3202, update cases for asynchronous function:... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc5f23768ef7ed2bb0c0260e013357c43eb447a3;p=test%2Ftct%2Fweb%2Fapi.git [common][mediacontroller][DPTTIZEN-3202, update cases for asynchronous function: savePlaylist and deletePlaylist] Change-Id: Ie77c9dbea127129596e2917b25bf3d52481d79ee Signed-off-by: wei625.zhang --- diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerChangeRequestPlaybackInfoCallback_onplaybackitemrequest.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerChangeRequestPlaybackInfoCallback_onplaybackitemrequest.html index c7cc09fdc..93df3daaf 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerChangeRequestPlaybackInfoCallback_onplaybackitemrequest.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerChangeRequestPlaybackInfoCallback_onplaybackitemrequest.html @@ -37,7 +37,8 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), watchId, mcServer, mcClient, playlist, mcServerInfo, playbackRequestListener; +var t = async_test(document.title, {timeout: 30000}), watchId, mcServer, mcClient, playlist, successCallback, + errorCallback, mcServerInfo, playbackRequestListener; t.step(function () { add_result_callback(function(){ @@ -58,15 +59,20 @@ t.step(function () { t.done(); }) }; + successCallback = t.step_func(function () { + mcServer.playback.state = "PLAY"; + mcServerInfo = mcClient.getLatestServerInfo(); + watchId = mcServer.playback.addChangeRequestListener(playbackRequestListener); + mcServerInfo.playlists.sendPlaybackItem("list", "1", "STOP", 0); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); mcClient = tizen.mediacontroller.getClient(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.savePlaylist(playlist); - mcServer.playback.state = "PLAY"; - mcServerInfo = mcClient.getLatestServerInfo(); - watchId = mcServer.playback.addChangeRequestListener(playbackRequestListener); - mcServerInfo.playlists.sendPlaybackItem("list", "1", "STOP", 0); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetAllPlaylistsSuccessCallback_onsuccess.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetAllPlaylistsSuccessCallback_onsuccess.html index 9a22a883d..a4fc0e37d 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetAllPlaylistsSuccessCallback_onsuccess.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetAllPlaylistsSuccessCallback_onsuccess.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, successCallback; +var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, savesuccessCallback, successCallback, errorCallback; t.step(function () { add_result_callback(function () { @@ -47,10 +47,15 @@ t.step(function () { assert_equals(playlists[0].name, "list", "invalid value of name"); t.done(); }); + savesuccessCallback = t.step_func(function () { + mcServer.playlists.getAllPlaylists(successCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.savePlaylist(playlist); - mcServer.playlists.getAllPlaylists(successCallback); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetItemsSuccessCallback_onsuccess.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetItemsSuccessCallback_onsuccess.html index 520d5d593..44c83ee26 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetItemsSuccessCallback_onsuccess.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerGetItemsSuccessCallback_onsuccess.html @@ -36,22 +36,27 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, successCallback; +var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, errorCallback, MediaControllerGetItemsSuccessCallback, successCallback; t.step(function () { add_result_callback(function () { mcServer.playlists.deletePlaylist("list"); }); - successCallback = t.step_func(function (items) { + MediaControllerGetItemsSuccessCallback = t.step_func(function (items) { assert_type(items, "array", "invalid type of items"); assert_equals(items[0].index, "index1", "invalid value of items.index"); t.done(); }); + successCallback = t.step_func(function () { + playlist.getItems(MediaControllerGetItemsSuccessCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_extend.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_extend.html index c1fb18f5d..04a7af5ac 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_extend.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_extend.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 90000}); -var t = async_test(document.title, {timeout: 90000}), mcServer, playlist, successCallback; +var t = async_test(document.title, {timeout: 90000}), mcServer, playlist, savesuccessCallback, successCallback, errorCallback; t.step(function () { add_result_callback(function () { @@ -47,12 +47,17 @@ t.step(function () { check_extensibility(items[0]); t.done(); }); + savesuccessCallback = t.step_func(function () { + playlist.getItems(successCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_index_attribute.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_index_attribute.html index 861d2f809..3648044b2 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_index_attribute.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_index_attribute.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 90000}); -var t = async_test(document.title, {timeout: 90000}), mcServer, playlist, successCallback; +var t = async_test(document.title, {timeout: 90000}), mcServer, playlist, savesuccessCallback, successCallback, errorCallback; t.step(function () { add_result_callback(function () { @@ -47,12 +47,17 @@ t.step(function () { check_readonly(items[0], "index", items[0].index, "string", "A"); t.done(); }); + savesuccessCallback = t.step_func(function () { + playlist.getItems(successCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_metadata_attribute.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_metadata_attribute.html index baaa46fcd..78b067ffb 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_metadata_attribute.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistItem_metadata_attribute.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 90000}); -var t = async_test(document.title, {timeout: 90000}), mcServer, playlist, successCallback; +var t = async_test(document.title, {timeout: 90000}), mcServer, playlist, savesuccessCallback, successCallback, errorCallback; t.step(function () { add_result_callback(function () { @@ -47,12 +47,17 @@ t.step(function () { check_readonly(items[0], "metadata", items[0].metadata, "object", { title: "testTitleA" }); t.done(); }); + savesuccessCallback = t.step_func(function () { + playlist.getItems(successCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistdeleted.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistdeleted.html index e9d6f2c8a..4bc47ea91 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistdeleted.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistdeleted.html @@ -36,7 +36,8 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), watcherId = null, mcClient, playlist, mcServerInfo, onupdate; +var t = async_test(document.title, {timeout: 30000}), watcherId = null, mcClient, playlist, mcServerInfo, onupdate, savesuccessCallback, successCallback, + errorCallback; t.step(function () { add_result_callback(function () { @@ -52,13 +53,20 @@ t.step(function () { t.done(); }) }; + successCallback = t.step_func(function () { + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() or deletePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); + savesuccessCallback = t.step_func(function () { + watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(onupdate); + mcServer.playlists.deletePlaylist("list", successCallback, errorCallback); + }); mcServer = tizen.mediacontroller.createServer(); mcClient = tizen.mediacontroller.getClient(); mcServerInfo = mcClient.getLatestServerInfo(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.savePlaylist(playlist); - watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(onupdate); - mcServer.playlists.deletePlaylist("list"); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistupdated.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistupdated.html index 671eadf44..3f12f9c95 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistupdated.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistUpdatedCallback_onplaylistupdated.html @@ -36,7 +36,8 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), watcherId = null, mcClient, playlist, mcServerInfo, onupdate; +var t = async_test(document.title, {timeout: 30000}), watcherId = null, mcClient, playlist, mcServerInfo, onupdate, savesuccessCallback, successCallback, + errorCallback; t.step(function () { add_result_callback(function () { @@ -52,17 +53,23 @@ t.step(function () { t.done(); }) }; + successCallback = t.step_func(function () { + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); + savesuccessCallback = t.step_func(function () { + watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(onupdate); + playlist.addItem("index1", { title: "testTitle" }); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); + mcServer.playback.updatePlaybackItem("list", "index1"); + }); mcServer = tizen.mediacontroller.createServer(); mcClient = tizen.mediacontroller.getClient(); mcServerInfo = mcClient.getLatestServerInfo(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.savePlaylist(playlist); - watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(onupdate); - - playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - mcServer.playback.updatePlaybackItem("list", "index1"); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem.html index 291ae4d4e..0bc4fb934 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem.html @@ -36,24 +36,30 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, successCallback, retVal = null; +var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, successCallback, + errorCallback, MediaControllerGetItemsSuccessCallback, retVal = null; t.step(function () { add_result_callback(function () { mcServer.playlists.deletePlaylist("list"); }); - successCallback = t.step_func(function (items) { + MediaControllerGetItemsSuccessCallback = t.step_func(function (items) { assert_equals(items[0].index, "index1", "invalid value of index"); assert_equals(retVal, undefined, "addItem returns wrong value"); t.done(); }); + successCallback = t.step_func(function () { + playlist.getItems(MediaControllerGetItemsSuccessCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); retVal = playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem_metadata_empty.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem_metadata_empty.html index 910cae666..17b80ab4a 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem_metadata_empty.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_addItem_metadata_empty.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, successCallback; +var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, savesuccessCallback, successCallback, errorCallback; t.step(function () { add_result_callback(function () { @@ -46,12 +46,17 @@ t.step(function () { successCallback = t.step_func(function (items) { t.done(); }); + savesuccessCallback = t.step_func(function () { + playlist.getItems(successCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", {}); - mcServer.playlists.savePlaylist(playlist); - playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems.html index deb4b4959..ad4c554e0 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, successCallback, retVal = null; +var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, savesuccessCallback, successCallback, errorCallback, retVal = null; t.step(function () { add_result_callback(function () { @@ -46,11 +46,16 @@ t.step(function () { assert_equals(retVal, undefined, "getItems should return undefined"); t.done(); }); + savesuccessCallback = t.step_func(function () { + retVal = playlist.getItems(successCallback); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - retVal = playlist.getItems(successCallback); + mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems_with_errorCallback.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems_with_errorCallback.html index 08ead66e6..2af431803 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems_with_errorCallback.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylist_getItems_with_errorCallback.html @@ -37,7 +37,7 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, successCallback, +var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, MediaControllerGetItemsSuccessCallback, successCallback, errorCallback, retVal = null; t.step(function () { @@ -45,19 +45,21 @@ t.step(function () { mcServer.playlists.deletePlaylist("list"); }); errorCallback = t.step_func(function (error) { - assert_unreached("getItems() error callback should not be invoked:" + error.name + ": " + error.message); + assert_unreached("error callback should not be invoked:" + error.name + ": " + error.message); }); - successCallback = t.step_func(function () { + MediaControllerGetItemsSuccessCallback = t.step_func(function (items) { assert_equals(retVal, undefined, "getItems should return undefined"); t.done(); }); + successCallback = t.step_func(function () { + retVal = playlist.getItems(MediaControllerGetItemsSuccessCallback, errorCallback); + }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); playlist.addItem("index1", { title: "testTitle" }); - mcServer.playlists.savePlaylist(playlist); - retVal = playlist.getItems(successCallback, errorCallback); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_addPlaylistUpdatedListener.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_addPlaylistUpdatedListener.html index 63dc0cd36..433b45282 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_addPlaylistUpdatedListener.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_addPlaylistUpdatedListener.html @@ -36,7 +36,7 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), watcherId = null, mcClient, playlist, mcServerInfo, ondelete; +var t = async_test(document.title, {timeout: 30000}), watcherId = null, mcClient, playlist, mcServerInfo, ondelete, successCallback, errorCallback; t.step(function () { add_result_callback(function () { @@ -49,14 +49,19 @@ t.step(function () { t.done(); }) }; + successCallback = t.step_func(function (items) { + watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(ondelete); + mcServer.playlists.deletePlaylist("list"); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); mcClient = tizen.mediacontroller.getClient(); mcServerInfo = mcClient.getLatestServerInfo(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.savePlaylist(playlist); - watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(ondelete); - mcServer.playlists.deletePlaylist("list"); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_removePlaylistUpdatedListener.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_removePlaylistUpdatedListener.html index a32132f14..68972214b 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_removePlaylistUpdatedListener.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylistsInfo_removePlaylistUpdatedListener.html @@ -37,7 +37,8 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 90000}), watcherId = null, mcServer, mcClient, playlist, mcServerInfo, ondelete, retVal = null; +var t = async_test(document.title, {timeout: 90000}), watcherId = null, mcServer, mcClient, playlist, mcServerInfo, ondelete, successCallback, + errorCallback, retVal = null; t.step(function () { add_result_callback(function () { @@ -50,15 +51,19 @@ t.step(function () { t.done(); }) }; + successCallback = t.step_func(function () { + watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(ondelete); + mcServer.playlists.deletePlaylist("list"); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); mcClient = tizen.mediacontroller.getClient(); mcServerInfo = mcClient.getLatestServerInfo(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.savePlaylist(playlist); - watcherId = mcServerInfo.playlists.addPlaylistUpdatedListener(ondelete); - - mcServer.playlists.deletePlaylist("list"); + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_deletePlaylist.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_deletePlaylist.html index b2ffda0ec..1af68c727 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_deletePlaylist.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_deletePlaylist.html @@ -34,13 +34,22 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MR MMINA -test(function () { - var mcServer, retValue = null; +setup({timeout: 30000}); + +var t = async_test(document.title, {timeout: 30000}), mcServer, successCallback, errorCallback, retValue = null; + +t.step(function () { + successCallback = t.step_func(function (items) { + assert_equals(retValue, undefined, "deletePlaylist returns wrong value"); + t.done(); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("deletePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); mcServer.playlists.createPlaylist("list"); - retValue = mcServer.playlists.deletePlaylist("list"); - assert_equals(retValue, undefined, "deletePlaylist returns wrong value"); -}, document.title); + retValue = mcServer.playlists.deletePlaylist("list", successCallback, errorCallback); +}); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist.html index 211bdea49..2aa925f9f 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist.html @@ -34,13 +34,25 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MR MMINA -test(function () { +setup({timeout: 30000}); + +var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, savesuccessCallback, errorCallback, retVal = null; + +t.step(function () { + add_result_callback(function () { + mcServer.playlists.deletePlaylist("list"); + }); + savesuccessCallback = t.step_func(function () { + assert_equals(retValue, undefined, "savePlaylist returns wrong value"); + t.done(); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); var mcServer, playlist, retValue = null; mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); - retValue = mcServer.playlists.savePlaylist(playlist); - assert_equals(retValue, undefined, "savePlaylist returns wrong value"); - mcServer.playlists.deletePlaylist("list"); + retValue = mcServer.playlists.savePlaylist(playlist, savesuccessCallback, errorCallback); }, document.title); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist_errorCallback_invoke.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist_errorCallback_invoke.html index 923e1f57c..830b18790 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist_errorCallback_invoke.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerPlaylists_savePlaylist_errorCallback_invoke.html @@ -37,7 +37,7 @@ Authors: setup({timeout: 30000}); -var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, successCallback, +var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, deletesuccessCallback, successCallback, errorCallback; t.step(function () { @@ -47,13 +47,15 @@ t.step(function () { }); successCallback = t.step_func(function () { - assert_unreached("savePlaylist() successCallback should not be invoked"); + assert_unreached("savePlaylist() or deletePlaylist() successCallback should not be invoked"); + }); + deletesuccessCallback = t.step_func(function () { + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); }); mcServer = tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("list"); - mcServer.playlists.deletePlaylist("list"); - mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); + mcServer.playlists.deletePlaylist("list", deletesuccessCallback, errorCallback); }); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerInfo_getPlaylist.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerInfo_getPlaylist.html index 84269f977..86e0e7958 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerInfo_getPlaylist.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerInfo_getPlaylist.html @@ -34,16 +34,29 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MR -test(function () { - var mcServer, playList, mcClient, mcServerInfo, retVal = null; +setup({timeout: 30000}); + +var t = async_test(document.title, {timeout: 30000}), playlist, mcServer, mcClient, mcServerInfo, successCallback, errorCallback, retVal = null; + +t.step(function () { + add_result_callback(function () { + mcServer.playlists.deletePlaylist("Music"); + }); + successCallback = t.step_func(function (items) { + mcServerInfo = mcClient.getLatestServerInfo(); + retVal = mcServerInfo.playlists.getPlaylist("Music"); + assert_type(retVal, "object", "Invalid type of retVal"); + assert_equals(retVal.name, "Music", "Invalid value of retVal"); + t.done(); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); + mcClient = tizen.mediacontroller.getClient(); mcServer = tizen.mediacontroller.createServer(); playList = mcServer.playlists.createPlaylist("Music"); - mcServer.playlists.savePlaylist(playList); - mcServerInfo = mcClient.getLatestServerInfo(); - retVal = mcServerInfo.playlists.getPlaylist("Music"); - assert_type(retVal, "object", "Invalid type of retVal"); - assert_equals(retVal.name, "Music", "Invalid value of retVal"); + mcServer.playlists.savePlaylist(playList, successCallback, errorCallback); }, document.title); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerPlaybackInfo_updatePlaybackItem.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerPlaybackInfo_updatePlaybackItem.html index 1e41bd56a..79d95c257 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerPlaybackInfo_updatePlaybackItem.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServerPlaybackInfo_updatePlaybackItem.html @@ -34,8 +34,14 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MR MAST -test(function () { - var mcServer, metadata, playlist, retVal = null; +setup({timeout: 30000}); + +var t = async_test(document.title, {timeout: 30000}), mcServer, metadata, playlist, retVal = null, successCallback, errorCallback; + +t.step(function () { + add_result_callback(function () { + mcServer.playlists.deletePlaylist("PlayList"); + }); mcServer= tizen.mediacontroller.createServer(); playlist = mcServer.playlists.createPlaylist("PlayList"); @@ -43,14 +49,18 @@ test(function () { { title: "testTitle" }; + successCallback = t.step_func(function () { + retVal = mcServer.playback.updatePlaybackItem("PlayList", "index1"); + assert_equals(retVal, undefined, "updatePlaybackItem returns wrong value"); + assert_equals(mcServer.playbackInfo.index, "index1", "update index failed"); + t.done(); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); playlist.addItem("index1", metadata); - mcServer.playlists.savePlaylist(playlist); - retVal = mcServer.playback.updatePlaybackItem("PlayList", "index1"); - assert_equals(retVal, undefined, "updatePlaybackItem returns wrong value"); - assert_equals(mcServer.playbackInfo.index, "index1", "update index failed"); - mcServer.playlists.deletePlaylist("PlayList"); -}, document.title); - + mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback); +}); diff --git a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServer_getPlaylist.html b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServer_getPlaylist.html index f1af6f84e..90aba37c7 100755 --- a/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServer_getPlaylist.html +++ b/common/tct-mediacontroller-tizen-tests/mediacontroller/MediaControllerServer_getPlaylist.html @@ -34,16 +34,30 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MR MAST -test(function () { - var mcServer, playList, retVal = null; +setup({timeout: 30000}); + +var t = async_test(document.title, {timeout: 30000}), mcServer, playlist, successCallback, + errorCallback, retVal = null; + +t.step(function () { + add_result_callback(function () { + mcServer.playlists.deletePlaylist("Music"); + }); + + successCallback = t.step_func(function () { + retVal = mcServer.playlists.getPlaylist("Music"); + assert_type(retVal, "object", "Invalid type of retVal"); + assert_equals(retVal.name, "Music", "Invalid value of retVal"); + t.done(); + }); + errorCallback = t.step_func(function (error) { + assert_unreached("savePlaylist() error callback should not be invoked:" + error.name + ": " + error.message); + }); mcServer = tizen.mediacontroller.createServer(); playList = mcServer.playlists.createPlaylist("Music"); - mcServer.playlists.savePlaylist(playList); - retVal = mcServer.playlists.getPlaylist("Music"); - assert_type(retVal, "object", "Invalid type of retVal"); - assert_equals(retVal.name, "Music", "Invalid value of retVal"); -}, document.title); + mcServer.playlists.savePlaylist(playList, successCallback, errorCallback); +});