0f96029e57bf849ec6d1cb2ef0e338af8a59b0f8
[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         Weiyi Gu <w.gu@samsung.com>
19
20 -->
21 <html>
22 <head>
23 <title>Session_openLogicalChannel_errorCallback_invoked</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
26 </head>
27 <body>
28 <div id="log"></div>
29 <script>
30 //==== TEST: Session_openLogicalChannel_errorCallback_invoked
31 //==== LABEL Check exception in error callback of openLogicalChannel method
32 //==== SPEC Tizen Web API:TBD:SecureElement:Session:openLogicalChannel M
33 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/Secureelement.html
34 //==== PRIORITY P3
35 //==== ONLOAD_DELAY 90
36 //==== TEST_CRITERIA MERRCB
37
38 setup({timeout: 90000});
39
40 var t = async_test(document.title, {timeout: 90000}), getReadersSuccessCallback, getReaderErrorCallback, successChannel,
41     successSession, errorSession, errorChannel, reader;
42
43 t.step(function () {
44     successChannel = t.step_func(function (channel) {
45         assert_unreached("openLogicalChannel() success callback invoked");
46     });
47
48     errorChannel = t.step_func(function (error) {
49         assert_equals(error.name, "InvalidStateError", "Incorrect error name.");
50         t.done();
51     });
52
53     successSession = t.step_func(function (session) {
54         assert_true(!session.isClosed, "Session is closed");
55         reader.closeSessions();
56         session.openLogicalChannel([0x61, 0x70, 0x69, 0x31, 0x67, 0x65, 0x74, 0x63, 0x61, 0x70, 0x2E, 0x73, 0x79, 0x73, 0x69, 0x6E, 0x66, 0x6F], successChannel, errorChannel);
57     });
58
59     errorSession = t.step_func(function (error) {
60         assert_unreached("openSession() error callback invoked: name: " + error.name + ", msg: " + error.message);
61     });
62
63     getReadersSuccessCallback = t.step_func(function (readers) {
64         assert_true(readers[0].isPresent, "Readers is not present");
65         reader = readers[0];
66         readers[0].openSession(successSession, errorSession);
67     });
68
69     getReaderErrorCallback = t.step_func(function (error) {
70         assert_unreached("getReaders() error callback invoked: name: " + error.name + ", msg: " + error.message);
71     });
72
73     tizen.seService.getReaders(getReadersSuccessCallback, getReaderErrorCallback);
74 });
75
76 </script>
77 </body>
78 </html>