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.
19 Andrzej Krolikowski <a.krolikowsk@samsung.com>
24 <title>SQLDataControlConsumer_insert_without_errorCallback</title>
25 <meta charset="utf-8"/>
26 <script type="text/javascript" src="support/unitcommon.js"></script>
27 <script src="support/datacontrol_common.js"></script>
33 //==== TEST: SQLDataControlConsumer_insert_without_errorCallback
34 //==== LABEL Check SQLDataControlConsumer.insert method without errorCallback
35 //==== SPEC Tizen Web API:TBD:Datacontrol:SQLDataControlConsumer:insert M
36 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/datacontrol.html
37 //==== ONLOAD_DELAY 30
38 //==== TEST_CRITERIA MR MOA MAST
41 setup({timeout: 30000});
43 var t = async_test(document.title, {timeout: 30000}), globalDataControl,
44 globalReqId = generateGlobalReqId(), currentDate = new Date().getTime().toString(), selectError, insertSuccess,
45 selectSuccess, rowData, returnedValue = null, descriptionToSet = currentDate + "_desc";
49 columns: ["WORD", "WORD_DESC"],
50 values: ["'" + currentDate + "'", "'" + descriptionToSet + "'"]
53 selectSuccess = t.step_func(function (rows, reqId) {
54 assert_equals(rows.length, 1, "Incorrect number of rows.");
55 assert_array_equals(rows[0].columns, rowData.columns, "Incorrect columns");
56 assert_array_equals(rows[0].values, [currentDate, descriptionToSet], "Incorrect values");
60 selectError = t.step_func(function (reqId, error) {
61 assert_unreached("select() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
64 insertSuccess = t.step_func(function (reqId, insertRowId) {
65 assert_equals(returnedValue, undefined, "Incorrect returned value");
66 assert_equals(reqId, globalReqId, "incorrect request id");
67 assert_type(reqId, "unsigned long", "reqId is not unsigned long");
68 assert_type(insertRowId, "long", "insertRowId is not long.");
71 globalDataControl.select(globalReqId, rowData.columns,
72 rowData.columns[0] + "=" + rowData.values[0], selectSuccess, selectError);
75 globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID, DATA_ID, TYPE_SQL);
76 returnedValue = globalDataControl.insert(globalReqId, rowData, insertSuccess);