363b90bc90112380f895e87b4871a9c204c02e5c
[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
18 Authors:
19         Jakub Siewierski <j.siewierski@samsung.com>
20
21 -->
22 <html>
23 <head>
24 <title>MessageService_mms_sendMessage_successCallback_invalid_cb</title>
25 <meta charset="utf-8"/>
26 <script type="text/javascript" src="../resources/unitcommon.js"></script>
27 <script type="text/javascript" src="support/messaging_common.js"></script>
28 </head>
29
30 <body>
31 <div id="log"></div>
32 <script>
33 //==== TEST: MessageService_mms_sendMessage_successCallback_invalid_cb
34 //==== LABEL Check argument MessageService.sendMessage (MMS) successCallback validation - use {onsuccess: function (){}}
35 //==== PRIORITY: P2
36 //==== SPEC Tizen Web API:Communication:Messaging:MessageService:sendMessage M
37 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
38 //==== ONLOAD_DELAY 90
39 //==== TEST_CRITERIA MTCB
40 setup({ timeout: 90000 });
41
42 var t = async_test("MessageService_mms_sendMessage_successCallback_invalid_cb", { timeout: 90000 });
43 t.step(function () {
44     var messagingService, serviceSuccess, serviceError, message,
45         sendError, invalidSuccessCallback,
46         exceptionName = "TypeMismatchError";
47
48     invalidSuccessCallback = {
49         onsuccess: t.step_func(function (recipients) {
50             assert_unreached("Invalid success callback invoked");
51         })
52     };
53
54     sendError = t.step_func(function (error) {
55         assert_unreached("Error callback invoked, name:" + error.name + ", msg:" + error.message);
56     });
57
58     serviceSuccess = t.step_func(function (services) {
59         assert_true(services.length > 0, "Received empty services array");
60         messagingService = services[0];
61
62         message = new tizen.Message("messaging.mms");
63         assert_throws(
64             { name: exceptionName },
65             function () {
66                 messagingService.sendMessage(message, invalidSuccessCallback, sendError);
67             },
68             exceptionName + " should be thrown - invalid success callback."
69         );
70
71         t.done();
72     });
73
74     serviceError = t.step_func(function (error) {
75         assert_unreached("getMessageServices() error callback: name:" + error.name + ", msg:" + error.message);
76     });
77
78     tizen.messaging.getMessageServices("messaging.mms", serviceSuccess, serviceError);
79 });
80
81 </script>
82 </body>
83 </html>