Skip to content
Permalink
Browse files
Merge pull guacamole-common-js modules from git for tests.
  • Loading branch information
necouchman committed Oct 1, 2018
2 parents 22043e1 + 2de22be commit 4a87ae489b922680ace519a9205ee97617307dbc
Show file tree
Hide file tree
Showing 28 changed files with 164 additions and 10,761 deletions.
@@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

var GIT_GUAC = GIT_GUAC || {};

/**
* The commit hash or reference that should be used when loading
* guacamole-common-js modules from git. This value is dynamically populated
* from the value of the "commit" parameter in the query string of the URL. If
* no such parameter is provided, "master" is used by default.
*
* @type {String}
*/
GIT_GUAC.COMMIT = (function getRequestedCommit() {
var params = location.search.match(/[?&]commit=([^&]*)/);
return (params && decodeURIComponent(params[1])) || 'master';
})();

/**
* Dynamically loads the guacamole-common-js module having the given filename.
* The module is read from git using the version of the source available at
* the commit given by GIT_GUAC.COMMIT.
*
* Note that the module is not guaranteed to load until after the "load" event
* for the document fires. Code which depends on the loading of this module
* should wait until after that event to execute.
*
* @param {String} filename
* The filename of the guacamole-common-js module to load, without
* corresponding path, such as "Keyboard.js" or "Mouse.js".
*/
GIT_GUAC.loadModule = function loadModule(filename) {

// Construct URL pointing to guacamole-common-js module within ASF git
var url = 'https://git1-us-west.apache.org/repos/asf?'
+ 'p=guacamole-client.git;'
+ 'a=blob_plain;'
+ 'f=guacamole-common-js/src/main/webapp/modules/' + encodeURIComponent(filename) + ';'
+ 'hb=' + encodeURIComponent(GIT_GUAC.COMMIT);

// Dynamically load module
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', url);
document.head.appendChild(script);

};

@@ -1,3 +1,22 @@
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>

<head>
@@ -12,29 +31,43 @@

<div id="log"></div>

<!-- Base dependencies -->
<script type="text/javascript" src="../log/log.js"></script>
<script type="text/javascript" src="modules/Keyboard.js"></script>
<script type="text/javascript" src="modules/Version.js"></script>
<script type="text/javascript" src="gitguac.js"></script>
<script type="text/javascript" src="keysyms.js"></script>

<!-- Load required guacamole-common-js modules from git -->
<script type="text/javascript">
GIT_GUAC.loadModule('Keyboard.js');
GIT_GUAC.loadModule('Version.js');
</script>

var log = new Log();
document.getElementById("log").appendChild(log.getElement());
<!-- Execute test after all modules have loaded -->
<script type="text/javascript">
window.onload = function documentLoaded() {

log.log("Guacamole.Keyboard tester", "version 1.4 (" + Guacamole.API_VERSION + ")", "Mike Jumper");
log.log("Please press some keys...");
var log = new Log();
document.getElementById("log").appendChild(log.getElement());

var keyboard = new Guacamole.Keyboard(document);
log.log("Guacamole.Keyboard tester",
"git: " + GIT_GUAC.COMMIT,
"API: " + Guacamole.API_VERSION);

keyboard.onkeydown = function(keysym) {
log.log("guacamole", "keydown", "0x" + keysym.toString(16), X11_KEYSYM[keysym]);
};
log.log("Please press some keys...");

keyboard.onkeyup = function(keysym) {
log.log("guacamole", "keyup", "0x" + keysym.toString(16), X11_KEYSYM[keysym]);
};
var keyboard = new Guacamole.Keyboard(document);

keyboard.onkeydown = function(keysym) {
log.log("guacamole", "keydown",
"0x" + keysym.toString(16), X11_KEYSYM[keysym]);
};

keyboard.onkeyup = function(keysym) {
log.log("guacamole", "keyup",
"0x" + keysym.toString(16), X11_KEYSYM[keysym]);
};

};
</script>

</body>

This file was deleted.

This file was deleted.

0 comments on commit 4a87ae4

Please sign in to comment.