gaye/gaia-email-libs-and-more — pull request #1 by asutherland (2013-05-31 21:33:47+00:00)
Title: Add checks to our unit tests for the reported new message count.

note: please don't squash this in with your commit.

This also includes a minor change in how the newEmailCount value is tracked
on the FolderStorage so that it is only updated coherently so public
visibility never shows any intermediary states.

It turns out that only for some of the logger types had I changed from useArgs
to using arguments.length to allow expectations to skip asserting expectations
over unspecified arguments. I've now updated all of them, allowing the
newCount check I added to work.

Unit test assertions were added to existing core sync tests to make sure we
report null "newEmailCount"s when appropriate, zeroes when appropriate, and
correct new values when appropriate. For future work we are going to want
to have a test that adds new-but-read messages and verify that does not
increase our new count. This can probably be done as part of the periodic
sync / notifications logic.

One minor change was to make sure that ActiveSync is waiting for header/body
manipulations to clear before completing the sync. This was one source of
intermittent failures.