Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 848415 - [Dialer] Create performance tests for the call log. r=etien... #8652

Merged
merged 1 commit into from Mar 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/communications/dialer/index.html
Expand Up @@ -23,7 +23,10 @@
<script defer src="/dialer/js/keypad.js"></script>
<script defer src="/dialer/js/dialer.js"></script>
<script defer src="/dialer/js/recents_db.js"></script>


<!-- for perf-measurement related utilities -->
<script defer src='/shared/js/performance_testing_helper.js'></script>

<!-- Lazy load all the things:
<link rel="stylesheet" type="text/css" href="/shared/style/action_menu.css">
<link rel="stylesheet" type="text/css" href="/shared/style/confirm.css">
Expand Down
3 changes: 2 additions & 1 deletion apps/communications/dialer/js/recents.js
Expand Up @@ -585,7 +585,7 @@ var Recents = {
var self = this;
window.asyncStorage.getItem('latestCallLogVisit', function getItem(value) {
var content = '',
currentDay = '';
currentDay = '';

for (var i = 0; i < recents.length; i++) {
var day = Utils.getDayDate(recents[i].date);
Expand Down Expand Up @@ -756,6 +756,7 @@ var Recents = {
}
}
}
PerformanceTestingHelper.dispatch('call-log-ready');
},

groupCalls: function re_groupCalls(olderCallEl, newerCallEl, count, inc) {
Expand Down
6 changes: 5 additions & 1 deletion apps/communications/dialer/test/integration/app.js
Expand Up @@ -11,5 +11,9 @@ DialerIntegration.prototype = {
__proto__: AppIntegration.prototype,
appName: 'Phone',
manifestURL: 'app://communications.gaiamobile.org/manifest.webapp',
entryPoint: 'dialer'
entryPoint: 'dialer',

selectors: {
optionRecents: '#option-recents'
}
};
@@ -0,0 +1,52 @@
'use strict';

requireCommon('test/synthetic_gestures.js');
require('/tests/performance/performance_helper.js');
require('apps/communications/dialer/test/integration/app.js');

suite(window.mozTestInfo.appPath + '>', function() {
var device;
var app;

MarionetteHelper.start(function(client) {
app = new DialerIntegration(client);
device = app.device;
});

setup(function() {
yield IntegrationHelper.unlock(device);
});

test('Dialer/callLog rendering time >', function() {

this.timeout(500000);
yield device.setScriptTimeout(50000);

var lastEvent = 'call-log-ready';
var eventTitles = {
'call-log-ready': 'Dialer/callLog ready'
};

var performanceHelper = new PerformanceHelper({
app: app,
eventTitles: eventTitles,
lastEvent: lastEvent
});

yield performanceHelper.repeatWithDelay(function(app, next) {
var waitForBody = true;
yield app.launch(waitForBody);

var recentsButton = yield app.element('optionRecents');

yield recentsButton.singleTap();

var runResults = yield performanceHelper.observe(next);
performanceHelper.reportRunDurations(runResults);

yield app.close();
});

performanceHelper.finish();
});
});
14 changes: 14 additions & 0 deletions tests/js/vendor/marionette.js
Expand Up @@ -1064,6 +1064,20 @@
return this._sendCommand(cmd, 'ok', callback);
},

/**
* single taps element.
*
* @method singleTap
* @param {Function} callback boolean result.
* @return {Object} self.
*/
singleTap: function singleTap(callback) {
var cmd = {
type: 'singleTap'
};
return this._sendCommand(cmd, 'ok', callback);
},

/**
* Gets text of element
*
Expand Down