a3303565cbbca0d93833f85fff2987c29b061194
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3
4 Copyright (c) 2013 Samsung Electronics Co., Ltd.
5
6 Licensed under the Apache License, Version 2.0 (the License);
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10     http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18
19
20 Authors:
21     Andrzej Krolikowski <a.krolikowsk@samsung.com>
22 -->
23 <html lang="en">
24
25 <head>
26 <title>MessageStorage_sms_findConversations_errorCallback_TypeMismatch</title>
27 <meta charset="utf-8">
28 <script type="text/javascript" src="../resources/unitcommon.js"></script>
29 <script type="text/javascript" src="support/messaging_common.js"></script>
30 </head>
31
32 <body>
33 <div id="log"></div>
34 <script>
35
36 //==== TEST: MessageStorage_sms_findConversations_errorCallback_TypeMismatch
37 //==== LABEL check whether invoking 'findConversations' method with invalid error callback throws exception properly
38 //==== PRIORITY P2
39 //==== ONLOAD_DELAY 90
40 //==== SPEC Tizen Web API:Communication:Messaging:MessageStorage:findConversations M
41 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html#findConversationsid2466491
42 //==== TEST_CRITERIA MC
43 setup({timeout: 90000});
44
45 var this_test = async_test("MessageStorage_sms_findConversations_errorCallback_TypeMismatch", {timeout: 90000});
46 this_test.step(function () {
47     var toFilter, findConversationsCallback, getMessagingServicesCallback,
48         onError, i, incorrectCallback, conversionTable, exceptionName;
49
50     toFilter = new tizen.AttributeFilter("to", "CONTAINS", TEST_SMS_RECIPIENT);
51
52     findConversationsCallback = this_test.step_func(function () {
53         assert_unreached("Unexpected findConversationsCallback");
54     });
55
56     getMessagingServicesCallback = this_test.step_func(function (services) {
57         assert_true(services.length > 0, "services not found");
58
59         conversionTable = getTypeConversionExceptions("functionObject", true);
60
61         for (i = 0; i < conversionTable.length; i++) {
62             incorrectCallback = conversionTable[i][0];
63             exceptionName = conversionTable[i][1];
64
65             assert_throws({
66                 name: exceptionName
67             }, function () {
68                 services[0].messageStorage.findConversations(toFilter, findConversationsCallback, incorrectCallback);
69             });
70         }
71         return this_test.done();
72     });
73
74     onError = this_test.step_func(function (err) {
75         assert_unreached("Unexpected onError: " + err.message);
76     });
77
78     tizen.messaging.getMessageServices("messaging.sms", getMessagingServicesCallback, onError);
79 });
80
81 </script>
82 </body>
83 </html>