e0983d18c21a12e60eac33ca6db4d376f22bf54b
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2013 Samsung Electronics Co., Ltd.
4
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
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
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.
16
17 Authors:
18         Krzysztof Lachacz <k.lachacz@samsung.com>
19
20 -->
21
22 <html>
23 <head>
24 <title>RequestedApplicationControl_replyResult_with_data</title>
25 <script type="text/javascript" src="support/unitcommon.js"></script>
26 <script type="text/javascript" src="support/app_common.js"></script>
27 </head>
28
29 <body>
30 <div id="log"></div>
31 <script type="text/javascript">
32
33 //==== TEST: RequestedApplicationControl_replyResult_with_data
34 //==== LABEL Check if RequestedApplicationControl method replyCallback called with data param works properly
35 //==== SPEC: Tizen Web API:Application:Application:RequestedApplicationControl:replyResult M
36 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/application.html
37 //==== PRIORITY P1
38 //==== ONLOAD_DELAY 30
39 //==== TEST_CRITERIA MOA MAST
40
41 setup({timeout: 30000});
42
43 var t = async_test(document.title, {timeout: 30000}),
44     appControl, replyCallback, onerror, sentData;
45
46 setup_launch(t, TCT_APPCONTROL_APPID, function () {
47     sentData = new tizen.ApplicationControlData("key1", ["data1"]);
48
49     appControl = new tizen.ApplicationControl(TCT_APPCONTROL_REPLY_RESULT_WITH_DATA_OPERATION,
50                                                 null,
51                                                 null,
52                                                 null,
53                                                 [sentData]);
54
55     onerror = t.step_func(function (err) {
56         assert_unreached("errorCallback called: " + err.message);
57     });
58
59     replyCallback = {
60         onsuccess: t.step_func(function (data) {
61             assert_true(data.length > 0, "data was not sent");
62             assert_equals(data[0].key, sentData.key, "values sent and received are different");
63             assert_equals(data[0].value[0], sentData.value[0], "values sent and received are different");
64             t.done();
65         }),
66
67         onfailure: t.step_func(function () {
68             assert_unreached("onfailure callback called");
69         })
70     };
71
72     tizen.application.launchAppControl(appControl, null, null, onerror, replyCallback);
73 });
74
75 </script>
76 </body>
77 </html>