0ed9f43bd46a930cc03b6e74014b7d6292e4b84f
[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_no_errorCallback</title>
28 <script src="support/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 //==== TEST: SystemSettingManager_setProperty_no_errorCallback
35 //==== LABEL Check if setProperty works for home_screen without error_callback
36 //==== SPEC Tizen Web API:System:SystemSetting:SystemSettingManager:setProperty M
37 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/systemsetting.html
38 //==== PRIORITY P1
39 //==== TEST_CRITERIA MMINA MAST MR
40
41 var t = async_test(document.title), type = "INCOMING_CALL",
42     previousValue, getPreviousValueCallback, newValue = IMAGE_FILE_PATH, newValue2 = IMAGE_FILE_PATH2, newValue_check,
43     setNewValueSuccessCallback, getNewValueSuccessCallback, returnedValue = null,
44     getNewValueSuccessCallback, setPreviousValueSuccessCallback, exception, getPropertyError,
45     setPropertyPreviousError;
46
47 t.step(function () {
48     setPropertyPreviousError = t.step_func(function (error) {
49         assert_unreached("setPropertyPreviousError() error: " + error.name + ": " + error.message);
50     });
51
52     setPreviousValueSuccessCallback = t.step_func(function () {
53         if (exception !== undefined){
54             throw exception;
55         }
56         t.done();
57     });
58
59     getNewValueSuccessCallback = t.step_func(function (value) {
60         try {
61             assert_not_equals(value, previousValue, "New value set incorrectly.");
62             assert_equals(value, newValue_check, "New value set incorrectly.");
63         } catch (e) {
64             exception = e;
65         } finally {
66             if(newValue_check == newValue2){
67                 tizen.systemsetting.setProperty(type, newValue, setPreviousValueSuccessCallback, setPropertyPreviousError);
68             }
69             else{
70                 tizen.systemsetting.setProperty(type, newValue2, setPreviousValueSuccessCallback, setPropertyPreviousError);
71             }
72         }
73     });
74
75     setNewValueSuccessCallback = t.step_func(function () {
76         assert_equals(returnedValue, undefined, "Incorrect value returned from setProperty method.");
77         tizen.systemsetting.getProperty(type, getNewValueSuccessCallback);
78     });
79
80     getPreviousValueCallback = t.step_func(function (value) {
81         if(value == newValue){
82             previousValue = value;
83             newValue_check = newValue2;
84             returnedValue = tizen.systemsetting.setProperty(type, newValue2, setNewValueSuccessCallback);
85         }
86         else{
87             previousValue = value;
88             newValue_check = newValue;
89             returnedValue = tizen.systemsetting.setProperty(type, newValue, setNewValueSuccessCallback);
90         }
91     });
92
93     setNewValueSuccessCallback1 = t.step_func(function () {
94         assert_equals(returnedValue, undefined, "Incorrect value returned from setProperty method.");
95         tizen.systemsetting.getProperty(type, getPreviousValueCallback, getPropertyError);
96     });
97
98     setPropertyNewError = t.step_func(function (error) {
99         assert_unreached("setPropertyNewError() error: " + error.name + ": " + error.message);
100     });
101
102     getPropertyError = t.step_func(function (error) {
103         if(error.name == "UnknownError"){
104             returnedValue = tizen.systemsetting.setProperty(type, newValue, setNewValueSuccessCallback1, setPropertyNewError);
105         }
106         else{
107             assert_unreached("getProperty() error: " + error.name + ": " + error.message);
108         }
109     });
110
111     tizen.systemsetting.getProperty(type, getPreviousValueCallback, getPropertyError);
112 });
113
114 </script>
115 </body>
116 </html>