4ff5a0889de917c06535cfd0b4b7bd00cea25eca
[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>
24
25 <head>
26 <title>MessageStorage_mms_findConversations_filter_messageCount</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_mms_findConversations_filter_messageCount
37 //==== LABEL check whether 'findConversations' method properly retrieves conversations matching the supplied 'messageCount' filter from MessageStorage
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
42 //==== TEST_CRITERIA MOA MR
43 setup({timeout: 90000});
44
45 var t = async_test("MessageStorage_mms_findConversations_filter_messageCount", {timeout: 90000}),
46     serviceError, serviceSuccess, service, message, sendError, sendSuccess, messageCountFilter,
47     returnedValue = null, findError, findSuccess, i;
48 t.step(function () {
49
50     findSuccess = t.step_func(function (conversations) {
51         assert_equals(returnedValue, undefined, "Incorrect returned value");
52         assert_type(conversations, "array", "Not an array");
53         assert_greater_than(conversations.length, 0, "Received empty conversations array");
54         for(i = 0; i < conversations.length; i++) {
55             assert_type(conversations[i].messageCount, "unsigned long", "messageCount is not unsigned long");
56         }
57         t.done();
58     });
59
60     findError = t.step_func(function (error) {
61         assert_unreached("findConversations() error callback: name:" + error.name + ", msg:" + error.message);
62     });
63
64     sendSuccess = t.step_func(function () {
65         messageCountFilter = new tizen.AttributeFilter("messageCount", "EXISTS");
66         returnedValue = service.messageStorage.findConversations(messageCountFilter, findSuccess, findError);
67     });
68
69     sendError = t.step_func(function (error) {
70         assert_unreached("sendMessage() error callback: name:" + error.name + ", msg:" + error.message);
71     });
72
73     serviceSuccess = t.step_func(function (services) {
74         assert_greater_than(services.length, 0, "Received empty services array");
75         service = services[0];
76
77         message = new tizen.Message("messaging.mms", mmsMessageInitDict);
78         service.sendMessage(message, sendSuccess, sendError);
79     });
80
81     serviceError = t.step_func(function (error) {
82         assert_unreached("getMessageServices() error callback: name:" + error.name + ", msg:" + error.message);
83     });
84
85     tizen.messaging.getMessageServices("messaging.mms", serviceSuccess, serviceError);
86 });
87
88 </script>
89 </body>
90 </html>