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.
18 Andrzej Krolikowski <a.krolikowsk@samsung.com>
24 <title>PushManager_registerService_without_errorCallback</title>
25 <meta charset="utf-8"/>
26 <script src="support/unitcommon.js"></script>
27 <script src="support/push_common.js"></script>
32 <script type="text/javascript">
34 //==== TEST: PushManager_registerService_without_errorCallback
35 //==== LABEL Check if method registerService of PushManager works properly without errorCallback
36 //==== SPEC Tizen Web API:TBD:Push:PushManager:registerService M
37 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
38 //==== ONLOAD_DELAY 90
39 //==== TEST_CRITERIA MMINA MAST MR
40 setup({timeout: 90000});
42 var t = async_test(document.title, {timeout: 90000}),
43 pushRegisterSuccessCallback, returnedValue = null, beforeRegistrationId,
44 unregisterServiceSuccessCallback, unregisterServiceDone,
45 unregisterServiceError, unregisterServiceErrorCallback;
48 unregisterServiceDone = t.step_func(function () {
52 unregisterServiceError = t.step_func(function (error) {
53 assert_unreached("unregisterService() error occurred: " + error.name + ":" + error.message);
56 pushRegisterSuccessCallback = t.step_func(function (registrationId) {
58 assert_equals(returnedValue, undefined, "Incorrect returned value from registerService method");
59 assert_type(registrationId, "string", "registrationId is not a string");
60 assert_not_equals(registrationId, "", "registrationId is equal to empty string.");
61 assert_equals(registrationId, tizen.push.getRegistrationId(),
62 "current registrationId is different from registered service id");
63 assert_not_equals(registrationId, beforeRegistrationId,
64 "registrationId did not change.");
66 tizen.push.unregisterService(unregisterServiceDone, unregisterServiceError);
70 unregisterServiceSuccessCallback = t.step_func(function () {
71 beforeRegistrationId = tizen.push.getRegistrationId();
72 returnedValue = tizen.push.registerService(service, pushRegisterSuccessCallback);
75 unregisterServiceErrorCallback = t.step_func(function (error) {
76 assert_unreached("unregisterService() error occurred: " + error.name + ":" + error.message);
79 tizen.push.unregisterService(unregisterServiceSuccessCallback, unregisterServiceErrorCallback);