2015-06-08 16:51:10 -04:00
|
|
|
var assertEventsContainsName = function(events, eventName) {
|
|
|
|
var found = false;
|
|
|
|
for (var i = 0; i < events.length; ++i) {
|
|
|
|
if (events[i].name == eventName) {
|
|
|
|
found = true;
|
|
|
|
break;
|
2015-05-18 21:10:30 -04:00
|
|
|
}
|
|
|
|
}
|
2015-06-08 16:51:10 -04:00
|
|
|
expect(found).toBeTruthy();
|
2015-05-18 21:10:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
describe('firefox extension', function() {
|
2015-10-09 18:25:17 -04:00
|
|
|
var TEST_URL = 'http://localhost:8001/playground/src/hello_world/index.html';
|
2015-06-01 19:17:28 -04:00
|
|
|
|
2015-05-27 17:57:54 -04:00
|
|
|
it('should measure performance', function() {
|
|
|
|
browser.sleep(3000); // wait for extension to load
|
2015-05-18 21:10:30 -04:00
|
|
|
|
2015-06-01 19:17:28 -04:00
|
|
|
browser.driver.get(TEST_URL);
|
2015-05-18 21:10:30 -04:00
|
|
|
|
2016-04-12 12:40:37 -04:00
|
|
|
browser.executeScript('window.startProfiler()')
|
|
|
|
.then(function() { console.log('started measuring perf'); });
|
2015-05-18 21:10:30 -04:00
|
|
|
|
2015-12-28 20:47:49 -05:00
|
|
|
browser.executeAsyncScript('setTimeout(arguments[0], 1000);');
|
2015-05-18 21:10:30 -04:00
|
|
|
browser.executeScript('window.forceGC()');
|
|
|
|
|
2015-06-08 16:51:10 -04:00
|
|
|
browser.executeAsyncScript('var cb = arguments[0]; window.getProfile(cb);')
|
|
|
|
.then(function(profile) {
|
|
|
|
assertEventsContainsName(profile, 'gc');
|
|
|
|
assertEventsContainsName(profile, 'script');
|
|
|
|
});
|
2015-05-18 21:10:30 -04:00
|
|
|
})
|
|
|
|
});
|