[Libreoffice-commits] online.git: 2 commits - loleaflet/spec
Mihai Varga
mihai.varga at collabora.com
Tue Aug 11 07:23:08 PDT 2015
loleaflet/spec/loadtest.html | 56 ++++++++++++++++++
loleaflet/spec/loadtest/LoadTestSpec.js | 96 ++++++++++++++++++++++++++++++++
loleaflet/spec/runLoadTest.sh | 20 ++++++
3 files changed, 172 insertions(+)
New commits:
commit 079b8c562f24908e19b0a55d8fcfc589ea9cee30
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Tue Aug 11 17:21:25 2015 +0300
loleaflet: script to launch more clients
I think we need to use chrome as firefox doesn't load inactive tabs.
And also we need to load the clients (chrome tabs) synchronously as
starting too many tabs at once will cause it to fail.
diff --git a/loleaflet/spec/runLoadTest.sh b/loleaflet/spec/runLoadTest.sh
new file mode 100755
index 0000000..bb35673
--- /dev/null
+++ b/loleaflet/spec/runLoadTest.sh
@@ -0,0 +1,20 @@
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
+google-chrome loadtest.html &
+sleep 0.2
commit f9a7c800314fcd1b5d16ecc9f887b36363712d19
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Tue Aug 11 17:20:12 2015 +0300
loleafet: document loading test.
Opening loadtest.html in the browser launches a 'client' that opens
several documents and scrolls them
diff --git a/loleaflet/spec/loadtest.html b/loleaflet/spec/loadtest.html
new file mode 100644
index 0000000..9fc91d6
--- /dev/null
+++ b/loleaflet/spec/loadtest.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>LOOL Spec Runner</title>
+ <link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css">
+ <link rel="stylesheet" type="text/css" href="../dist/leaflet.css">
+ <link rel="stylesheet" type="text/css" href="../src/scrollbar/jquery.mCustomScrollbar.css">
+ <link rel="stylesheet" type="text/css" href="../dist/dialog/vex.css" />
+ <link rel="stylesheet" type="text/css" href="../dist/dialog/vex-theme-plain.css" />
+</head>
+<body>
+ <script src="expect.js"></script>
+ <script type="text/javascript" src="../node_modules/mocha/mocha.js"></script>
+ <script type="text/javascript" src="../node_modules/happen/happen.js"></script>
+ <script type="text/javascript" src="sinon.js"></script>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+ <script>window.jQuery || document.write('<script src="../src/scrollbar/jquery-1.11.0.min.js"><\/script>')</script>
+ <script src="../src/scrollbar/jquery.mCustomScrollbar.js"></script>
+ <script src="../dist/dialog/vex.combined.min.js"></script>
+ <script>vex.defaultOptions.className = 'vex-theme-plain';</script>
+
+ <!-- source files -->
+ <script type="text/javascript" src="../build/deps.js"></script>
+
+ <script type="text/javascript" src="../debug/leaflet-include.js"></script>
+
+ <script>
+ mocha.setup({
+ ui: 'bdd',
+ ignoreLeaks: true
+ });
+ </script>
+
+ <!-- spec files -->
+ <script type="text/javascript" src="loadtest/LoadTestSpec.js"></script>
+
+ <div id="toolbar" style="hidden">
+ </div>
+ <div id="map-test" style="height:300px; width:100%; position:absolute; top:0; opacity:0.5"></div>
+ <div id="mocha" style="top:300px; position:absolute"></div>
+
+ <style>
+ #mocha-stats {
+ top: 300px;
+ }
+ #mocha-report {
+ min-width: 250px;
+ }
+ </style>
+
+ <script>
+ (window.mochaPhantomJS || window.mocha).run();
+ </script>
+</body>
+</html>
diff --git a/loleaflet/spec/loadtest/LoadTestSpec.js b/loleaflet/spec/loadtest/LoadTestSpec.js
new file mode 100644
index 0000000..bc4b624
--- /dev/null
+++ b/loleaflet/spec/loadtest/LoadTestSpec.js
@@ -0,0 +1,96 @@
+describe('LoadTest', function () {
+ // 25 s timeout
+ this.timeout(25000);
+ var testsRan = 0,
+ checkTimeOut = null,
+ map = null,
+ docLayer = null,
+ x = 0,
+ y = 0;
+
+ before(function() {
+ map = L.map('map-test', {
+ center: [0, 0],
+ zoom: 10,
+ minZoom: 1,
+ maxZoom: 20,
+ server: 'ws://localhost:9980',
+ doubleClickZoom: false
+ });
+ map.on('docsize', function (e) { x = e.x; y = e.y; }, this);
+ });
+
+ var docPath = 'file:///PATH';
+ var docs = ['eval.odt', 'lorem.odt'];
+
+ docs.forEach(function (testDoc) {
+ testsRan += 1;
+ describe('Document #' + testsRan + ' (' + testDoc + ')', function () {
+
+ afterEach(function () {
+ map.off('statusindicator');
+ });
+
+ after(function () {
+ map.socket.onmessage = function () {};
+ map.socket.onclose = function () {};
+ map.socket.onerror = function () {};
+ map.socket.close();
+ });
+
+ it('Load the document', function (done) {
+ map._initSocket();
+ map.on('statusindicator', function (e) {
+ if (e.statusType === 'alltilesloaded') {
+ done();
+ }
+ });
+
+ if (docLayer) {
+ map.removeLayer(docLayer);
+ }
+
+ docLayer = new L.TileLayer('', {
+ doc: docPath + testDoc,
+ useSocket : true,
+ edit: false,
+ readOnly: false
+ });
+
+ // don't pre-fetch tiles
+ docLayer._preFetchTiles = L.Util.falseFn;
+
+ map.addLayer(docLayer);
+ });
+
+ it('Scroll to the middle', function (done) {
+ map.on('statusindicator', function (e) {
+ if (e.statusType === 'alltilesloaded') {
+ clearTimeout(checkTimeOut);
+ done();
+ }
+ });
+ map.scrollTop(y / 2);
+ checkTimeOut = setTimeout(function () {
+ expect(map._docLayer._emptyTilesCount).to.eql(1);
+ done();
+ }, 2000);
+ });
+
+ it('Scroll to the bottom', function (done) {
+ map.on('statusindicator', function (e) {
+ if (e.statusType === 'alltilesloaded') {
+ clearTimeout(checkTimeOut);
+ done();
+ }
+ });
+ map.scrollTop(y);
+ checkTimeOut = setTimeout(function () {
+ expect(map._docLayer._emptyTilesCount).to.eql(1);
+ done();
+ }, 2000);
+ });
+
+ });
+ });
+});
More information about the Libreoffice-commits
mailing list