Tuesday, 27 December 2011

Zippity - and automated performance tests for Firefox Mobile

Many have wondered how we get the device coverage with our automated Performance tests.  Here's one way:



What you see running here are the Zippity tests (a plug in available for Firefox mobile ), running the pageload tests on a number of different devices.  I also have logcat attached and running, to catch any possible crashes.

Pageload tests load a series of predefined webpages, to gauge pageload speed.  There are also Startup tests (which start the application several times to measure startup speed); as well as SunSpider and V8 tests.   Lastly, you can ping your memory metrics to Zippity.  

Having the crowd available to help run these tests (just install the plug in), helps us get the device coverage up and ensures we find things like native crashes, hopefully sooner, rather than later.

Kudos to Mark Finkle for this great tool.


I made this video last winter, when I was still in Helsinki:


...and here is one of my songs from my performance at Hotel Utah, San Francisco on December 19, 2011:  http://theutah.org/performance/johnhammink/20111219/againsttheglass

Sunday, 11 December 2011

A plug for the Fullscreen, Gamepad, and Mouse Lock gaming APIs

Sometimes, when things are moving as quickly as they generally do here at the Moz (as in the open web generally), the best that one can do is channel the work of others to try and stay on track with everything.   It certainly beats trying to do everything oneself, at the breakneck speed at which envisioning the new technology - and technology itself - unfolds.


On that note, kudos to Dave HumphriesRob Hawkes and Chris Pearce for their recent blog posts on these brand new APIs.  And so, by way of a rehash...


Fullscreen, Gamepad and Mouse Lock APIs are available in a single experimental desktop build of Firefox.  There are also builds that support these features here.

These APIs are estimated to land soon in the nightly builds.



The Fullscreen API:


Scheduled to ship in firefox 10 by the end of January, you can still try out some of the examples in the latest nightly builds.


Based on the  W3C's draft spec, this API enables any HTML element to be made "fullscreen", which hides the browsers UI and stretches the element to cover the entire screen area.


To use it, the developer calls void mozRequestFullScreen(), which, if the request is granted (there are security implications here) gets a mozfullscreenchange event back to the specifying element; otherwise a mozfullscreenerror is dispatched.

The user can ESC or F11 to exit full screen mode.   As with YouTube or other fullscreen videos, navigating (ALT+TAB) will cause fullscreen mode to exit.



There is a cross-browser full-screen API example here. 

The Gamepad API:

As directed by the W3C spec, Javascript and Firefox now gives developers the possibility to connect a gamepad directly to the computer (using USB or Bluetooth) - a domain previously only available to gaming consoles and native computer games.  

You can try it out here; note that you''ll need that custom build.   This wiki page contains more implementation specifics.

Rob Hawkes made a great demo video:



The Mouse Lock API:

This API hides the cursor and locks it to the center of the screen, thus enabling developers to make games and visualizations of a 3D world (otherwise the cursor would go off the side of the screen or hit the edge). With the cursor locked, the user can roam X, Y, Z axes without restrictions.

David Humphrey and his students at Seneca College are currently implementing this API based on the W3C spec.

There are demo files available.


We're tracking Mouse Lock API on Bugzilla. You can also check out David Humphrey’s series of posts on the development of the Mouse Lock API.

I'm just now trying these out myself; of course, if you find any issues, please feel free to file a bug.

Saturday, 10 December 2011

Fall tour of the Acoustic Circuit, S.F. Bay Area

From Freight & Salvage Coffeehouse, Berkeley,  November 22, 2011
If I don't (yet) get to unleash the beast on my software evangelism (a quintessentially nerdy pursuit) the least I can do is hit the acoustic singer/songwriter music circuit around the Bay area (which I'm currently doing).  It's only been a few short weeks since I've started touring regularly in addition to my awesome day job  (longer geographic swaths in the works on both the music and work fronts), but it's already been a hell of a ride.
From St. Lukes Church, San Francisco, November 20, 2011
From Rockit Room, San Francisco,  November 24, 2011
From Panama Red Coffeehouse, Concord, December 9, 2011

From Berkeley City Club, November 17, 2011

Here is one of my songs from my performance at the Hotel Utah, San Francisco, from December 19, 2011.


Tuesday, 6 December 2011

When going down is good

I've often complained about how jumping out of an airplane with an experienced tandem guide is safer than merging onto the 101.  It's certainly more fun.

Monday, 28 November 2011

Let's have a look at some recently landed Web APIs for Firefox

So, without further ado (as there's been too much "to do" about it) let's take a look at what we presently have (landed or about to land) regarding our latest (Firefox) Web APIs.

You'll need the latest xul fennec builds to run these.  Technically, these also run on the latest birch nightly, but that one is presently undergoing a major facelift due to rendering and related issues.

I'd suggest using a tablet. (For the SMS app, you'll need a phone with simcard and a special build, but we'll get to that presently).

All example testpages to which we'll be referring are available under the directory at:  http://people.mozilla.org/~jhammink/webapi_test_pages/

If you find a bug with any of the demos and/or APIs themselves (and we hope you will:) please write them here:
http://shrt.st/2adv

Make sure to include your device model & Android version, as well as the nightly fennec version you are using,  in the bug.

Battery API demo:
http://people.mozilla.org/~jhammink/webapi_test_pages/BatteryAPIdemo.html 

This API tests the different charging states of the battery, along with charging level and discharging time.  Try launching the page with the device plugged in, and  then unplugging (and/or vice versa).  Note that the charging/discharging time presently shows Infinity  until the battery has charged/discharged about 2% of its total capacity.

Does the testpage show the correct battery state for the device?  Does it correctly generate an alert when the charging state changes?  Is the level correct (when compared against native battery app level)?  Does it give a numerical discharging/charging time after some time in the same charging state?

Camera API demo:
http://people.mozilla.org/~jhammink/webapi_test_pages/CameraAPIdemo.html 
This API presently tests the browser's ability to directly capture pictures from the device camera.

Point the device camera at the object you want to shoot  and click capture.

Is the picture rendered correctly (as opposed to  upside down, or sideways) both in the pre-capture and the preview?  Is the picture quality consistent with what your camera normally delivers?  Are there any other issues?  Please feel to play around with it a bit.

IndexedDB API demo:
http://people.mozilla.org/~jhammink/webapi_test_pages/IndexeddbAPIdemo.html 

Since accessing the native file system from the web introduces a huge risk, there needs to be a way to handle offline storage directly on a device.  Enter IndexedDB.   Actually, this api has been around since Firefox 4 (and subsequently for quite a few Chrome and other browser versions since) but the W3C spec got a rewrite recently and it's been well overdue for an upgrade.

When the browser first tries to create a local database, a prompt requests permission:


Subsequently, once this is allowed, the db initializes, and after some time, reports back on the number of records:



Our current demo matches a hash of zipcodes against a city (you must have zipcodes.csv present in same dir to work - this demo does), doing all the database access operations.  (Note that we're presently missing the functionality to do the reverse!) Once the CSV is loaded into the device local database, the  lookup should be instantaneous (note that all the steps are not depicted here):

Note that I've been getting dramatically different results from device to device.   Sometimes it works, sometimes not.   To be sure the feature is still a work in progress, so let me know what your experiences are.

Vibrator API demo:
http://people.mozilla.org/~jhammink/webapi_test_pages/VibratorAPIdemo.html 

Web apps, just like native ones,  need a way to send feedback to various sensors - including notification vibes.   The W3C spec lays a foundation, which we've implemented.  Note that you'll need a device with a vibrator to test this one:


You'll need a special build for this one also.  Try out each of the scenarios and verify the result.     Are we getting the correct number of buzzes, given the spec?  As with any of our APIs here, you can check the implementation by typing the string "view-source:" (without the quotes) before the "http://....".  Try it.


SMS API demo:
Note that you'll need an android phone with a working SIM card to try these demos.  Until this feature lands, you may also may also need a  special build with this feature.


http://people.mozilla.org/~jhammink/webapi_test_pages/SMSAPI_simplesend.html



The simplesend is a page that lets you send SMS messages to any phone.  Try it!  Is your message able to get through?  Any other issues?  Note that,  for testing purposes,  you can also try sending the messages directly to the same phone from where they originate.

This next example lets you do exactly that:  send and receive SMS messages from the same webpage instance:
http://people.mozilla.org/~jhammink/webapi_test_pages/SMSAPI_send_receive.html

This page is similar to the previous one, but also has an event handler for incoming messages.

Don't forget to study the page source, for each of these pages, to understand how these APIs are implemented.

And, once again, don't hesitate to file a bug if something doesn't appear to be working correctly, or if you have an idea about some features you'd like to see.  

Addendum:  The Web API test pages are now available in github:  https://github.com/jhammink/WebAPI-test-pages

Monday, 21 November 2011

Mozilla's Web API - on testing a framework.

So, hello again to you all.  It's been ages since I last posted at this space - but for good reason:  I've taken my performance show on the road again, and, at the same time, begun my work at Mozilla.  I find myself, once again, in the happy place of doing, on a daily basis, two different things that I love.

Primarily, my work has been around our Web API, and how we will write -and eventually automate - tests against it.  But how will we do this?

Our API is intended to "expand what the web can do".   One of the most important implications is the ability to access - in a secure fashion - our device hardware from the web.  To that end, there are such things as Vibrator API, Battery API, Settings API, Accelerometer and Sensor API, a new and improved Geolocation API, Sound API....from which we can work our device directly from the web!

So, how does one test a bunch of APIs as a user would use them?    Well, one thing (and I've been involved with such an effort before) is to build an Application Framework - essentially a series of mock-up and atomic apps that each demonstrate a single API.  

Over time, these atomic apps will be folded into more feature rich ones - to demonstrate the capabilities and (hopefully - we're QA after all) reveal any bugs that mixing and matching these APIs will uncover.

Another aspect that is important - particularly where automation is concerned - is a way of getting "golden values".   We will build a series of simple native applications for each OS that will help us to obtain these values for comparison.

Watch this space -  in the (very near) future we will demonstrate how many of the web apis work; how we will build HTML/JS test pages around them and test many of the features as a user would use them; build our golden apps in java and/or python (depending on our target platform), and, eventually, work the lot into an automation framework.   All of the code will be freely available on github.

I'm hoping for many outcomes; one of them being that you will learn (if you don't know already) how any of the technologies depicted here actually work, but also that you might jump in and help out - when the time is ready - by expanding what we've started here and our web api testpages, enriching our automation core apps, and really putting those apis through the paces, at their intended purpose.

Stay tuned!