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_launchAppControl_appControl_TypeMismatch</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
30 //==== TEST: RemoteAppControlService_launchAppControl_appControl_TypeMismatch
31 //==== LABEL Check if launchAppControl of RemoteAppControlService throws exception when appControl is incorrect
32 //==== SPEC Tizen Web API:TBD:Convergence:RemoteAppControlService:launchAppControl M
35 //==== TEST_CRITERIA MC
37 setup({timeout: 30000});
39 var t = async_test(document.title, {timeout: 30000}), discoveryCallback, errorCallback, i, onconnected, onerror, onversionTable, exceptionName,
40 remoteAppControlCallback, requestAppControl;
43 conversionTable = getTypeConversionExceptions("Object", true);
45 remoteAppControlCallback = t.step_func(function (data) {
46 assert_unreached("launchAppControl() success callback should not be invoked.");
49 onerror = t.step_func(function (error) {
50 assert_unreached("launchAppControl() error callback was invoked: " + error.name + " msg: " + error.message);
53 onconnected = t.step_func(function (service) {
54 for (i = 0; i < conversionTable.length; i++) {
55 requestAppControl = conversionTable[i][0];
56 exceptionName = conversionTable[i][1];
57 assert_throws({name: exceptionName},
59 service.launchAppControl(requestAppControl, null, remoteAppControlCallback, onerror)
60 }, "Given incorrect errorCallback.");
65 connectederror = t.step_func(function (error) {
66 assert_unreached("connect() error callback was invoked: " + error.name + " msg: " + error.message);
70 onfound : t.step_func(function (device) {
71 assert_greater_than(device.services.length, 0, "service item is not found");
72 for (i = 0; i < device.services.length; i++) {
73 if (device.services[i] instanceof RemoteAppControlService && device.services[i].connectionState != "CONNECTED") {
77 device.services[i].connect(onconnected, connectederror);
78 tizen.convergence.stopDiscovery();
81 onfinished : t.step_func(function (foundDevices) {
86 errorCallback = t.step_func(function (error) {
87 assert_unreached("startDiscovery() error callback was invoked: " + error.name + " msg: " + error.message);
90 tizen.convergence.startDiscovery(discoveryCallback, errorCallback, 60*60);