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_email_findMessages_isHighPriority_with_errorCallback</title>
25 <meta charset="utf-8"/>
26 <script type="text/javascript" src="support/unitcommon.js"></script>
27 <script type="text/javascript" src="support/messaging_common.js"></script>
33 //==== TEST: MessageStorage_email_findMessages_isHighPriority_with_errorCallback
34 //==== LABEL Check if MessageStorage.findMessages method works properly for filter by isHighPriority (email)
35 //==== ONLOAD_DELAY 180
37 //==== SPEC Tizen Web API:Communication:Messaging:MessageStorage:findMessages M
38 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/messaging.html
39 //==== TEST_CRITERIA MOA
40 setup({timeout: 180000});
42 var t = async_test(document.title, {timeout: 180000}),
43 serviceSuccess, serviceError, service, message, filter, messageFound = false,
44 addDraftSuccess, addDraftError, findSuccess, findError, i;
47 findSuccess = t.step_func(function (messages) {
48 assert_type(messages, "array", "Not an array");
49 assert_greater_than(messages.length, 0, "Received empty messages array");
51 for (i = 0; i < messages.length; i++) {
52 assert_true(messages[i] instanceof tizen.Message, "Not a Message");
53 assert_equals(messages[i].isHighPriority, true, "returned isHighPriority is not equal to true");
55 if (messages[i].id === message.id) {
60 assert_true(messageFound, "expected message wasn't found");
64 findError = t.step_func(function (error) {
65 assert_unreached("findMessages() error callback: name:" + error.name + ", msg:" + error.message);
68 addDraftSuccess = t.step_func(function () {
69 filter = new tizen.AttributeFilter("isHighPriority", "EXACTLY", true);
70 service.messageStorage.findMessages(filter, findSuccess, findError);
73 addDraftError = t.step_func(function (error) {
74 assert_unreached("addDraftMessage() error callback: name:" + error.name + ", msg:" + error.message);
77 serviceSuccess = t.step_func(function (emailService) {
78 service = emailService;
80 message = createSimpleMessageTo(TEST_EMAIL_RECIPIENT_2);
81 message.isHighPriority = true;
83 service.messageStorage.addDraftMessage(message, addDraftSuccess, addDraftError);
86 serviceError = t.step_func(function (error) {
87 assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
90 getEmailService(t, serviceSuccess, serviceError);