Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
b084d0a4
Commit
b084d0a4
authored
9 years ago
by
Solly Ross
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually throw errors in tests
parent
f00193e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
27 deletions
+25
-27
rfb.js
include/rfb.js
+1
-1
util.js
include/util.js
+1
-1
websock.js
include/websock.js
+2
-25
test.rfb.js
tests/test.rfb.js
+6
-0
test.websock.js
tests/test.websock.js
+15
-0
No files found.
include/rfb.js
View file @
b084d0a4
...
...
@@ -167,7 +167,7 @@ var RFB;
try
{
this
.
_display
=
new
Display
({
target
:
this
.
_target
});
}
catch
(
exc
)
{
Util
.
Error
(
"Display exception:
"
+
exc
);
Util
.
Error
(
"Display exception:
"
,
exc
);
throw
exc
;
}
...
...
This diff is collapsed.
Click to expand it.
include/util.js
View file @
b084d0a4
...
...
@@ -217,7 +217,7 @@ Util.init_logging = function (level) {
case
'warn'
:
Util
.
Warn
=
function
(
msg
)
{
console
.
warn
(
msg
);
};
case
'error'
:
Util
.
Error
=
function
(
msg
)
{
console
.
error
(
msg
);
};
Util
.
Error
=
function
(
msg
,
err
)
{
console
.
error
(
msg
,
err
);
};
case
'none'
:
break
;
default
:
...
...
This diff is collapsed.
Click to expand it.
include/websock.js
View file @
b084d0a4
...
...
@@ -375,31 +375,8 @@ function Websock() {
Util
.
Debug
(
"Ignoring empty message"
);
}
}
catch
(
exc
)
{
var
exception_str
=
""
;
if
(
exc
.
name
)
{
exception_str
+=
"
\n
name: "
+
exc
.
name
+
"
\n
"
;
exception_str
+=
" message: "
+
exc
.
message
+
"
\n
"
;
}
if
(
typeof
exc
.
description
!==
'undefined'
)
{
exception_str
+=
" description: "
+
exc
.
description
+
"
\n
"
;
}
if
(
typeof
exc
.
stack
!==
'undefined'
)
{
exception_str
+=
exc
.
stack
;
}
if
(
exception_str
.
length
>
0
)
{
Util
.
Error
(
"recv_message, caught exception: "
+
exception_str
);
}
else
{
Util
.
Error
(
"recv_message, caught exception: "
+
exc
);
}
if
(
typeof
exc
.
name
!==
'undefined'
)
{
this
.
_eventHandlers
.
error
(
exc
.
name
+
": "
+
exc
.
message
);
}
else
{
this
.
_eventHandlers
.
error
(
exc
);
}
Util
.
Error
(
"recv_message, caught exception:"
,
exc
);
this
.
_eventHandlers
.
error
(
exc
)
}
}
};
...
...
This diff is collapsed.
Click to expand it.
tests/test.rfb.js
View file @
b084d0a4
...
...
@@ -32,6 +32,12 @@ describe('Remote Frame Buffer Protocol Client', function() {
this
.
_rQ
=
rQ
;
};
// Actually throw errors
if
(
Util
.
__Error
===
undefined
)
{
Util
.
__Error
=
Util
.
Error
;
}
Util
.
Error
=
function
(
msg
,
err
)
{
if
(
err
)
{
throw
err
;
}
Util
.
__Error
(
msg
,
err
);
};
});
after
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
tests/test.websock.js
View file @
b084d0a4
...
...
@@ -7,6 +7,19 @@ var expect = chai.expect;
describe
(
'Websock'
,
function
()
{
"use strict"
;
function
throwUtilError
()
{
if
(
Util
.
__Error
===
undefined
)
{
Util
.
__Error
=
Util
.
Error
;
}
Util
.
Error
=
function
(
msg
,
err
)
{
if
(
err
)
{
throw
err
;
}
Util
.
__Error
(
msg
,
err
);
};
}
before
(
function
()
{
// Actually throw errors
throwUtilError
();
});
describe
(
'Queue methods'
,
function
()
{
var
sock
;
var
RQ_TEMPLATE
=
new
Uint8Array
([
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
]);
...
...
@@ -405,12 +418,14 @@ describe('Websock', function() {
});
it
(
'should call the error event handler on an exception'
,
function
()
{
Util
.
Error
=
Util
.
__Error
;
sock
.
_eventHandlers
.
error
=
sinon
.
spy
();
sock
.
_eventHandlers
.
message
=
sinon
.
stub
().
throws
();
var
msg
=
{
data
:
new
Uint8Array
([
1
,
2
,
3
]).
buffer
};
sock
.
_mode
=
'binary'
;
sock
.
_recv_message
(
msg
);
expect
(
sock
.
_eventHandlers
.
error
).
to
.
have
.
been
.
calledOnce
;
throwUtilError
();
});
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment