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 Lukasz Bardeli <l.bardeli@samsung.com>
24 <title>MessageStorage_sms_findMessages_from_with_errorCallback</title>
25 <meta charset="utf-8"/>
26 <script type="text/javascript" src="../resources/unitcommon.js"></script>
27 <script type="text/javascript" src="support/messaging_common.js"></script>
33 //==== TEST: MessageStorage_sms_findMessages_from_with_errorCallback
34 //==== LABEL Check with optional arguments findMessages(valid_filter, valid_successCallback, valid_errorCallback) from for sms
35 //==== SPEC Tizen Web API:Communication:Messaging:MessageStorage:findMessages M
36 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
37 //==== ONLOAD_DELAY 90
38 //==== TEST_CRITERIA MOA MR
39 setup({timeout: 90000});
41 var t = async_test("MessageStorage_sms_findMessages_from_with_errorCallback", {timeout: 90000}),
42 serviceSuccess, serviceError, service, returnedValue = null, filter, findSuccessCB, findErrorCB,
46 findSuccessCB = t.step_func(function (messages) {
47 assert_equals(returnedValue, undefined, "Incorrect returned value");
49 for (i = 0; i < messages.length; i++) {
50 assert_not_equals(messages[i].from, null, "from is null");
51 fromFound = messages[i].from.indexOf(TEST_SMS_RECIPIENT);
52 assert_greater_than_equal(fromFound, 0, "Recipient not found");
58 findErrorCB = t.step_func(function (error) {
59 assert_unreached("findMessages() error callback: name:" + error.name + ", msg:" + error.message);
62 serviceSuccess = t.step_func(function (services) {
63 assert_greater_than(services.length, 0, "Received empty services array");
64 service = services[0];
66 filter = new tizen.AttributeFilter("from", "CONTAINS", TEST_SMS_RECIPIENT);
67 returnedValue = service.messageStorage.findMessages(filter, findSuccessCB, findErrorCB);
70 serviceError = t.step_func(function (error) {
71 assert_unreached("getMessageServices() error callback: name:" + error.name + ", msg:" + error.message);
74 tizen.messaging.getMessageServices("messaging.sms", serviceSuccess, serviceError);