[iot][deprecatedapi][fix fails and blocks for messaging email] 50/302850/1
authorchen <chen89.chen@samsung.com>
Thu, 14 Dec 2023 11:07:44 +0000 (19:07 +0800)
committerchen <chen89.chen@samsung.com>
Thu, 14 Dec 2023 11:07:58 +0000 (19:07 +0800)
Change-Id: I270608c97819f65f01412231853822b46bc9c8be
Signed-off-by: chen <chen89.chen@samsung.com>
16 files changed:
iot/tct-deprecatedapi-tizen-tests/NOTICE
iot/tct-deprecatedapi-tizen-tests/config.xml
iot/tct-deprecatedapi-tizen-tests/deprecatedapi/support/getJsonConf.js
iot/tct-deprecatedapi-tizen-tests/deprecatedapi/support/messaging_common.js [new file with mode: 0755]
iot/tct-deprecatedapi-tizen-tests/inst.wgt.py
iot/tct-deprecatedapi-tizen-tests/suite.json
iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg [new file with mode: 0755]
iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3 [new file with mode: 0755]
mobile/tct-deprecatedapi-tizen-tests/NOTICE
mobile/tct-deprecatedapi-tizen-tests/config.xml
mobile/tct-deprecatedapi-tizen-tests/deprecatedapi/support/getJsonConf.js
mobile/tct-deprecatedapi-tizen-tests/deprecatedapi/support/messaging_common.js [new file with mode: 0755]
mobile/tct-deprecatedapi-tizen-tests/inst.wgt.py
mobile/tct-deprecatedapi-tizen-tests/suite.json
mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg [new file with mode: 0755]
mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3 [new file with mode: 0755]

index 9a0903b256fda3ad6ddd624834f50fbcb461ad5e..d0dcad1347bc19ff01d730b0782e804f2ca12e3e 100755 (executable)
@@ -1,5 +1,11 @@
-Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
 Copyright (c) 2012 Intel Corporation.
 Except as noted, this software is licensed under Apache License, Version 2 or BSD-3-Clause License.
 Please, see the LICENSE.Apache-2.0 file for Apache License, Version 2 terms and conditions
 or the COPYING file for BSD-3-Clause License.
+Following resources are licensed under its own license.
+webapi-tizen-messaging-test_image.jpg,
+webapi-tizen-messaging-test_noise.mp3:
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All right reserved.
+The above resource files are licensed under Creative Commons Attribution 3.0.
+Please see the LICENSE.CC-BY-3.0 for Creative Commons Attribution 3.0 terms and conditions.
index f956a81f13782e06a8ee6e81bb29f122fd41c193..e5a66fb55000a612246e93aa1cf16fe9fcf52df4 100755 (executable)
   <tizen:privilege name="http://tizen.org/privilege/mediacontroller.server"/>
   <tizen:privilege name="http://tizen.org/privilege/healthinfo"/>
   <tizen:privilege name="http://tizen.org/privilege/location"/>
+  <tizen:privilege name="http://tizen.org/privilege/messaging.read"/>
+  <tizen:privilege name="http://tizen.org/privilege/messaging.write"/>
   <tizen:privilege name="http://tizen.org/privilege/internet"/>
+  <feature name="http://tizen.org/feature/network.telephony"/>
+  <feature name="http://tizen.org/feature/network.telephony.mms"/>
   <feature name="http://tizen.org/feature/sensor.activity_recognition"/>
   <feature name="http://tizen.org/feature/sensor.gesture_recognition"/>
   <icon src="icon.png" height="117" width="117"/>
index 84b98e40564724db2dd867486d018e406cb490f0..3a516587c834be3fede69b4e3b225fed35955a12 100755 (executable)
@@ -44,6 +44,7 @@ $.ajax({
     CONTENT_DIR = path2[1];
     CONTENT_PATH = CONTENT_DIR + "/Downloads/";
     TEST_CONTENT_PATH = CONTENT_DIR + "/Downloads/tct-deprecatedapi-tizen-tests/";
+    TEST_DIR = "file://" + RESOURCE_DIR + "/tct-deprecatedapi-tizen-tests/";
   }
 });
 
@@ -55,5 +56,7 @@ $.ajax({
   success:function(data){
        DATE_FORMAT=data[0]["DATE_FORMAT"];
        TIME_FORMAT=data[0]["TIME_FORMAT"];
+       TEST_EMAIL_RECIPIENT_1 = data[0]["EMAIL_RECIPIENT_1"];
+       TEST_EMAIL_RECIPIENT_2 = data[0]["EMAIL_RECIPIENT_2"];
   }
 })
diff --git a/iot/tct-deprecatedapi-tizen-tests/deprecatedapi/support/messaging_common.js b/iot/tct-deprecatedapi-tizen-tests/deprecatedapi/support/messaging_common.js
new file mode 100755 (executable)
index 0000000..1ba046d
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd.
+
+Licensed under the Apache License, Version 2.0 (the License);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+Authors:
+        JungHyuk, Park <junghyuk.park@samsung.com>
+
+*/
+
+var TEST_EMAIL_RECIPIENT_1 = ""; // this variable MUST be set before executing tests
+var TEST_EMAIL_RECIPIENT_2 = ""; // this variable MUST be set before executing tests
+
+var EMAIL_SYNC_INTERVAL = 10000;
+var EMAIL_RESEND_LIMIT = 30;
+var EMAIL_RESYNC_LIMIT = 30;
+
+var TYPE_MISMATCH_ERR  = 'TypeMismatchError';
+
+var MESSAGE_FOLDER_TYPE_INBOX = "INBOX";
+
+var TEST_DIR = "";
+var MESSAGE_ATTACHMENT_IMAGE_PATH = TEST_DIR + "webapi-tizen-messaging-test_image.jpg";
+var MESSAGE_ATTACHMENT_IMAGE_MIME_TYPE = "image/jpg";
+
+var MESSAGE_ATTACHMENT_SOUND_PATH = TEST_DIR + "webapi-tizen-messaging-test_noise.mp3";
+var MESSAGE_ATTACHMENT_SOUND_MIME_TYPE = "audio/mp3";
+
+var MESSAGE_BODY_PLAIN = "Sample Plain Body"
+var MESSAGE_BODY_HTML = "<p>Sample HTML Body</p>"
+
+var generateSubject = function () {
+    var datetime = new Date().getTime();
+    var count = 0;
+    var subject = function(datetime, count) {
+        return "sample subject: "+datetime+"-"+count;
+    }
+
+    generateSubject = function () {
+        count++;
+        return subject(datetime, count);
+    }
+    return subject(datetime, count);
+};
+
+
+function createSimpleMessageTo(recipient) {
+    return new tizen.Message("messaging.email", {
+        subject: generateSubject(),
+        to: [recipient],
+        plainBody: MESSAGE_BODY_PLAIN
+    }); 
+}
+
+function sendMessage(t, service, msg, onSuccess, onError) {
+    var sendError, requestSending, resend=0;
+
+    sendError = t.step_func(function (error) {
+        if (resend <= EMAIL_RESEND_LIMIT) {
+            setTimeout(requestSending, 5000);
+        } else {
+            onError(error);
+        }
+    });
+
+    requestSending = t.step_func(function () {
+        resend++;
+        service.sendMessage(msg, onSuccess, sendError);
+    });
+
+    requestSending();
+}
+
+
+function sync(t, service, onSuccess, onError, limit) {
+    var syncError, requestSync, argc=arguments.length, resync=0;
+
+    syncError = t.step_func(function (error) {
+        if (resync <= EMAIL_RESYNC_LIMIT) {
+            setTimeout(requestSync, 5000);
+        } else {
+            onError(error);
+        }
+    });
+
+    requestSync = t.step_func(function () {
+        resync++;
+
+        if (argc >= 5) {
+            service.sync(onSuccess, syncError, limit);
+        } else  {
+            service.sync(onSuccess, syncError);
+        }
+    });
+
+    setTimeout(t.step_func(function () {
+        requestSync();
+    }), EMAIL_SYNC_INTERVAL);
+}
+
+
+function getEmailService(t, onSuccess, onError) {
+    t.step(function () {
+        tizen.messaging.getMessageServices(
+            "messaging.email",
+            t.step_func(function (services) {
+                assert_type(services, "array", "Not an array");
+                assert_greater_than(services.length, 0, "Received empty services array");
+                onSuccess(services[0]);
+            }),
+            onError
+        );
+    });
+}
+
+
+function message_conversation_test(t, onReady) {
+    var service, message, serviceSuccess, serviceError, addDraftSuccess, addDraftError,
+    filterConversation, findConversationsSuccess, findConversationsError;
+
+    findConversationsSuccess = t.step_func(function (conversations) {
+        assert_equals(conversations.length, 1, "Incorrect number of conversations found");
+        assert_equals(conversations[0].id, message.conversationId, "Found incorrect convesation");
+        t.step_func(onReady)(service, message, conversations[0]);
+    });
+
+    findConversationsError = t.step_func(function (error) {
+        assert_unreached("findConversations() error callback: name:" + error.name + ", msg:" + error.message);
+    });
+
+    addDraftSuccess = t.step_func(function () {
+        filterConversation = new tizen.AttributeFilter("id", "EXACTLY", message.conversationId);
+        service.messageStorage.findConversations(filterConversation, findConversationsSuccess, findConversationsError);
+    });
+
+    addDraftError = t.step_func(function (error) {
+        assert_unreached("addDraftMessage() error callback: name:" + error.name + ", msg:" + error.message);
+    });
+
+    serviceSuccess = t.step_func(function (emailService) {
+        service = emailService;
+
+        message = new tizen.Message("messaging.email", {
+            subject: generateSubject(),
+            to: [TEST_EMAIL_RECIPIENT_2],
+            cc: [TEST_EMAIL_RECIPIENT_1],
+            bcc: [TEST_EMAIL_RECIPIENT_1],
+            plainBody: MESSAGE_BODY_PLAIN,
+            htmlBody: MESSAGE_BODY_HTML,
+            isHighPriority: false
+        }); 
+
+        assert_true("conversationId" in message, "No 'conversationId' attribute in message");
+        assert_equals(message.conversationId, null, "message.conversationId default value should be null");
+        check_readonly(message, "conversationId", null, "object", "12345");
+
+        service.messageStorage.addDraftMessage(message, addDraftSuccess, addDraftError);
+    });
+
+    serviceError = t.step_func(function (error) {
+        assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
+    });
+
+    t.step(function () {
+        getEmailService(t, serviceSuccess, serviceError);
+    });
+}
+
+
+function findFolders(t, service, onSuccess, onError) {
+    var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", service.id);
+    service.messageStorage.findFolders(filter, onSuccess, onError);
+}
+
+
+function getInboxFolder(t, folders) {
+    var i, inboxFolder;
+    t.step(function () {
+        for(i = 0; i < folders.length; i++) {
+            if (folders[i].type === MESSAGE_FOLDER_TYPE_INBOX) {
+                inboxFolder = folders[i];
+                break;
+            }
+        }
+        assert_not_equals(inboxFolder, undefined, "Inbox folder not found");
+    });
+    return inboxFolder;
+}
+
+function findMessages(t, service, folder, subject, onSuccess, onError) {
+    var subjectFilter, folderFilter, compositefilter;
+
+    t.step(function() {
+        folderFilter = new tizen.AttributeFilter("folderId", "EXACTLY", folder.id);
+        subjectFilter = new tizen.AttributeFilter("subject", "EXACTLY", subject);
+        compositefilter = new tizen.CompositeFilter("INTERSECTION", [folderFilter, subjectFilter]);
+        service.messageStorage.findMessages(compositefilter, onSuccess, onError);
+    });
+}
+
+function assert_message_equals(t, messages, message, folder) {
+    t.step(function() {
+        assert_type(messages, "array", "Not an array");
+        assert_equals(messages.length, 1, "incorrect messages found");
+        assert_true(messages[0] instanceof tizen.Message, "Not a Message");
+        assert_equals(messages[0].subject, message.subject, "Incorrect subject.");
+
+        if (arguments.length >= 4) {
+            assert_equals(messages[0].folderId, folder.id, "Incorrect folderId.");
+        }
+    });
+}
+
+function assert_draft_message_equals(t, messages, message) {
+    t.step(function() {
+        assert_type(messages, "array", "Not an array");
+        assert_equals(messages.length, 1, "incorrect messages found");
+        assert_true(messages[0] instanceof tizen.Message, "Not a Message");
+        assert_equals(messages[0].id, message.id, "Incorrect folderId.");
+        assert_equals(messages[0].subject, message.subject, "Incorrect subject.");
+    });
+}
+
+function assert_inbox_message_equals(t, messages, message, folder) {
+    t.step(function() {
+        assert_type(messages, "array", "Not an array");
+        assert_equals(messages.length, 1, "incorrect messages found");
+        assert_true(messages[0] instanceof tizen.Message, "Not a Message");
+        assert_equals(messages[0].subject, message.subject, "Incorrect subject.");
+        assert_equals(messages[0].folderId, folder.id, "Incorrect folderId.");
+    });
+}
+
+// change TEST_EMAIL_RECIPIENT_1 and TEST_EMAIL_RECIPIENT_2
+document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');
+document.write('<script src="support/getJsonConf.js"></script>');
index 8e0d9ef1ac5649b442f894d42aea36e60df8bd95..b69e1584e64816ac53a3e6ef4b4f08dedcaf3e3e 100755 (executable)
@@ -168,6 +168,12 @@ def instPKGs():
             if not doRemoteCopy(item, "%s/%s" % (PKG_SRC_DIR, item_name)):
             #if not doRemoteCopy(item, PKG_SRC_DIR):
                 action_status = False
+    for item in os.listdir(SCRIPT_DIR):
+        print(SCRIPT_DIR)
+        print(item)
+        if item.find("webapi-tizen-messaging-test_") != -1:
+            if not doRemoteCopy("%s/%s" % (SCRIPT_DIR, item), "%s/%s/%s" % (SRC_DIR, PKG_NAME, item)):
+                action_status = False
 
     return action_status
 
index 07bc359172e736fe071197a456fdc3d7dc2305d5..320171386cbc173b71ea94e9c4a88f8accb127b9 100755 (executable)
@@ -22,7 +22,9 @@
                 "askpolicy.sh": "askpolicy.sh",
                 "tests.xml": "tests.xml",
                 "media": "media",
-                "MediaControllerHelper.wgt": "MediaControllerHelper.wgt"
+                "MediaControllerHelper.wgt": "MediaControllerHelper.wgt",
+                "webapi-tizen-messaging-test_image.jpg": "webapi-tizen-messaging-test_image.jpg",
+                "webapi-tizen-messaging-test_noise.mp3": "webapi-tizen-messaging-test_noise.mp3"
             },
             "pkg-app": {
                 "sign-flag": "true"
diff --git a/iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg b/iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg
new file mode 100755 (executable)
index 0000000..7a57964
Binary files /dev/null and b/iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg differ
diff --git a/iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3 b/iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3
new file mode 100755 (executable)
index 0000000..d4d1659
Binary files /dev/null and b/iot/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3 differ
index 9a0903b256fda3ad6ddd624834f50fbcb461ad5e..d0dcad1347bc19ff01d730b0782e804f2ca12e3e 100755 (executable)
@@ -1,5 +1,11 @@
-Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
 Copyright (c) 2012 Intel Corporation.
 Except as noted, this software is licensed under Apache License, Version 2 or BSD-3-Clause License.
 Please, see the LICENSE.Apache-2.0 file for Apache License, Version 2 terms and conditions
 or the COPYING file for BSD-3-Clause License.
+Following resources are licensed under its own license.
+webapi-tizen-messaging-test_image.jpg,
+webapi-tizen-messaging-test_noise.mp3:
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All right reserved.
+The above resource files are licensed under Creative Commons Attribution 3.0.
+Please see the LICENSE.CC-BY-3.0 for Creative Commons Attribution 3.0 terms and conditions.
index a03d0f771b03cf30724e1e4257806a0e506202c9..e5a66fb55000a612246e93aa1cf16fe9fcf52df4 100755 (executable)
@@ -12,9 +12,9 @@
   <tizen:privilege name="http://tizen.org/privilege/mediacontroller.server"/>
   <tizen:privilege name="http://tizen.org/privilege/healthinfo"/>
   <tizen:privilege name="http://tizen.org/privilege/location"/>
+  <tizen:privilege name="http://tizen.org/privilege/messaging.read"/>
+  <tizen:privilege name="http://tizen.org/privilege/messaging.write"/>
   <tizen:privilege name="http://tizen.org/privilege/internet"/>
-  <tizen:privilege name="http://tizen.org/privilege/messaging.write "/>
-  <tizen:privilege name="http://tizen.org/privilege/messaging.read "/>
   <feature name="http://tizen.org/feature/network.telephony"/>
   <feature name="http://tizen.org/feature/network.telephony.mms"/>
   <feature name="http://tizen.org/feature/sensor.activity_recognition"/>
index 84b98e40564724db2dd867486d018e406cb490f0..3a516587c834be3fede69b4e3b225fed35955a12 100755 (executable)
@@ -44,6 +44,7 @@ $.ajax({
     CONTENT_DIR = path2[1];
     CONTENT_PATH = CONTENT_DIR + "/Downloads/";
     TEST_CONTENT_PATH = CONTENT_DIR + "/Downloads/tct-deprecatedapi-tizen-tests/";
+    TEST_DIR = "file://" + RESOURCE_DIR + "/tct-deprecatedapi-tizen-tests/";
   }
 });
 
@@ -55,5 +56,7 @@ $.ajax({
   success:function(data){
        DATE_FORMAT=data[0]["DATE_FORMAT"];
        TIME_FORMAT=data[0]["TIME_FORMAT"];
+       TEST_EMAIL_RECIPIENT_1 = data[0]["EMAIL_RECIPIENT_1"];
+       TEST_EMAIL_RECIPIENT_2 = data[0]["EMAIL_RECIPIENT_2"];
   }
 })
diff --git a/mobile/tct-deprecatedapi-tizen-tests/deprecatedapi/support/messaging_common.js b/mobile/tct-deprecatedapi-tizen-tests/deprecatedapi/support/messaging_common.js
new file mode 100755 (executable)
index 0000000..1ba046d
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd.
+
+Licensed under the Apache License, Version 2.0 (the License);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+Authors:
+        JungHyuk, Park <junghyuk.park@samsung.com>
+
+*/
+
+var TEST_EMAIL_RECIPIENT_1 = ""; // this variable MUST be set before executing tests
+var TEST_EMAIL_RECIPIENT_2 = ""; // this variable MUST be set before executing tests
+
+var EMAIL_SYNC_INTERVAL = 10000;
+var EMAIL_RESEND_LIMIT = 30;
+var EMAIL_RESYNC_LIMIT = 30;
+
+var TYPE_MISMATCH_ERR  = 'TypeMismatchError';
+
+var MESSAGE_FOLDER_TYPE_INBOX = "INBOX";
+
+var TEST_DIR = "";
+var MESSAGE_ATTACHMENT_IMAGE_PATH = TEST_DIR + "webapi-tizen-messaging-test_image.jpg";
+var MESSAGE_ATTACHMENT_IMAGE_MIME_TYPE = "image/jpg";
+
+var MESSAGE_ATTACHMENT_SOUND_PATH = TEST_DIR + "webapi-tizen-messaging-test_noise.mp3";
+var MESSAGE_ATTACHMENT_SOUND_MIME_TYPE = "audio/mp3";
+
+var MESSAGE_BODY_PLAIN = "Sample Plain Body"
+var MESSAGE_BODY_HTML = "<p>Sample HTML Body</p>"
+
+var generateSubject = function () {
+    var datetime = new Date().getTime();
+    var count = 0;
+    var subject = function(datetime, count) {
+        return "sample subject: "+datetime+"-"+count;
+    }
+
+    generateSubject = function () {
+        count++;
+        return subject(datetime, count);
+    }
+    return subject(datetime, count);
+};
+
+
+function createSimpleMessageTo(recipient) {
+    return new tizen.Message("messaging.email", {
+        subject: generateSubject(),
+        to: [recipient],
+        plainBody: MESSAGE_BODY_PLAIN
+    }); 
+}
+
+function sendMessage(t, service, msg, onSuccess, onError) {
+    var sendError, requestSending, resend=0;
+
+    sendError = t.step_func(function (error) {
+        if (resend <= EMAIL_RESEND_LIMIT) {
+            setTimeout(requestSending, 5000);
+        } else {
+            onError(error);
+        }
+    });
+
+    requestSending = t.step_func(function () {
+        resend++;
+        service.sendMessage(msg, onSuccess, sendError);
+    });
+
+    requestSending();
+}
+
+
+function sync(t, service, onSuccess, onError, limit) {
+    var syncError, requestSync, argc=arguments.length, resync=0;
+
+    syncError = t.step_func(function (error) {
+        if (resync <= EMAIL_RESYNC_LIMIT) {
+            setTimeout(requestSync, 5000);
+        } else {
+            onError(error);
+        }
+    });
+
+    requestSync = t.step_func(function () {
+        resync++;
+
+        if (argc >= 5) {
+            service.sync(onSuccess, syncError, limit);
+        } else  {
+            service.sync(onSuccess, syncError);
+        }
+    });
+
+    setTimeout(t.step_func(function () {
+        requestSync();
+    }), EMAIL_SYNC_INTERVAL);
+}
+
+
+function getEmailService(t, onSuccess, onError) {
+    t.step(function () {
+        tizen.messaging.getMessageServices(
+            "messaging.email",
+            t.step_func(function (services) {
+                assert_type(services, "array", "Not an array");
+                assert_greater_than(services.length, 0, "Received empty services array");
+                onSuccess(services[0]);
+            }),
+            onError
+        );
+    });
+}
+
+
+function message_conversation_test(t, onReady) {
+    var service, message, serviceSuccess, serviceError, addDraftSuccess, addDraftError,
+    filterConversation, findConversationsSuccess, findConversationsError;
+
+    findConversationsSuccess = t.step_func(function (conversations) {
+        assert_equals(conversations.length, 1, "Incorrect number of conversations found");
+        assert_equals(conversations[0].id, message.conversationId, "Found incorrect convesation");
+        t.step_func(onReady)(service, message, conversations[0]);
+    });
+
+    findConversationsError = t.step_func(function (error) {
+        assert_unreached("findConversations() error callback: name:" + error.name + ", msg:" + error.message);
+    });
+
+    addDraftSuccess = t.step_func(function () {
+        filterConversation = new tizen.AttributeFilter("id", "EXACTLY", message.conversationId);
+        service.messageStorage.findConversations(filterConversation, findConversationsSuccess, findConversationsError);
+    });
+
+    addDraftError = t.step_func(function (error) {
+        assert_unreached("addDraftMessage() error callback: name:" + error.name + ", msg:" + error.message);
+    });
+
+    serviceSuccess = t.step_func(function (emailService) {
+        service = emailService;
+
+        message = new tizen.Message("messaging.email", {
+            subject: generateSubject(),
+            to: [TEST_EMAIL_RECIPIENT_2],
+            cc: [TEST_EMAIL_RECIPIENT_1],
+            bcc: [TEST_EMAIL_RECIPIENT_1],
+            plainBody: MESSAGE_BODY_PLAIN,
+            htmlBody: MESSAGE_BODY_HTML,
+            isHighPriority: false
+        }); 
+
+        assert_true("conversationId" in message, "No 'conversationId' attribute in message");
+        assert_equals(message.conversationId, null, "message.conversationId default value should be null");
+        check_readonly(message, "conversationId", null, "object", "12345");
+
+        service.messageStorage.addDraftMessage(message, addDraftSuccess, addDraftError);
+    });
+
+    serviceError = t.step_func(function (error) {
+        assert_unreached("getEmailService() error callback: name:" + error.name + ", msg:" + error.message);
+    });
+
+    t.step(function () {
+        getEmailService(t, serviceSuccess, serviceError);
+    });
+}
+
+
+function findFolders(t, service, onSuccess, onError) {
+    var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", service.id);
+    service.messageStorage.findFolders(filter, onSuccess, onError);
+}
+
+
+function getInboxFolder(t, folders) {
+    var i, inboxFolder;
+    t.step(function () {
+        for(i = 0; i < folders.length; i++) {
+            if (folders[i].type === MESSAGE_FOLDER_TYPE_INBOX) {
+                inboxFolder = folders[i];
+                break;
+            }
+        }
+        assert_not_equals(inboxFolder, undefined, "Inbox folder not found");
+    });
+    return inboxFolder;
+}
+
+function findMessages(t, service, folder, subject, onSuccess, onError) {
+    var subjectFilter, folderFilter, compositefilter;
+
+    t.step(function() {
+        folderFilter = new tizen.AttributeFilter("folderId", "EXACTLY", folder.id);
+        subjectFilter = new tizen.AttributeFilter("subject", "EXACTLY", subject);
+        compositefilter = new tizen.CompositeFilter("INTERSECTION", [folderFilter, subjectFilter]);
+        service.messageStorage.findMessages(compositefilter, onSuccess, onError);
+    });
+}
+
+function assert_message_equals(t, messages, message, folder) {
+    t.step(function() {
+        assert_type(messages, "array", "Not an array");
+        assert_equals(messages.length, 1, "incorrect messages found");
+        assert_true(messages[0] instanceof tizen.Message, "Not a Message");
+        assert_equals(messages[0].subject, message.subject, "Incorrect subject.");
+
+        if (arguments.length >= 4) {
+            assert_equals(messages[0].folderId, folder.id, "Incorrect folderId.");
+        }
+    });
+}
+
+function assert_draft_message_equals(t, messages, message) {
+    t.step(function() {
+        assert_type(messages, "array", "Not an array");
+        assert_equals(messages.length, 1, "incorrect messages found");
+        assert_true(messages[0] instanceof tizen.Message, "Not a Message");
+        assert_equals(messages[0].id, message.id, "Incorrect folderId.");
+        assert_equals(messages[0].subject, message.subject, "Incorrect subject.");
+    });
+}
+
+function assert_inbox_message_equals(t, messages, message, folder) {
+    t.step(function() {
+        assert_type(messages, "array", "Not an array");
+        assert_equals(messages.length, 1, "incorrect messages found");
+        assert_true(messages[0] instanceof tizen.Message, "Not a Message");
+        assert_equals(messages[0].subject, message.subject, "Incorrect subject.");
+        assert_equals(messages[0].folderId, folder.id, "Incorrect folderId.");
+    });
+}
+
+// change TEST_EMAIL_RECIPIENT_1 and TEST_EMAIL_RECIPIENT_2
+document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');
+document.write('<script src="support/getJsonConf.js"></script>');
index 8e0d9ef1ac5649b442f894d42aea36e60df8bd95..ade5c7ec373cb736ea94d6c734a2ab5f733a91c8 100755 (executable)
@@ -168,6 +168,10 @@ def instPKGs():
             if not doRemoteCopy(item, "%s/%s" % (PKG_SRC_DIR, item_name)):
             #if not doRemoteCopy(item, PKG_SRC_DIR):
                 action_status = False
+    for item in os.listdir(SCRIPT_DIR):
+        if item.find("webapi-tizen-messaging-test_") != -1:
+            if not doRemoteCopy("%s/%s" % (SCRIPT_DIR, item), "%s/%s/%s" % (SRC_DIR, PKG_NAME, item)):
+                action_status = False
 
     return action_status
 
index 07bc359172e736fe071197a456fdc3d7dc2305d5..320171386cbc173b71ea94e9c4a88f8accb127b9 100755 (executable)
@@ -22,7 +22,9 @@
                 "askpolicy.sh": "askpolicy.sh",
                 "tests.xml": "tests.xml",
                 "media": "media",
-                "MediaControllerHelper.wgt": "MediaControllerHelper.wgt"
+                "MediaControllerHelper.wgt": "MediaControllerHelper.wgt",
+                "webapi-tizen-messaging-test_image.jpg": "webapi-tizen-messaging-test_image.jpg",
+                "webapi-tizen-messaging-test_noise.mp3": "webapi-tizen-messaging-test_noise.mp3"
             },
             "pkg-app": {
                 "sign-flag": "true"
diff --git a/mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg b/mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg
new file mode 100755 (executable)
index 0000000..7a57964
Binary files /dev/null and b/mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_image.jpg differ
diff --git a/mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3 b/mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3
new file mode 100755 (executable)
index 0000000..d4d1659
Binary files /dev/null and b/mobile/tct-deprecatedapi-tizen-tests/webapi-tizen-messaging-test_noise.mp3 differ