diff options
| author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-20 03:57:10 +0000 |
|---|---|---|
| committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-20 03:57:10 +0000 |
| commit | 26f46476feaf3f7a58a92366826fc826315540e3 (patch) | |
| tree | c87842e5f7191d8582deeb0d0da8fdfa42f641b9 /chrome/browser/diagnostics/diagnostics_model_unittest.cc | |
| parent | 3221491bba46c30ede23f7f43c1ad05523b8ec13 (diff) | |
| download | chromium_src-26f46476feaf3f7a58a92366826fc826315540e3.zip chromium_src-26f46476feaf3f7a58a92366826fc826315540e3.tar.gz chromium_src-26f46476feaf3f7a58a92366826fc826315540e3.tar.bz2 | |
Add some diagnostic test to diagnostic mode
- Move the one existing test to final location
- Test more critical paths to be accessilbe and writable
- Test the OS version
- Test user or systemwide install type
BUG=27885
TEST=unit test updated
Review URL: http://codereview.chromium.org/504028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35057 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 | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/chrome/browser/diagnostics/diagnostics_model_unittest.cc b/chrome/browser/diagnostics/diagnostics_model_unittest.cc index 442db84..5aef7f4 100644 --- a/chrome/browser/diagnostics/diagnostics_model_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_model_unittest.cc @@ -27,7 +27,12 @@ class DiagnosticsModelTest : public testing::Test { // The test observer is used to know if the callbacks are being called. class UTObserver: public DiagnosticsModel::Observer { public: - UTObserver() : done_(false), progress_called_(0), finished_(0) {} + UTObserver() + : done_(false), + progress_called_(0), + finished_(0), + id_of_failed_stop_test(-1) { + } virtual void OnProgress(int id, int percent, DiagnosticsModel* model) { EXPECT_TRUE(model != NULL); @@ -41,6 +46,10 @@ class UTObserver: public DiagnosticsModel::Observer { virtual void OnFinished(int id, DiagnosticsModel* model) { EXPECT_TRUE(model != NULL); ++finished_; + if (model->GetTest(id).GetResult() == DiagnosticsModel::TEST_FAIL_STOP) { + id_of_failed_stop_test = id; + ASSERT_TRUE(false); + } } virtual void OnDoneAll(DiagnosticsModel* model) { @@ -58,12 +67,20 @@ class UTObserver: public DiagnosticsModel::Observer { bool done_; int progress_called_; int finished_; + int id_of_failed_stop_test; }; -// Test that the initial state is correct. We only have one test +// We currently have more tests operational on windows. +#if defined(OS_WIN) +const int kDiagnosticsTestCount = 7; +#else +const int kDiagnosticsTestCount = 6; +#endif + +// Test that the initial state is correct. TEST_F(DiagnosticsModelTest, BeforeRun) { int available = model_->GetTestAvailableCount(); - EXPECT_EQ(1, available); + EXPECT_EQ(kDiagnosticsTestCount, available); EXPECT_EQ(0, model_->GetTestRunCount()); EXPECT_EQ(DiagnosticsModel::TEST_NOT_RUN, model_->GetTest(0).GetResult()); } @@ -76,6 +93,6 @@ TEST_F(DiagnosticsModelTest, RunAll) { model_->RunAll(&observer); EXPECT_TRUE(observer.done()); EXPECT_GT(observer.progress_called(), 0); - EXPECT_EQ(1, model_->GetTestRunCount()); - EXPECT_EQ(1, observer.finished()); + EXPECT_EQ(kDiagnosticsTestCount, model_->GetTestRunCount()); + EXPECT_EQ(kDiagnosticsTestCount, observer.finished()); } |
