Statistics
| Branch: | Tag: | Revision:

one / src / sunstone / public / vendor / noVNC / tests / vnc_playback.html @ 5fcb9de8

History | View | Annotate | Download (4.26 KB)

1
<!DOCTYPE html>
2
<html>
3
    <head>
4
        <title>VNC Playback</title>
5
        <link rel="stylesheet" href="../include/plain.css">
6
    </head>
7
    <body>
8

    
9
        Iterations: <input id='iterations' style='width:50'>&nbsp;
10
        Perftest:<input type='radio' id='mode1' name='mode' checked>&nbsp;
11
        Realtime:<input type='radio' id='mode2' name='mode'>&nbsp;&nbsp;
12

    
13
        <input id='startButton' type='button' value='Start' style='width:100px'
14
            onclick="start();" disabled>&nbsp;
15

    
16
        <br><br>
17

    
18
        Results:<br>
19
        <textarea id="messages" style="font-size: 9;" cols=80 rows=25></textarea>
20

    
21
        <br><br>
22

    
23
        <div id="VNC_screen">
24
            <div id="VNC_status_bar" class="VNC_status_bar" style="margin-top: 0px;">
25
                <table border=0 width=100%><tr>
26
                    <td><div id="VNC_status">Loading</div></td>
27
                </tr></table>
28
            </div>
29
            <canvas id="VNC_canvas" width="640px" height="20px">
30
                Canvas not supported.
31
            </canvas>
32
        </div>
33

    
34
    </body>
35

    
36
    <!--
37
    <script type='text/javascript' 
38
        src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
39
    -->
40

    
41
    <script type="text/javascript">
42
        var INCLUDE_URI= "../include/";
43
    </script>
44
    <script src="../include/vnc.js"></script>
45
    <script src="../include/playback.js"></script>
46

    
47
    <script>
48
        var fname, start_time;
49

50
        function message(str) {
51
            console.log(str);
52
            var cell = $D('messages');
53
            cell.innerHTML += str + "\n";
54
            cell.scrollTop = cell.scrollHeight;
55
        }
56

57
        fname = WebUtil.getQueryVar('data', null);
58

59
        if (fname) {
60
            message("Loading " + fname);
61
            document.write('<script src="' + fname + '"><\/script>');
62
        } else {
63
            message("Must specify data=FOO in query string.");
64
        }
65

66
        updateState = function (rfb, state, oldstate, msg) {
67
            switch (state) {
68
                case 'failed':
69
                case 'fatal':
70
                    message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx);
71
                    test_state = 'failed';
72
                    break;
73
                case 'loaded':
74
                    $D('startButton').disabled = false;
75
                    break;
76
            }
77
            if (typeof msg !== 'undefined') {
78
                $D('VNC_status').innerHTML = msg;
79
            }
80
        }
81

82
        function start() {
83
            $D('startButton').value = "Running";
84
            $D('startButton').disabled = true;
85

86
            iterations = $D('iterations').value;
87
            iteration = 0;
88
            start_time = (new Date()).getTime();
89

90
            if ($D('mode1').checked) {
91
                message("Starting performance playback (fullspeed) [" + iterations + " iteration(s)]");
92
                mode = 'perftest';
93
            } else {
94
                message("Starting realtime playback [" + iterations + " iteration(s)]");
95
                mode = 'realtime';
96
            }
97

98
            next_iteration();
99
        }
100

101
        function finish() {
102
            // Finished with all iterations
103
            var total_time, end_time = (new Date()).getTime();
104
            total_time = end_time - start_time;
105

106
            iter_time = parseInt(total_time / iterations, 10);
107
            message(iterations + " iterations took " + total_time + "ms, " +
108
                    iter_time + "ms per iteration");
109
            rfb.get_canvas().stop();   // Shut-off event interception
110
            $D('startButton').disabled = false;
111
            $D('startButton').value = "Start";
112

113
        }
114

115
        window.onload = function() {
116
            iterations = WebUtil.getQueryVar('iterations', 3);
117
            $D('iterations').value = iterations;
118
            mode = WebUtil.getQueryVar('mode', 3);
119
            if (mode === 'realtime') {
120
                $D('mode2').checked = true;
121
            } else {
122
                $D('mode1').checked = true;
123
            }
124
            if (fname) {
125
                message("VNC_frame_data.length: " + VNC_frame_data.length);
126
                rfb = new RFB({'target': $D('VNC_canvas'),
127
                               'updateState': updateState});
128
                rfb.testMode(send_array);
129
            }
130
        }
131
    </script>
132
</html>