Closed Bug 973188 Opened 6 years ago Closed 6 years ago

Make the Developer HUD API nicer for Gaia test integration

Categories

(Firefox OS Graveyard :: Gaia, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: janx, Assigned: janx)

References

Details

Attachments

(1 file, 2 obsolete files)

The Developer HUD's main objective is to help web developers notice problems in their apps.

While the HUD has already proved useful in manual testing, it would make even more sense to hook it up to Gaia tests and prevent future changes from introducing new problems unnoticed (e.g. too many reflows, too much jank, memory leaks, etc).
Depends on: developer-hud
OS: Linux → All
Hardware: x86_64 → All
Component: Gaia::UI Tests → Gaia
Blocks: 971958
Note to self: Make the Developer HUD event-based, allowing other to listen in.
WIP.

The current proposal is to use the 'developer-hud-update' event sent on the System App to notify front-end view and tests that a metric has changed.

- The event's target will be the frame that caused the metric change.
- The event's detail will look like: `{app:app://manifest.webapp, metric:jank, value:112, message:'jank: 112ms'}`.
- To listen to it you could proceed like so: https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/devtools_view.js#L11

Etienne and Hubert, would that work well for you?

TODO:
- Figure out good names for the Target prototype methods.
- Remove the `event.detail.metrics` field by making the front-end update metrics individually.
- Make logging depend on a pref.
- Fix FIXMEs, do TODOs.
Flags: needinfo?(hub)
Flags: needinfo?(etienne)
Blocks: 982066
Attachment #8389101 - Attachment is obsolete: true
Comment on attachment 8389132 [details] [diff] [review]
Make the Developer HUD API nicer for Gaia test integration. r=21

Vivien, does this make sense to you?
Attachment #8389132 - Flags: review?(21)
yeah that would work.
Flags: needinfo?(hub)
Comment on attachment 8389132 [details] [diff] [review]
Make the Developer HUD API nicer for Gaia test integration. r=21

Review of attachment 8389132 [details] [diff] [review]:
-----------------------------------------------------------------

::: b2g/chrome/content/devtools.js
@@ +250,5 @@
> +    this.update(metric, this.metrics.get(metric) + 1, message);
> +  },
> +
> +  /**
> +   * Void a metric value and make sure isn't displayed on the front-end anymore.

s/isn't/it isn't ?
Attachment #8389132 - Flags: review?(21) → review+
Dietrich, just giving you the heads up that this changes the logging format a bit. It will look like:

> I/GeckoDump( 2201): DeveloperHUD: [app://system.gaiamobile.org/manifest.webapp] reflow: 2.78ms
> I/GeckoDump( 2201): DeveloperHUD: [app://keyboard.gaiamobile.org/manifest.webapp] jank: 146ms

Additionally, you can also watch app metrics by listening for 'developer-hud-update' events on the System App (see comment #3).

Caveat: Changes to the 'memory' metric (app window memory, we have no uss info yet) are sent as events, but are not dumped in the console. Would you like them to be dumped as well?
Flags: needinfo?(dietrich)
Blocks: 982196
Comment on attachment 8389303 [details] [diff] [review]
Make the Developer HUD API nicer for Gaia test integration. r=21

Review of attachment 8389303 [details] [diff] [review]:
-----------------------------------------------------------------

21's r+
Attachment #8389303 - Flags: review+
Keywords: checkin-needed
Thanks Jan!
Flags: needinfo?(dietrich)
https://hg.mozilla.org/mozilla-central/rev/7a6b4371379f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Flags: needinfo?(etienne)
You need to log in before you can comment on or make changes to this bug.