From 6d745ac2b40db5df3e3be3d639faef7c3eb1bfaa Mon Sep 17 00:00:00 2001 From: "cpu@chromium.org" Date: Thu, 14 Jan 2010 22:12:59 +0000 Subject: Improvements to the diagnostic mode - bettet banner - init ICU - size checks on the critical paths BUG=none TEST=included Review URL: http://codereview.chromium.org/521050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36278 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/diagnostics/diagnostics_main.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'chrome/browser/diagnostics/diagnostics_main.cc') diff --git a/chrome/browser/diagnostics/diagnostics_main.cc b/chrome/browser/diagnostics/diagnostics_main.cc index 59a3814..c69172b 100644 --- a/chrome/browser/diagnostics/diagnostics_main.cc +++ b/chrome/browser/diagnostics/diagnostics_main.cc @@ -7,7 +7,9 @@ #include "app/app_paths.h" #include "base/basictypes.h" #include "base/command_line.h" +#include "base/i18n/icu_util.h" #include "base/string_util.h" +#include "base/time.h" #include "chrome/browser/diagnostics/diagnostics_model.h" #include "chrome/common/chrome_paths.h" @@ -123,6 +125,14 @@ class TestWriter { DISALLOW_COPY_AND_ASSIGN(TestWriter); }; +std::wstring PrintableUSCurrentTime() { + base::Time::Exploded exploded = {0}; + base::Time::Now().UTCExplode(&exploded); + return StringPrintf(L"%d:%d:%d.%d:%d:%d", + exploded.year, exploded.month, exploded.day_of_month, + exploded.hour, exploded.minute, exploded.second); +} + // This class is a basic test controller. In this design the view (TestWriter) // and the model (DiagnosticsModel) do not talk to each other directly but they // are mediated by the controller. This has a name: 'passive view'. @@ -135,11 +145,17 @@ class TestController : public DiagnosticsModel::Observer { // Run all the diagnostics of |model| and invoke the view as the model // callbacks arrive. void Run(DiagnosticsModel* model) { - writer_->WriteInfoText(L"Chrome Diagnostics\n"); + std::wstring title(L"Chrome Diagnostics Mode ("); + writer_->WriteInfoText(title.append(PrintableUSCurrentTime()) + L")\n"); if (!model) { writer_->WriteResult(false, L"Diagnostics start", L"model is null"); return; } + bool icu_result = icu_util::Initialize(); + if (!icu_result) { + writer_->WriteResult(false, L"Diagnostics start", L"ICU failure"); + return; + } int count = model->GetTestAvailableCount(); writer_->WriteInfoText(StringPrintf(L"%d available test(s)\n\n", count)); model->RunAll(this); -- cgit v1.1