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_TypeMismatch</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
30 //==== TEST: WidgetInstance_getContent_successCallback_TypeMismatch
31 //==== LABEL Check if WidgetInstance:getContent with incorrect successCallback argument throws an exception
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 MC
42 setup({timeout: 90000});
44 var t = async_test(document.title, {timeout: 90000}), widgetSuccessCb, widgetErrorCb, id, myWidget, wdInstance,
45 contentErrorCb, i, conversionTable;
48 widgetErrorCb = t.step_func(function (error) {
49 assert_unreached("getInstances() errorCallback is invoked: " + error.name + " msg: " + error.msg);
52 contentErrorCb = t.step_func(function () {
53 assert_unreached("getContent() errorCallback should not be invoked");
56 widgetSuccessCb = t.step_func(function (instances) {
57 wdInstance = instances[0];
58 conversionTable = getTypeConversionExceptions("functionObject", false);
59 for (i = 0; i < conversionTable.length; i++) {
60 assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
61 wdInstance.getContent(conversionTable[i][0], contentErrorCb);
62 }, "TypeMismatchError exception should be thrown");
67 id = "apiwidserv.WebAPITizenWidgetserviceTests.test";
68 myWidget = tizen.widgetservice.getWidget(id);
69 myWidget.getInstances(widgetSuccessCb, widgetErrorCb);