Fix Lion dictionary popup staying after tab-close via cmd-W.

This was caused by the close menu item not sending a -[performClose:],
which was what the popup was looking for.

Adds some unit tests and refactors some code to make it more testable.

BUG=104931
TEST=Open a tab and double 3-finger tap on a word to bring up the
dictionary popup. Hit cmd-W. The popup should close but they tab
should stay open. Hit cmd-W again. The tab should close.
Try cmd-shift-W with > 1 tab open. The window should close.

Review URL: http://codereview.chromium.org/9026016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116144 0039d316-1c4b-4281-b951-d872f2087c98
10 files changed