[Sync] fix about:sync crash with unrecoverable error

If the client had encountered an unrecoverable error typing about:sync would crash because the client code would try to dereference the backendhost for the purpose of printing the model group information(by this time backendhost would have been released). The fix is to bail out of printing the model information if the client had encountered an unrecoverable error. however we would still print the client had encountered an urecoverable error and the line number etc.

In the process moved a bunch of code related to collecting about information for sync, from browser_about_handler.cc to sync_ui_util.cc. The refactoing helps us in unit testing by passing in a mock service object.
BUG=55503
TEST=Wrote a new unit test for it. ConstructAboutInformationWithUnrecoverableErrorTest. Also tested by pretending one of the datatypes generated an unrecoverable error in the debugger.

Original patch by [email protected]
Original review: http://codereview.chromium.org/3715002

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62789 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index d5514040..01b4f5b 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -205,7 +205,7 @@
 
   // Get various information for displaying in the user interface.
   browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary();
-  browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus();
+  virtual browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus();
 
   const GoogleServiceAuthError& GetAuthError() const {
     return last_auth_error_;
@@ -233,7 +233,7 @@
   // TODO(timsteele): What happens if the bookmark model is loaded, a change
   // takes place, and the backend isn't initialized yet?
   bool sync_initialized() const { return backend_initialized_; }
-  bool unrecoverable_error_detected() const {
+  virtual bool unrecoverable_error_detected() const {
     return unrecoverable_error_detected_;
   }
   const std::string& unrecoverable_error_message() {
@@ -256,7 +256,7 @@
   const base::Time& last_synced_time() const { return last_synced_time_; }
 
   // Returns a user-friendly string form of last synced time (in minutes).
-  string16 GetLastSyncedTimeString() const;
+  virtual string16 GetLastSyncedTimeString() const;
 
   // Returns the authenticated username of the sync user, or empty if none
   // exists. It will only exist if the authentication service provider (e.g