87931d42f33915910b60be1b8802bf7ad829f9be
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2016 Samsung Electronics Co., Ltd.
4
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
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
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.
16
17 Authors:
18         Wei Ji <wei.ji@samsung.com>
19
20 -->
21
22 <html>
23 <head>
24 <title>Widget_getVariants_successCallback_invalid_cb</title>
25 <meta charset="utf-8"/>
26 <script src="support/unitcommon.js"></script>
27 </head>
28 <body>
29 <div id="log"></div>
30 <script>
31 //==== TEST: Widget_getVariants_successCallback_invalid_cb
32 //==== LABEL Check if Widget:getVariants throws exception when successCallback is invalid
33 //==== SPEC Tizen Web API:TBD:WidgetService:Widget:getVariants M
34 //==== SPEC_URL TBD
35 //==== PRIORITY P2
36 //==== TEST_CRITERIA MTCB
37
38 setup({timeout: 90000});
39
40 var t = async_test(document.title, {timeout: 90000}), invalidCallback, id, myWidget;
41
42 t.step(function () {
43     invalidCallback = {
44         onsuccess: t.step_func(function () {
45             assert_unreached("Invalid success callback should not be invoked");
46         })
47     };
48
49     if(tizen.systeminfo.getCapability("http://tizen.org/feature/platform.core.cpu.arch.armv7")){
50         if(tizen.systeminfo.getCapability("http://tizen.org/feature/platform.core.cpu.arch") === 'aarch64'){
51             id = "apiwidserv.widgetaarch64";
52             console.log(id);
53         }else{
54             id = "apiwidserv.widgetarm";
55             console.log(id);
56         }
57     }
58     else if(tizen.systeminfo.getCapability("http://tizen.org/feature/platform.core.cpu.arch.x86")){
59         if(tizen.systeminfo.getCapability("http://tizen.org/feature/platform.core.cpu.arch") === 'x86_64'){
60             id = "apiwidserv.widgetx86_64";
61             console.log(id);
62         }else{
63             id = "apiwidserv.widgetx86";
64             console.log(id);
65         }
66     }
67
68     myWidget = tizen.widgetservice.getWidget(id);
69
70     assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
71         myWidget.getVariants(invalidCallback);
72     }, "Exception should be thrown when given incorrect successCallback");
73     t.done();
74 });
75
76 </script>
77 </body>
78 </html>