03c91cae2b5d9fd7cb3bf286eb5712d3f8f49b9d
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2
3 <!--
4
5 Copyright (c) 2013 Samsung Electronics Co., Ltd.
6
7 Licensed under the Apache License, Version 2.0 (the License);
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11     http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19
20
21 Authors:
22         Mariusz Polasinski <m.polasinski@samsung.com>
23
24
25 -->
26
27 <html lang="en">
28
29 <head>
30 <title>MappedDataControlConsumer_updateValue_errorCallback_invalid_cb</title>
31 <meta charset="utf-8">
32 <script type="text/javascript" src="../resources/unitcommon.js"></script>
33 <script src="support/datacontrol_common.js"></script>
34 </head>
35
36 <body>
37 <div id="log"></div>
38 <script type="text/javascript">
39
40 //==== TEST: MappedDataControlConsumer_updateValue_errorCallback_invalid_cb
41 //==== LABEL check if an exception was thrown when a fake callback (onerror) was passed into updateValue method
42 //==== ONLOAD_DELAY 30
43 //==== SPEC Tizen Web API:TBD:Datacontrol:MappedDataControlConsumer:updateValue M
44 //==== SPEC_URL https://developer.tizen.org/help/index.jsp?topic=/org.tizen.web.device.apireference/tizen/datacontrol.html
45 //==== STEP check if an exception was thrown when a fake callback (onerror) was passed into updateValue method
46 //==== EXPECT an exception should be thrown
47 //==== EXECUTION_TYPE auto
48 //==== PRIORITY P2
49 //==== TEST_CRITERIA MTCB
50
51 setup({timeout: 30000});
52
53 var t = async_test("MappedDataControlConsumer_updateValue_errorCallback_invalid_cb", {timeout: 30000}), globalDataControl,
54     globalReqId = generateGlobalReqId(), currentDate = new Date().getTime().toString(), updateSuccess, updatedValue = currentDate + "updatedValue",
55     key =  currentDate, value = currentDate + "value", addSuccess, addError, updateError, updateErrorFunc;
56 t.step(function () {
57
58     updateError = t.step_func(function (reqId, error) {
59         assert_unreached("updateValue() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
60     });
61
62     updateError = {onerror: updateErrorFunc};
63
64     updateSuccess = t.step_func(function () {
65         assert_unreached("this function should not be used");
66     });
67
68     addSuccess = t.step_func(function () {
69         assert_throws({name: "TypeMismatchError"}, function () {
70             globalDataControl.updateValue(globalReqId, key, value, updatedValue, updateSuccess, updateError);
71         }, "exception should be thrown");
72         t.done();
73     });
74
75     addError = t.step_func(function (reqId, error) {
76         assert_unreached("addValue() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
77     });
78
79     globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID, DATA_ID, TYPE_MAP);
80     globalDataControl.addValue(globalReqId, key, value, addSuccess, addError);
81
82 });
83
84 </script>
85 </body>
86 </html>