cb9dee26bec5037af2bc5e66cc1d391346c8d0ad
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2014 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         Zhao Dong<dong82.zhao@samsung.com>
19
20 -->
21 <html>
22 <head>
23 <title>MessageStorage_email_findConversations_sort_TypeMismatch</title>
24 <meta charset="utf-8">
25 <script type="text/javascript" src="support/unitcommon.js"></script>
26 <script type="text/javascript" src="support/messaging_common.js"></script>
27 </head>
28 <body>
29 <div id="log"></div>
30 <script>
31 //==== TEST: MessageStorage_email_findConversations_sort_TypeMismatch
32 //==== LABEL Check type conversions for sort argument of MessageStorage::findConversations method (email)
33 //==== PRIORITY P2
34 //==== ONLOAD_DELAY 90
35 //==== SPEC Tizen Web API:Communication:Messaging:MessageStorage:findConversations M
36 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
37 //==== TEST_CRITERIA MC
38
39 setup({timeout: 90000});
40
41 var t = async_test(document.title, {timeout: 90000}), toFilter, findConversationsCallback, errorCallback, getMessagingServicesCallback,
42     onError, i, incorrectSort, conversionTable, exceptionName;
43
44 t.step(function () {
45
46     toFilter = new tizen.AttributeFilter("to", "CONTAINS", TEST_EMAIL_RECIPIENT_2);
47
48     findConversationsCallback = t.step_func(function () {
49         assert_unreached("Unexpected findConversationsCallback");
50     });
51
52     errorCallback = t.step_func(function (err) {
53         assert_unreached("Unexpected errorCallback: " + err.message);
54     });
55
56     getMessagingServicesCallback = t.step_func(function (services) {
57         assert_true(services.length > 0, "services not found");
58         conversionTable = getTypeConversionExceptions("object", true);
59         for (i = 0; i < conversionTable.length; i++) {
60             incorrectSort = conversionTable[i][0];
61             exceptionName = conversionTable[i][1];
62
63             assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
64                 services[0].messageStorage.findConversations(toFilter, findConversationsCallback, errorCallback, incorrectSort);
65             });
66         }
67         t.done();
68     });
69
70     onError = t.step_func(function (err) {
71         assert_unreached("Unexpected onError: " + err.message);
72     });
73
74     tizen.messaging.getMessageServices("messaging.email", getMessagingServicesCallback, onError);
75 });
76
77 </script>
78 </body>
79 </html>