f6e28dbe35347137485e88df32c53c9330d38083
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2016 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 Authors:
18         Ran Wang <ran22.wang@samsung.com>
19
20 -->
21 <html>
22 <head>
23 <title>PreferenceManager_setChangeListener_onsuccess_invalid_cb</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
26 </head>
27 <body>
28 <div id="log"></div>
29 <script>
30 //==== TEST: PreferenceManager_setChangeListener_onsuccess_invalid_cb
31 //==== LABEL Check if PreferenceManager::setChangeListener throws exception when onsuccess has non callable attributes
32 //==== SPEC Tizen Web API:TBD:Preference:PreferenceManager:setChangeListener M
33 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/preference.html
34 //==== PRIORITY P2
35 //==== TEST_CRITERIA MTL
36
37 setup({timeout: 90000});
38
39 var t = async_test(document.title, {timeout: 90000}), incorrectListeners, changeCallback, i, exceptionName;
40
41 t.step(function () {
42     incorrectListeners = getListenerConversionExceptions("onsuccess");
43     for(i = 0; i < incorrectListeners.length; i++) {
44         changeCallback  = incorrectListeners[i][0];
45         exceptionName = incorrectListeners[i][1];
46         assert_throws({name: exceptionName},
47             function () {
48                 tizen.preference.setValue('key1', 'Sample value');
49                 tizen.preference.setChangeListener('key1', changeCallback);
50             }, "Given invalid changeCallback.");
51     }
52     t.done();
53 });
54
55 </script>
56 </body>
57 </html>