RSS

Testing MouseLock with Mochitest

04 Dec

As I mentioned in my earlier blog, I started to contribute to the MouseLock API, which is a JavaScript API which will users to play “First Person Shooter” (aka FPS) games or other similar application using HTML5. For my most recent contribution, I was testing the MouseLock API with Mochitest, an automated test framework for regression testing used by Mozilla.

Background about the MouseLock API

Before I continue, I noticed I missed some intro as to what the MouseLock API is about. So, here is small summary.

Vince Scheib, an engineer at Google have proposed a set of specifications for implementing the MouseLock API and the draft specifications is available here.

From the draft specifications:

The Mouse Lock API provides for input methods of applications based on the movement of the mouse, not just the absolute position of a cursor. A popular example is that of first person movement controls in three dimensional graphics applications such as games. Movement of the mouse is interpreted for rotation of the view-port, there is no limit to how far movement can go, and no mouse cursor is displayed.

Mouse Lock is related to Mouse Capture. Capture provides continued event delivery to a target element while a mouse is being dragged, but ceases when the mouse button is released. Mouse Lock differs by being persistent, not limited by screen boundaries, sending events regardless of mouse button state, hiding the cursor, and not releasing until an API call or specific release gesture by the user.

My Recent Contributions

Going back to my topic of this post, I wrote a small test scenario that is used to check for two conditions:

  • “Mouse lock must succeed only if the target is in the DOM tree”
  • “If the target is removed from the DOM tree after mouse lock is entered then mouse lock will be lost.”

My test code lives here: https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/mouselock/test_DOMtree.html

While running Mochitest, my biggest issue was compiling the code multiple number of times for every change of my test. This caused a big problem when debugging my test as I had to wait 17-26 mins for the code to re-compile when I change the code. This issue may exists only on Windows environment as a friend of mine didn’t experience the problem (he runs his build on those expensive machines called a Mac).

Now that I have uploaded my code along with the rest of the people working on this MouseLock, we are awaiting a review of our code when we push it up to Mozilla’s repositories.

Below if the screen of my test working:

Advertisements
 
1 Comment

Posted by on December 4, 2011 in Firefox, MouseLock, Open Source

 

Tags: , ,

One response to “Testing MouseLock with Mochitest

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: