f13b077eb4c7e0116224a00b06a5c3bcb83c8dca
[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_invalid_cb</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_invalid_cb
47 //==== LABEL Check if MessageService.loadMessageBody method throws exception when errorCallback is invalid (email)
48 //==== PRIORITY: P2
49 //==== SPEC Tizen Web API:Communication:Messaging:MessageService:loadMessageBody M
50 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
51 //==== TEST_CRITERIA MTCB
52 //==== ONLOAD_DELAY 300
53 //==== TIMEOUT 300
54 setup({timeout: 90000});
55
56 var t = async_test(document.title, {timeout: 90000}),
57     serviceSuccess, serviceError, message, addDraftSuccess, addDraftError,
58     loadMessageBodySuccess, incorrectCallback, service;
59
60 t.step(function () {
61     loadMessageBodySuccess = t.step_func(function () {
62         assert_unreached("loadMessageBody() success callback invoked");
63     });
64
65     incorrectCallback = {
66         onerror: t.step_func(function (error) {
67             assert_unreached("Incorrect errorCallback invoked: " + error.name + ": " + error.message);
68         })
69     };
70
71     addDraftSuccess = t.step_func(function (){
72         assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
73             service.loadMessageBody(message, loadMessageBodySuccess, incorrectCallback);
74         });
75         t.done();
76     });
77
78     addDraftError = t.step_func(function (error) {
79         assert_unreached("addDraftMessage error callback called: " + error.name + " with message: " + error.message);
80     });
81
82     serviceSuccess = t.step_func(function (emailService) {
83         service = emailService;
84
85         message = createSimpleMessageTo(TEST_EMAIL_RECIPIENT_2);
86
87         service.messageStorage.addDraftMessage(message, addDraftSuccess, addDraftError);
88     });
89
90     serviceError = t.step_func(function (error) {
91         assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
92     });
93
94     getEmailService(t, serviceSuccess, serviceError);
95 });
96
97 </script>
98 </body>
99 </html>