3 Copyright (c) 2016 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 Wei Ji <wei.ji@samsung.com>
23 <title>WidgetInstance_getContent_successCallback_invalid_cb</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
30 //==== TEST: WidgetInstance_getContent_successCallback_invalid_cb
31 //==== LABEL Check if WidgetInstance:getContent throws exception when successCallback is invalid
32 //==== SPEC Tizen Web API:TBD:WidgetService:WidgetInstance:getContent M
35 //==== EXECUTION_TYPE manual
36 //==== PRE "test" widget should be added to home screen.
37 //==== STEP press [Run] button in the test case.
38 //==== EXPECT test case is passed.
39 //==== ONLOAD_DELAY 90
40 //==== TEST_CRITERIA MTCB
42 setup({timeout: 90000});
44 var t = async_test(document.title, {timeout: 90000}), widgetSuccessCb, widgetErrorCb, id, myWidget, wdInstance,
45 contentErrorCb, invalidCallback;
48 widgetErrorCb = t.step_func(function (error) {
49 assert_unreached("getInstances() errorCallback is invoked: " + error.name + " msg: " + error.msg);
53 onsuccess: t.step_func(function () {
54 assert_unreached("Invalid successCallback should not be invoked");
58 contentErrorCb = t.step_func(function () {
59 assert_unreached("getContent() errorCallback should not be invoked");
62 widgetSuccessCb = t.step_func(function (instances) {
63 wdInstance = instances[0];
64 assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
65 wdInstance.getContent(invalidCallback, contentErrorCb);
66 }, "Exception should be thrown when given incorrect successCallback");
70 id = "apiwidserv.WebAPITizenWidgetserviceTests.test";
71 myWidget = tizen.widgetservice.getWidget(id);
72 myWidget.getInstances(widgetSuccessCb, widgetErrorCb);