[Remoting] Add generic JS typecheck functions to cleanup client_plugin.js.

Also add isValidState and isValidConnectionError so that the code is more readable.

Also fix typo with supportedCapabilities

BUG=
R=jamiewalch@chromium.org

Review URL: https://codereview.chromium.org/131643008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250816 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 250816
[Telemetry] Use file_poller to retrieve samples on Nexus 10

R=jeremy@chromium.org,tonyg@chromium.org

Review URL: https://codereview.chromium.org/160483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250817 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 250817