fbc2203748698d5124403ae934af63716a9c413c
[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         Karol Surma <k.surma@samsung.com>
33         Krzysztof Lachacz <k.lachacz@samsung.com>
34 -->
35
36 <html>
37 <head>
38 <title>MessageService_email_loadMessageBody_errorCallback_TypeMismatch</title>
39 <script src="support/unitcommon.js"></script>
40 <script src="support/messaging_common.js"></script>
41 </head>
42
43 <body>
44 <div id="log"></div>
45 <script type="text/javascript">
46 //==== TEST: MessageService_email_loadMessageBody_errorCallback_TypeMismatch
47 //==== LABEL Check type conversions for errorCallback argument of MessageService.loadMessageBody method (email)
48 //==== PRIORITY: P2
49 //==== ONLOAD_DELAY 300
50 //==== TIMEOUT 300
51 //==== SPEC Tizen Web API:Communication:Messaging:MessageService:loadMessageBody M
52 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
53 //==== TEST_CRITERIA MC
54 setup({timeout: 90000});
55
56 var t = async_test(document.title, {timeout: 90000}),
57     serviceSuccess, serviceError, message, addDraftSuccess, addDraftError,
58     loadMessageBodySuccess, service, i, param, conversionTable, exceptionName;
59
60 t.step(function () {
61     loadMessageBodySuccess = t.step_func(function (message) {
62         assert_unreached("sould not be called");
63     });
64
65     addDraftSuccess = t.step_func(function () {
66         conversionTable = getTypeConversionExceptions("functionObject", true);
67         for(i = 0; i < conversionTable.length; i++) {
68             param = conversionTable[i][0];
69             exceptionName = conversionTable[i][1];
70
71             assert_throws({name: exceptionName},
72             function () {
73                 service.loadMessageBody(message, loadMessageBodySuccess, param);
74             }, exceptionName + " should be thrown " + param);
75         }
76         t.done();
77     });
78
79     addDraftError = t.step_func(function (error) {
80         assert_unreached("addDraftMessage error callback called: " + error.name + " with message: " + error.message);
81     });
82
83     serviceSuccess = t.step_func(function (emailService) {
84         service = emailService;
85
86         message = createSimpleMessageTo(TEST_EMAIL_RECIPIENT_2);
87
88         service.messageStorage.addDraftMessage(message, addDraftSuccess, addDraftError);
89     });
90
91     serviceError = t.step_func(function (error) {
92         assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
93     });
94
95     getEmailService(t, serviceSuccess, serviceError);
96 });
97
98 </script>
99 </body>
100 </html>