3 Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
9 http://www.apache.org/licenses/LICENSE-2.0
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.
18 Krzysztof Lachacz <k.lachacz@samsung.com>
24 <title>MappedDataControlConsumer_addValue_with_successCallback</title>
25 <script src="../resources/unitcommon.js"></script>
26 <script src="support/datacontrol_common.js"></script>
31 <script type="text/javascript">
32 //==== TEST: MappedDataControlConsumer_addValue_with_successCallback
33 //==== LABEL Check if addValue method called with optional successCallback does what it should
34 //==== SPEC Tizen Web API:TBD:Datacontrol:MappedDataControlConsumer:addValue M
35 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/datacontrol.html
36 //==== ONLOAD_DELAY 30
37 //==== TEST_CRITERIA MR MOA MAST
38 setup({timeout: 30000});
40 var t = async_test("MappedDataControlConsumer_addValue_with_successCallback", {timeout: 30000}),
41 addSuccessCallback, getSuccessCallback, getErrorCallback, dataConsumer, globalReqId = generateGlobalReqId(),
42 currentDate = new Date().getTime().toString(), value = "samsung", returnedValue;
45 dataConsumer = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID, DATA_ID, TYPE_MAP);
47 getSuccessCallback = t.step_func(function (values, reqId) {
48 assert_equals(values.length, 1, "value is not set");
49 assert_equals(values[0], value, "value is not set");
53 getErrorCallback = t.step_func(function (reqId, error) {
54 assert_unreached("getValue() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
57 addSuccessCallback = t.step_func(function (reqId) {
58 assert_equals(returnedValue, undefined, "Incorrect returned value");
59 assert_equals(reqId, globalReqId, "Incorrect request id");
61 dataConsumer.getValue(globalReqId, currentDate, getSuccessCallback, getErrorCallback);
63 returnedValue = dataConsumer.addValue(globalReqId, currentDate, value, addSuccessCallback);