Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit bbf0028

Browse files
committed
Merge pull request #4 from webrtc/addGetStatsTest
add getStats test
2 parents f87433f + 9878d9a commit bbf0028

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
browsers/
2+
browsers-tmp
23
firefox-*.tar.bz2
34
.DS_Store
45
node_modules/

test/run-tests

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
#!/bin/sh
21
#
3-
# Run testling with a default set of parameters
2+
# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
43
#
4+
# Use of this source code is governed by a BSD-style license
5+
# that can be found in the LICENSE file in the root of the source
6+
# tree.
7+
#!/bin/sh
8+
9+
# Run testling with a default set of parameters
510
BINDIR=./browsers/bin
611
export BROWSER=${BROWSER-chrome}
712
export BVER=${BVER-stable}

test/run-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* that can be found in the LICENSE file in the root of the source
66
* tree.
77
*/
8-
/* jshint node: true */
8+
/* eslint-env node */
99

1010
'use strict';
1111
var test = require('tape');

test/test.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* that can be found in the LICENSE file in the root of the source
66
* tree.
77
*/
8-
/* jshint node: true */
8+
/* eslint-env node */
99

1010
'use strict';
1111

@@ -30,3 +30,40 @@ test('Check Selenium lib buildDriver method', function(t) {
3030
t.end();
3131
});
3232
});
33+
34+
test('Check Selenium lib getStats method', function(t) {
35+
if (process.env.BROWSER === 'firefox') {
36+
t.skip('getStats not supported on Firefox.');
37+
t.end();
38+
return;
39+
}
40+
var driver = require('../main.js').seleniumLib.buildDriver();
41+
var getStats = require('../main.js').seleniumLib.getStats;
42+
43+
driver.get('file://' + process.cwd() + '/test/testpage.html')
44+
.then(function() {
45+
t.plan(3);
46+
t.pass('Page loaded');
47+
return driver.executeScript('window.pc1 = new RTCPeerConnection();' +
48+
'return window.pc1;');
49+
})
50+
.then(function(peerConnection) {
51+
if (typeof peerConnection.remoteDescription === 'object') {
52+
t.pass('PeerConnection created, calling on getStats.')
53+
return getStats(driver, 'pc1');
54+
}
55+
})
56+
.then(function(response) {
57+
for (var object in response) {
58+
t.ok(object.toString().match('googLibjingleSession_') !== null,
59+
'getStats response OK!');
60+
}
61+
t.end();
62+
})
63+
.then(null, function(err) {
64+
if (err !== 'skip-test') {
65+
t.fail(err);
66+
}
67+
t.end();
68+
});
69+
});

0 commit comments

Comments
 (0)