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>SQLDataControlConsumer_update_errorCallback_invalid_cb</title>
31 <meta charset="utf-8">
32 <script type="text/javascript" src="support/unitcommon.js"></script>
33 <script src="support/datacontrol_common.js"></script>
38 <script type="text/javascript">
40 //==== TEST: SQLDataControlConsumer_update_errorCallback_invalid_cb
41 //==== LABEL Check if SQLDataControlConsumer.update method throws exception when errorCallback is invalid
42 //==== ONLOAD_DELAY 30
43 //==== SPEC Tizen Web API:TBD:Datacontrol:SQLDataControlConsumer:update M
44 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/datacontrol.html
46 //==== TEST_CRITERIA MTCB
48 setup({timeout: 30000});
50 var t = async_test(document.title, {timeout: 30000}), globalDataControl,
51 globalReqId = generateGlobalReqId(), currentDate = new Date().getTime().toString(), rowData, rowDataUpdate,
52 insertSuccess, updateSuccess, insertError, invalidCallback;
56 columns: ["WORD", "WORD_DESC"],
57 values: ["'" + currentDate + "'", "'" + currentDate + "_desc'"]
61 columns: ["WORD", "WORD_DESC"],
62 values: ["'" + currentDate + "_update'", "'" + currentDate + "_desc_update'"]
65 updateSuccess = t.step_func(function () {
66 assert_unreached("update() success callback invoked");
70 onerror: t.step_func(function (reqId, error) {
71 assert_unreached("update() invalid error callback invoked");
75 insertSuccess = t.step_func(function (reqId, insertRowId) {
77 assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
78 globalDataControl.update(globalReqId, rowDataUpdate,
79 rowData.columns[0] + "=" + rowData.values[0], updateSuccess, invalidCallback);
80 }, "exception should be thrown");
84 insertError = t.step_func(function (reqId, error) {
85 assert_unreached("insert() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
88 globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID, DATA_ID, TYPE_SQL);
89 globalDataControl.insert(globalReqId, rowData, insertSuccess, insertError);