3 Copyright (c) 2016 Samsung Electronics Co., Ltd.
5 Licensed under the Apache License, Version 2.0 (the License);
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
18 Xiaoyan Qian <xy.qian@samsung.com>
23 <title>RemoteAppControlService_launch_successCallback_TypeMismatch</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
30 //==== TEST: RemoteAppControlService_launch_successCallback_TypeMismatch
31 //==== LABEL Check if launch of RemoteAppControlService throws exception when successCallback is incorrect
32 //==== SPEC Tizen Web API:TBD:Convergence:RemoteAppControlService:launch M
35 //==== TEST_CRITERIA MC
37 setup({timeout: 30000});
39 var t = async_test(document.title, {timeout: 30000}), discoveryCallback, errorCallback, i, onconnected, launcherror, onversionTable, exceptionName,
40 remoteAppControlCallback, requestAppId = "targetApp0.main";
43 conversionTable = getTypeConversionExceptions("functionObject", true);
45 launcherror = t.step_func(function (error) {
46 assert_unreached("launch() error callback should not be invoked.");
49 onconnected = t.step_func(function (service) {
50 for (i = 0; i < conversionTable.length; i++) {
51 remoteAppControlCallback = conversionTable[i][0];
52 exceptionName = conversionTable[i][1];
53 assert_throws({name: exceptionName},
55 service.launch(requestAppId, remoteAppControlCallback, launcherror)
56 }, "Given incorrect successCallback.");
61 connectederror = t.step_func(function (error) {
62 assert_unreached("connect() error callback was invoked: " + error.name + " msg: " + error.message);
66 onfound : t.step_func(function (device) {
67 assert_greater_than(device.services.length, 0, "service item is not found");
68 for (i = 0; i < device.services.length; i++) {
69 if (device.services[i] instanceof RemoteAppControlService && device.services[i].connectionState != "CONNECTED") {
73 device.services[i].connect(onconnected, connectederror);
74 tizen.convergence.stopDiscovery();
77 onfinished : t.step_func(function (foundDevices) {
82 errorCallback = t.step_func(function (error) {
83 assert_unreached("startDiscovery() error callback was invoked: " + error.name + " msg: " + error.message);
86 tizen.convergence.startDiscovery(discoveryCallback, errorCallback, 60*60);