summaryrefslogtreecommitdiffstats
path: root/chrome/browser/diagnostics/diagnostics_main.cc
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-14 22:12:59 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-14 22:12:59 +0000
commit6d745ac2b40db5df3e3be3d639faef7c3eb1bfaa (patch)
treef94def671c0136d1308da9b488481f56077e09d1 /chrome/browser/diagnostics/diagnostics_main.cc
parent0149a3e9f9461c9909a6013db39f67eb1648a1f2 (diff)
downloadchromium_src-6d745ac2b40db5df3e3be3d639faef7c3eb1bfaa.zip
chromium_src-6d745ac2b40db5df3e3be3d639faef7c3eb1bfaa.tar.gz
chromium_src-6d745ac2b40db5df3e3be3d639faef7c3eb1bfaa.tar.bz2
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
Diffstat (limited to 'chrome/browser/diagnostics/diagnostics_main.cc')
-rw-r--r--chrome/browser/diagnostics/diagnostics_main.cc18
1 files changed, 17 insertions, 1 deletions
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);