e6f879828f3bda7a9320cf09e7964ad6eea75361
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2013 Samsung Electronics Co., Ltd.
4
5 Licensed under the Apache License, Version 2.0 (the License);
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17
18 Authors:
19         Lukasz Bardeli <l.bardeli@samsung.com>
20
21 -->
22 <html>
23 <head>
24 <title>Messaging_getMessageServices_messageServiceType_TypeMismatch</title>
25 <meta charset="utf-8"/>
26 <script type="text/javascript" src="support/unitcommon.js"></script>
27 <script type="text/javascript" src="support/messaging_common.js"></script>
28 </head>
29
30 <body>
31 <div id="log"></div>
32 <script>
33 //==== TEST: Messaging_getMessageServices_messageServiceType_TypeMismatch
34 //==== LABEL Check type conversions for messageServiceType argument of Messaging.getMessageServices method
35 //==== PRIORITY: P2
36 //==== ONLOAD_DELAY 180
37 //==== TIMEOUT 180
38 //==== SPEC Tizen Web API:Communication:Messaging:Messaging:getMessageServices M
39 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
40 //==== TEST_CRITERIA MC
41 setup({timeout: 180000});
42
43 var t = async_test(document.title, {timeout: 180000}),
44     serviceSuccess, serviceError, conversionTable, i, invalidType, exceptionName;
45
46 t.step(function () {
47     serviceSuccess = t.step_func(function (services) {
48         assert_unreached("Shouldn't be here");
49     });
50
51     serviceError = t.step_func(function (error) {
52         assert_unreached("getMessageServices() error callback: name:" + error.name + ", msg:" + error.message);
53     });
54
55     conversionTable = getTypeConversionExceptions("enum", false);
56
57     for(i = 0; i < conversionTable.length; i++) {
58         invalidType = conversionTable[i][0];
59         exceptionName = conversionTable[i][1];
60
61         assert_throws ({name: exceptionName},
62             function () {
63                 tizen.messaging.getMessageServices(invalidType, serviceSuccess, serviceError);
64             }, "Constructed object with invalid MessageServiceType - " + invalidType);
65     }
66
67     t.done();
68 });
69
70 </script>
71 </body>
72 </html>