af4eabcdbbabdb475be7358e2aedaa6df4bf1d5c
[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
27 <head>
28 <title> SystemSettingManager_setProperty_NOTIFICATION_EMAIL</title>
29 <script src="../resources/unitcommon.js"></script>
30 <script src="support/systemsetting_common.js"></script>
31 </head>
32 <body>
33 <div id="log"></div>
34 <script type="text/javascript">
35
36 //==== TEST: SystemSettingManager_setProperty_NOTIFICATION_EMAIL
37 //==== LABEL check if setProperty works for NOTIFICATION_EMAIL
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 MOA MAST MR
41 var t = async_test("SystemSettingManager_setProperty_NOTIFICATION_EMAIL"), type = "NOTIFICATION_EMAIL",
42     previousValue, getPreviousValueCallback, newValue = SOUND_FILE_PATH,
43     setNewValueSuccessCallback, getNewValueSuccessCallback, returnedValue = null,
44     setPreviousValueSuccessCallback, exception, getPropertyError, setPropertyNewError,
45     getPropertyNewError, 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, "New value set incorrectly.");
63         } catch (e) {
64             exception = e;
65         } finally {
66             tizen.systemsetting.setProperty(type, previousValue, setPreviousValueSuccessCallback, setPropertyPreviousError);
67         }
68     });
69
70     getPropertyNewError = t.step_func(function (error) {
71         assert_unreached("getPropertyNewError() error: " + error.name + ": " + error.message);
72     });
73
74     setNewValueSuccessCallback = t.step_func(function () {
75         tizen.systemsetting.getProperty(type, getNewValueSuccessCallback, getPropertyNewError);
76     });
77
78     setPropertyNewError = t.step_func(function (error) {
79         assert_unreached("setPropertyNewError() error: " + error.name + ": " + error.message);
80     });
81
82     getPreviousValueCallback = t.step_func(function (value) {
83         previousValue = value;
84         returnedValue = tizen.systemsetting.setProperty(type, newValue, setNewValueSuccessCallback, setPropertyNewError);
85         assert_equals(returnedValue, undefined, "Incorrect value returned from setProperty method.");
86     });
87
88     getPropertyError = t.step_func(function (error) {
89         assert_unreached("getProperty() error: " + error.name + ": " + error.message);
90     });
91
92     tizen.systemsetting.getProperty(type, getPreviousValueCallback, getPropertyError);
93 });
94
95 </script>
96 </body>
97 </html>