diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-09 21:11:11 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-09 21:11:11 +0000 |
commit | f22fae44c1e8dadee6cf78b7a01a6465dfe33656 (patch) | |
tree | 3e50d519461cae9d53e8af9c50bfcec9a52a95aa /chrome/browser/diagnostics/diagnostics_model_unittest.cc | |
parent | 9232738f3f237d64e15fe17f9830b516652f5c86 (diff) | |
download | chromium_src-f22fae44c1e8dadee6cf78b7a01a6465dfe33656.zip chromium_src-f22fae44c1e8dadee6cf78b7a01a6465dfe33656.tar.gz chromium_src-f22fae44c1e8dadee6cf78b7a01a6465dfe33656.tar.bz2 |
This updates and cleans up the chrome diagnostics mode so that it includes some integrity checking for NSS databases on ChromeOS.
Added the concept of an "outcome code" that would allow individual tests to provide specific information about what the failure was.
Also, removed references to wstring, and generally made error messages more consistent in style.
Added two more modes (besides human-readable) for output of the results so that it could more easily be used for input to a program (--diagnostics-format=machine), and so that the output can be sent to the chrome log instead of creating/using a console at all (--diagnostics-format=log).
Rearranged the code so that diagnostics mode can be run in a mode that doesn't require internationalization code to be initialized (or indeed provide any output mode), so that it could be still be run early and let chrome continue running and deliver results to the user later when more UI layers are available.
Removed building of diagnostics code from the Android build.
These changes are in preparation for adding a "recovery" option to attempt to recover from profile corruption on ChromeOS when we detect that chrome has crashed and restarted.
TBR=cpu@chromium.org
BUG=chromium:236093
Review URL: https://chromiumcodereview.appspot.com/16905002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/diagnostics/diagnostics_model_unittest.cc')
-rw-r--r-- | chrome/browser/diagnostics/diagnostics_model_unittest.cc | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/chrome/browser/diagnostics/diagnostics_model_unittest.cc b/chrome/browser/diagnostics/diagnostics_model_unittest.cc index e362cd4..d70a299 100644 --- a/chrome/browser/diagnostics/diagnostics_model_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_model_unittest.cc @@ -8,7 +8,9 @@ #include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" -// Basic harness to adquire and release the Diagnostic model object. +namespace diagnostics { + +// Basic harness to acquire and release the Diagnostic model object. class DiagnosticsModelTest : public testing::Test { protected: DiagnosticsModelTest() @@ -36,27 +38,15 @@ class UTObserver: public DiagnosticsModel::Observer { public: UTObserver() : done_(false), - progress_called_(0), finished_(0), id_of_failed_stop_test(-1) { } - virtual void OnProgress(int id, - int percent, - DiagnosticsModel* model) OVERRIDE { - EXPECT_TRUE(model != NULL); - ++progress_called_; - } - - virtual void OnSkipped(int id, DiagnosticsModel* model) OVERRIDE { - EXPECT_TRUE(model != NULL); - } - - virtual void OnFinished(int id, DiagnosticsModel* model) OVERRIDE { + virtual void OnFinished(int index, DiagnosticsModel* model) OVERRIDE { EXPECT_TRUE(model != NULL); ++finished_; - if (model->GetTest(id).GetResult() == DiagnosticsModel::TEST_FAIL_STOP) { - id_of_failed_stop_test = id; + if (model->GetTest(index).GetResult() == DiagnosticsModel::TEST_FAIL_STOP) { + id_of_failed_stop_test = index; ASSERT_TRUE(false); } } @@ -68,25 +58,26 @@ class UTObserver: public DiagnosticsModel::Observer { bool done() const { return done_; } - int progress_called() const { return progress_called_; } - int finished() const { return finished_;} private: bool done_; - int progress_called_; int finished_; int id_of_failed_stop_test; }; -// We currently have more tests operational on windows. +// This is the count of tests on each platform. #if defined(OS_WIN) const int kDiagnosticsTestCount = 19; #elif defined(OS_MACOSX) const int kDiagnosticsTestCount = 16; #elif defined(OS_POSIX) +#if defined(OS_CHROMEOS) +const int kDiagnosticsTestCount = 19; +#else const int kDiagnosticsTestCount = 17; #endif +#endif // Test that the initial state is correct. TEST_F(DiagnosticsModelTest, BeforeRun) { @@ -103,7 +94,8 @@ TEST_F(DiagnosticsModelTest, RunAll) { EXPECT_FALSE(observer.done()); model_->RunAll(&observer); EXPECT_TRUE(observer.done()); - EXPECT_GT(observer.progress_called(), 0); EXPECT_EQ(kDiagnosticsTestCount, model_->GetTestRunCount()); EXPECT_EQ(kDiagnosticsTestCount, observer.finished()); } + +} // namespace diagnostics |