From 3a9f948ee808013ada46259ceaf7b93cd2127f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= Date: Wed, 26 Feb 2014 00:44:46 -0500 Subject: [PATCH] Bug 819080 - Add performance testing for the fmradio HAL --- apps/fm/index.html | 4 ++++ apps/fm/js/fm.js | 11 +++++++++-- apps/fm/test/unit/fm_test.js | 5 +++++ tests/performance/startup_events_test.js | 6 +++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/apps/fm/index.html b/apps/fm/index.html index 6e335fa98f86..1e0001de14ce 100644 --- a/apps/fm/index.html +++ b/apps/fm/index.html @@ -8,6 +8,10 @@ + + + + diff --git a/apps/fm/js/fm.js b/apps/fm/js/fm.js index 5c9acc53edd6..5f62f9b81a9c 100644 --- a/apps/fm/js/fm.js +++ b/apps/fm/js/fm.js @@ -187,9 +187,14 @@ function updateFreqUI() { } function updatePowerUI() { - console.log('Power status: ' + (mozFMRadio.enabled ? 'on' : 'off')); + var enabled = mozFMRadio.enabled; + if (enabled) { + PerformanceTestingHelper.dispatch('fm-radio-enabled'); + PerformanceTestingHelper.dispatch('startup-path-done'); + } + console.log('Power status: ' + (enabled ? 'on' : 'off')); var powerSwitch = $('power-switch'); - powerSwitch.dataset.enabled = mozFMRadio.enabled; + powerSwitch.dataset.enabled = enabled; powerSwitch.dataset.enabling = enabling; } @@ -724,6 +729,8 @@ var favoritesList = { }; function init() { + PerformanceTestingHelper.dispatch('start'); + frequencyDialer.init(); var seeking = false; diff --git a/apps/fm/test/unit/fm_test.js b/apps/fm/test/unit/fm_test.js index a879ed437d37..3f6c11b9da2f 100644 --- a/apps/fm/test/unit/fm_test.js +++ b/apps/fm/test/unit/fm_test.js @@ -1,5 +1,10 @@ requireApp('fm/js/fm.js'); +var PerformanceTestingHelper = { + dispatch: function() { } +}; + + suite('FM', function() { var tempNode; diff --git a/tests/performance/startup_events_test.js b/tests/performance/startup_events_test.js index dcd3a0291035..5bf869d788b7 100644 --- a/tests/performance/startup_events_test.js +++ b/tests/performance/startup_events_test.js @@ -6,12 +6,12 @@ var App = require('./app'); var PerformanceHelper = requireGaia('/tests/performance/performance_helper.js'); var MarionetteHelper = requireGaia('/tests/js-marionette/helper.js'); -// This test is only for communications/contacts for now. -// XXX extend to more apps. var whitelistedApps = [ 'communications/contacts', - 'clock' + 'clock', + 'fm' ]; + if (whitelistedApps.indexOf(mozTestInfo.appPath) === -1) { return; }