5 Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
11 http://www.apache.org/licenses/LICENSE-2.0
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.
22 Mariusz Polasinski <m.polasinski@samsung.com>
30 <title>MappedDataControlConsumer_updateValue_errorCallback_TypeMismatch</title>
31 <meta charset="utf-8">
32 <script type="text/javascript" src="../resources/unitcommon.js"></script>
33 <script src="support/datacontrol_common.js"></script>
38 <script type="text/javascript">
40 //==== TEST: MappedDataControlConsumer_updateValue_errorCallback_TypeMismatch
41 //==== LABEL check optional argument errorCallback (updateValue method) type conversion
42 //==== ONLOAD_DELAY 30
43 //==== SPEC Tizen Web API:TBD:Datacontrol:MappedDataControlConsumer:updateValue M
44 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/datacontrol.html
46 //==== TEST_CRITERIA MC
48 setup({timeout: 30000});
50 var t = async_test("MappedDataControlConsumer_updateValue_errorCallback_TypeMismatch", {timeout: 30000}), i, globalDataControl,
51 globalReqId = generateGlobalReqId(), currentDate = new Date().getTime().toString(), updateSuccess, updatedValue = currentDate + "updatedValue",
52 key = currentDate, value = currentDate + "value", addSuccess, addError, conversionTable = getTypeConversionExceptions("functionObject",
56 updateSuccess = t.step_func(function () {
57 assert_unreached("updateValue() success callback invoked");
60 addSuccess = t.step_func(function () {
61 for (i = 0; i < conversionTable.length; i++) {
63 assert_throws({name: conversionTable[i][1]}, function () {
64 globalDataControl.updateValue(globalReqId, key, value, updatedValue, updateSuccess, conversionTable[i][0]);
65 }, "exception should be thrown. Given - " + conversionTable[i][0]);
70 addError = t.step_func(function (reqId, error) {
71 assert_unreached("addValue() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
74 globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID, DATA_ID, TYPE_MAP);
75 globalDataControl.addValue(globalReqId, key, value, addSuccess, addError);