8a462e035ed1b18f6c7a65afb2e48a14a4d33ea7
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2014 Samsung Electronics Co., Ltd.
4
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
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
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.
16
17 Authors:
18         Saud Mohammad Mostafa <saud.mm@samsung.com>
19
20 -->
21 <html>
22 <head>
23 <title>SQLDataControlConsumer_remove_errorCallback_invoked</title>
24 <meta charset="utf-8"/>
25 <script type="text/javascript" src="support/unitcommon.js"></script>
26 <script src="support/datacontrol_common.js"></script>
27 </head>
28 <body>
29 <div id="log"></div>
30 <script>
31 //==== TEST: SQLDataControlConsumer_remove_errorCallback_invoked
32 //==== LABEL Check exception in error callback of remove method
33 //==== PRIORITY P2
34 //==== SPEC Tizen Web API:TBD:Datacontrol:SQLDataControlConsumer:remove M
35 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/datacontrol.html
36 //==== TEST_CRITERIA MERRCB
37
38 setup({timeout: 30000});
39 var t = async_test(document.title, {timeout: 30000}), globalDataControl, globalReqId = generateGlobalReqId(),
40     currentDate, insertSuccess, insertError, rowData;
41
42 t.step(function () {
43     currentDate = new Date().getTime().toString();
44     rowData = {
45         columns: ["WORD", "WORD_DESC"],
46         values: ["'" + currentDate + "'", "'" + currentDate + "_desc'"]
47     };
48
49     removeSuccess = t.step_func(function (rows, reqId) {
50         assert_unreached("remove() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
51     });
52
53     removeError = t.step_func(function (reqId, error) {
54         assert_equals(error.code, 0, "incorrect error code");
55         t.done();
56     });
57
58     insertSuccess = t.step_func(function (reqId, insertRowId) {
59         globalReqId++;
60         globalDataControl.remove(globalReqId, "tizen='123'", removeSuccess, removeError);
61     });
62
63     insertError = t.step_func(function (reqId, error) {
64         assert_unreached("insert() error callback: name:" + error.name + ", msg:" + error.message + " for reqId: " + reqId);
65     });
66
67     globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID, DATA_ID, TYPE_SQL);
68     globalDataControl.insert(globalReqId, rowData, insertSuccess, insertError);
69 });
70
71 </script>
72 </body>
73 </html>