| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/diagnostics/diagnostics_model.h" | 5 #include "chrome/browser/diagnostics/diagnostics_model.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace diagnostics { | 12 namespace diagnostics { |
| 13 | 13 |
| 14 // Basic harness to acquire and release the Diagnostic model object. | 14 // Basic harness to acquire and release the Diagnostic model object. |
| 15 class DiagnosticsModelTest : public testing::Test { | 15 class DiagnosticsModelTest : public testing::Test { |
| 16 protected: | 16 protected: |
| 17 DiagnosticsModelTest() | 17 DiagnosticsModelTest() |
| 18 : cmdline_(CommandLine::NO_PROGRAM) { | 18 : cmdline_(CommandLine::NO_PROGRAM) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 virtual ~DiagnosticsModelTest() { } | 21 ~DiagnosticsModelTest() override {} |
| 22 | 22 |
| 23 virtual void SetUp() { | 23 void SetUp() override { |
| 24 model_.reset(MakeDiagnosticsModel(cmdline_)); | 24 model_.reset(MakeDiagnosticsModel(cmdline_)); |
| 25 ASSERT_TRUE(model_.get() != NULL); | 25 ASSERT_TRUE(model_.get() != NULL); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void TearDown() { | 28 void TearDown() override { model_.reset(); } |
| 29 model_.reset(); | |
| 30 } | |
| 31 | 29 |
| 32 scoped_ptr<DiagnosticsModel> model_; | 30 scoped_ptr<DiagnosticsModel> model_; |
| 33 CommandLine cmdline_; | 31 CommandLine cmdline_; |
| 34 | 32 |
| 35 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelTest); | 33 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelTest); |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 // The test observer is used to know if the callbacks are being called. | 36 // The test observer is used to know if the callbacks are being called. |
| 39 class UTObserver: public DiagnosticsModel::Observer { | 37 class UTObserver: public DiagnosticsModel::Observer { |
| 40 public: | 38 public: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 EXPECT_TRUE(observer.tests_done()); | 101 EXPECT_TRUE(observer.tests_done()); |
| 104 EXPECT_FALSE(observer.recovery_done()); | 102 EXPECT_FALSE(observer.recovery_done()); |
| 105 model_->RecoverAll(&observer); | 103 model_->RecoverAll(&observer); |
| 106 EXPECT_TRUE(observer.recovery_done()); | 104 EXPECT_TRUE(observer.recovery_done()); |
| 107 EXPECT_EQ(DiagnosticsModel::kDiagnosticsTestCount, model_->GetTestRunCount()); | 105 EXPECT_EQ(DiagnosticsModel::kDiagnosticsTestCount, model_->GetTestRunCount()); |
| 108 EXPECT_EQ(DiagnosticsModel::kDiagnosticsTestCount, observer.num_tested()); | 106 EXPECT_EQ(DiagnosticsModel::kDiagnosticsTestCount, observer.num_tested()); |
| 109 EXPECT_EQ(DiagnosticsModel::kDiagnosticsTestCount, observer.num_recovered()); | 107 EXPECT_EQ(DiagnosticsModel::kDiagnosticsTestCount, observer.num_recovered()); |
| 110 } | 108 } |
| 111 | 109 |
| 112 } // namespace diagnostics | 110 } // namespace diagnostics |
| OLD | NEW |