f45cc2ee75dba167bf902da4e67b4d168970b430
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2012 Intel Corporation.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8 * Redistributions of works must retain the original copyright notice, this list
9   of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the original copyright notice,
11   this list of conditions and the following disclaimer in the documentation
12   and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14   may be used to endorse or promote products derived from this work without
15   specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 Authors:
29         Li, Li <li.l.li@intel.com>
30         Zoe, Zou <zoex.zou@intel.com>
31         Ma, YueX <yuex.ma@intel.com>
32
33 -->
34
35 <html>
36 <head>
37 <title>MessageStorage_email_findConversations_without_errorCallback</title>
38 <script type="text/javascript" src="support/unitcommon.js"></script>
39 <script type="text/javascript" src="support/messaging_common.js"></script>
40 </head>
41 <body>
42 <div id="log"></div>
43 <script type="text/javascript">
44 //==== TEST: MessageStorage_email_findConversations_without_errorCallback
45 //==== LABEL Check if MessageStorage.findConversations method works properly without errorCallback argument (email)
46 //==== ONLOAD_DELAY 180
47 //==== TIMEOUT 180
48 //==== SPEC Tizen Web API:Communication:Messaging:MessageStorage:findConversations M
49 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
50 //==== TEST_CRITERIA MMINA
51 setup({timeout: 180000});
52
53 var t = async_test(document.title, {timeout: 180000}), i,
54     serviceSuccess, serviceError, service, message, filter, addDraftError, findConversationsSuccess;
55
56 t.step(function () {
57     findConversationsSuccess = t.step_func(function (conversations) {
58         assert_type(conversations, "array", "Not an array");
59         assert_greater_than(conversations.length, 0, "Received empty messages array");
60
61         for (i = 0; i < conversations.length; i++) {
62             assert_equals(conversations[i].type, service.type, "Incorrect service type");
63         }
64
65         t.done();
66     });
67
68     addDraftError = t.step_func(function (error) {
69         assert_unreached("addDraftMessage() error callback: name:" + error.name + ", msg:" + error.message);
70     });
71
72     serviceSuccess = t.step_func(function (emailService) {
73         service = emailService;
74
75         message = createSimpleMessageTo(TEST_EMAIL_RECIPIENT_2);
76         service.messageStorage.addDraftMessage(message, null, addDraftError);
77
78         filter = new tizen.AttributeFilter("type", "EXACTLY", service.type);
79         service.messageStorage.findConversations(filter, findConversationsSuccess);
80     });
81
82     serviceError = t.step_func(function (error) {
83         assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
84     });
85
86     getEmailService(t, serviceSuccess, serviceError);
87 });
88
89 </script>
90 </body>
91 </html>