2016-08-03 18:00:07 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-11-10 21:13:11 -05:00
|
|
|
import {browser} from 'protractor';
|
|
|
|
|
2016-11-12 08:08:58 -05:00
|
|
|
const assertEventsContainsName = function(events: any[], eventName: string) {
|
|
|
|
let found = false;
|
|
|
|
for (let i = 0; i < events.length; ++i) {
|
2015-06-08 16:51:10 -04:00
|
|
|
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() {
|
2016-11-12 08:08:58 -05:00
|
|
|
const 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-11-22 16:29:53 -05:00
|
|
|
browser.executeScript('window.startProfiler()');
|
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);')
|
2016-08-26 19:34:08 -04:00
|
|
|
.then(function(profile: any) {
|
2015-06-08 16:51:10 -04:00
|
|
|
assertEventsContainsName(profile, 'gc');
|
|
|
|
assertEventsContainsName(profile, 'script');
|
|
|
|
});
|
2016-08-03 18:00:07 -04:00
|
|
|
});
|
2015-05-18 21:10:30 -04:00
|
|
|
});
|