d0d9b542e34baba03a89cf1483308a3b19ec6590
[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 Authors:
19         Beata Koziarek <b.koziarek@samsung.com>
20
21 -->
22
23 <html>
24 <head>
25 <title>MessageService_syncFolder_successCallback_TypeMismatch</title>
26 <script type="text/javascript" src="../resources/unitcommon.js"></script>
27 <script type="text/javascript" src="support/messaging_common.js"></script>
28 </head>
29 <body>
30 <div id="log"></div>
31 <script type="text/javascript">
32 //==== TEST: MessageService_syncFolder_successCallback_TypeMismatch
33 //==== LABEL: Check argument successCallback conversions exception for syncFolder method.
34 //==== PRIORITY: P2
35 //==== SPEC: Tizen Web API:Communication:Messaging:MessageService:syncFolder M
36 //==== SPEC_URL: https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
37 //==== TEST_CRITERIA MC
38 //==== ONLOAD_DELAY 180
39 //==== TIMEOUT 180
40 setup({timeout: 180000});
41
42 var t = async_test("MessageService_syncFolder_successCallback_TypeMismatch", {timeout: 180000}),
43     serviceSuccess, serviceError, service, findSuccess, findError,
44     exceptionName, conversionTable, i, successCallback;
45
46 t.step(function () {
47     findSuccess = t.step_func(function (folders) {
48         assert_true(folders.length > 0, "No folder found.");
49     
50         conversionTable = getTypeConversionExceptions("functionObject", true);
51         
52         for (i = 0; i < conversionTable.length; i++) {
53             successCallback = conversionTable[i][0];
54             exceptionName = conversionTable[i][1];
55
56             assert_throws({name : exceptionName}, function () {
57                 service.syncFolder(folders[0], successCallback);
58             }, exceptionName + " should be thrown - given incorrect successCallback.");
59         }
60
61         t.done();
62     });
63
64     findError = t.step_func(function (error) {
65         assert_unreached("findFolders() error callback: name:" + error.name + ", msg:" + error.message);
66     });
67
68     serviceSuccess = t.step_func(function (emailService) {
69         service = emailService;
70         findFolders(t, service, findSuccess, findError);
71     });
72
73     serviceError = t.step_func(function (error) {
74         assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
75     });
76
77     getEmailService(t, serviceSuccess, serviceError);
78 });
79 </script>
80 </body>
81 </html>