3 Copyright (c) 2014 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 Le Qi <le82.qi@samsung.com>
23 <title>MessageStorage_sms_findConversations_filter_to_exist</title>
24 <meta charset="utf-8">
25 <script type="text/javascript" src="support/unitcommon.js"></script>
26 <script type="text/javascript" src="support/messaging_common.js"></script>
31 //==== TEST: MessageStorage_sms_findConversations_filter_to_exist
32 //==== LABEL Check if MessageStorage::findConversations method works properly with filter: to exist.
34 //==== SPEC Tizen Web API:Communication:Messaging:MessageStorage:findConversations M
35 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
36 //==== ONLOAD_DELAY 90
37 //==== TEST_CRITERIA MR
39 setup({timeout: 90000});
41 var t = async_test(document.title, {timeout: 90000}),
42 serviceSuccess, serviceError,
43 addDraftSuccess, addDraftError,
44 conversationSuccess, conversationError,
45 service, newMessage, filter, sortMode, removeAllSuccess;
49 conversationSuccess = t.step_func(function (conversations) {
50 assert_greater_than(conversations.length, 0, "Received empty conversations array");
54 conversationError = t.step_func(function (error) {
55 assert_unreached("findConversations() error callback: name:" + error.name + ", msg:" + error.message);
58 addDraftSuccess = t.step_func(function () {
59 filter = new tizen.AttributeFilter("to", "EXISTS", "008");
60 sortMode = new tizen.SortMode("to", "ASC");
61 service.messageStorage.findConversations(filter, conversationSuccess, conversationError, sortMode);
64 addDraftError = t.step_func(function (error) {
65 assert_unreached("addDraftMessage() error callback: name:" + error.name + ", msg:" + error.message);
68 removeAllSuccess = t.step_func(function () {
69 newMessage = new tizen.Message(service.type, {
70 plainBody: "I will arrive in 10 minutes.",
71 to: [ "+18606666666", "+18608888888", "+10086"]
73 service.messageStorage.addDraftMessage(newMessage, addDraftSuccess, addDraftError);
76 serviceError = t.step_func(function (error) {
77 assert_unreached("getMessageServices() error callback: name:" + error.name + ", msg:" + error.message);
80 serviceSuccess = t.step_func(function (services) {
81 assert_greater_than(services.length, 0, "Received empty services array");
82 service = services[0];
83 removeAllMessages(t, service, removeAllSuccess);
86 tizen.messaging.getMessageServices("messaging.sms", serviceSuccess, serviceError);