1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
function Test(browser) {
this._init(browser);
}
Test.prototype = {
_init: function (browser) {
this._state = 0;
this._url = browser.getUrl();
this._browser = browser;
browser.open(this._url);
},
onLoad: function (uri) {
setTimeout(function () {
this._browser.finish();
}.bind(this), 3000);
},
validateCallLog: function (log, out) {
var i;
assertEquals('Unity.init', log[0].func, 'Unity.init');
var found = false;
for (i = 0; i < out.length; i++) {
if (out[i].match(/^total:\d+$/)) {
var num = out[i].match(/\d+/)[0];
if (Number(num) > 0) {
found = true;
}
}
}
assertTrue('PASS SELF TEST', found);
},
scriptName: 'cnn-news.user.js'
};
|