02e8df02c29f1bca8498ea86073f20612a9eaf70
[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
19
20 Authors:
21         Andrzej Krolikowski <a.krolikowsk@samsung.com>
22
23 -->
24
25 <html>
26 <head>
27 <title>SystemSettingManager_setProperty_errorCallback_TypeMismatch</title>
28 <script src="../resources/unitcommon.js"></script>
29 <script src="support/systemsetting_common.js"></script>
30 </head>
31 <body>
32 <div id="log"></div>
33 <script type="text/javascript">
34
35 //==== TEST: SystemSettingManager_setProperty_errorCallback_TypeMismatch
36 //==== LABEL Check if setProperty throws exception when errorCallback is incorrect
37 //==== PRIORITY: P2
38 //==== SPEC Tizen Web API:System:SystemSetting:SystemSettingManager:setProperty M
39 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/systemsetting.html
40 //==== TEST_CRITERIA MC
41 var t = async_test("SystemSettingManager_setProperty_errorCallback_TypeMismatch"),
42     type = "HOME_SCREEN", propertyValue = IMAGE_FILE_PATH,
43     successCallback, exceptionName, errorCallback, i, conversionTable,
44     getDeviceValueCallback, getDeviceValueErrorCallback, deviceValue;
45
46 t.step(function () {
47     successCallback = t.step_func(function () {
48         assert_unreached("SuccessCallback invoked.");
49     });
50
51     getDeviceValueCallback = t.step_func(function (value) {
52         deviceValue = value;
53         conversionTable = getTypeConversionExceptions("functionObject", true);
54
55         for(i = 0; i < conversionTable.length; i++) {
56             errorCallback = conversionTable[i][0];
57             exceptionName = conversionTable[i][1];
58
59
60             assert_throws({name : exceptionName},
61                 function () {
62                     tizen.systemsetting.setProperty(type,
63                         propertyValue, successCallback, errorCallback);
64                     //if test fail - restore the homescreen background image
65                     tizen.systemsetting.setProperty(type, deviceValue, successCallback);
66                 }, exceptionName + " should be thrown - given incorrect errorCallback - " + errorCallback + ".");
67         }
68
69         t.done();
70     });
71     getDeviceValueErrorCallback = t.step_func(function (error) {
72         assert_unreached("getDeviceValueErrorCallback: " + error.name + ": " + error.message);
73     });
74
75     tizen.systemsetting.getProperty(type, getDeviceValueCallback, getDeviceValueErrorCallback);
76 });
77
78 </script>
79 </body>
80 </html>