| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/diagnostics/diagnostics_test.h" | 17 #include "chrome/browser/diagnostics/diagnostics_test.h" |
| 18 #include "chrome/browser/diagnostics/recon_diagnostics.h" | 18 #include "chrome/browser/diagnostics/recon_diagnostics.h" |
| 19 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" | 19 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 | 22 |
| 23 namespace diagnostics { | 23 namespace diagnostics { |
| 24 | 24 |
| 25 // This is the count of diagnostic tests on each platform. This should | 25 // This is the count of diagnostic tests on each platform. This should |
| 26 // only be used by testing code. | 26 // only be used by testing code. |
| 27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 28 const int DiagnosticsModel::kDiagnosticsTestCount = 17; | 28 const int DiagnosticsModel::kDiagnosticsTestCount = 18; |
| 29 #elif defined(OS_MACOSX) | 29 #elif defined(OS_MACOSX) |
| 30 const int DiagnosticsModel::kDiagnosticsTestCount = 13; | 30 const int DiagnosticsModel::kDiagnosticsTestCount = 14; |
| 31 #elif defined(OS_POSIX) | 31 #elif defined(OS_POSIX) |
| 32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 33 const int DiagnosticsModel::kDiagnosticsTestCount = 17; | 33 const int DiagnosticsModel::kDiagnosticsTestCount = 18; |
| 34 #else | 34 #else |
| 35 const int DiagnosticsModel::kDiagnosticsTestCount = 15; | 35 const int DiagnosticsModel::kDiagnosticsTestCount = 16; |
| 36 #endif | 36 #endif |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // Embodies the commonalities of the model across platforms. It manages the | 41 // Embodies the commonalities of the model across platforms. It manages the |
| 42 // list of tests and can loop over them. The main job of the platform specific | 42 // list of tests and can loop over them. The main job of the platform specific |
| 43 // code becomes: | 43 // code becomes: |
| 44 // 1- Inserting the appropriate tests into |tests_| | 44 // 1- Inserting the appropriate tests into |tests_| |
| 45 // 2- Overriding RunTest() to wrap it with the appropriate fatal exception | 45 // 2- Overriding RunTest() to wrap it with the appropriate fatal exception |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 tests_.push_back(MakeUserDirTest()); | 157 tests_.push_back(MakeUserDirTest()); |
| 158 tests_.push_back(MakeLocalStateFileTest()); | 158 tests_.push_back(MakeLocalStateFileTest()); |
| 159 tests_.push_back(MakeDictonaryDirTest()); | 159 tests_.push_back(MakeDictonaryDirTest()); |
| 160 tests_.push_back(MakeResourcesFileTest()); | 160 tests_.push_back(MakeResourcesFileTest()); |
| 161 tests_.push_back(MakeDiskSpaceTest()); | 161 tests_.push_back(MakeDiskSpaceTest()); |
| 162 tests_.push_back(MakePreferencesTest()); | 162 tests_.push_back(MakePreferencesTest()); |
| 163 tests_.push_back(MakeLocalStateTest()); | 163 tests_.push_back(MakeLocalStateTest()); |
| 164 tests_.push_back(MakeBookMarksTest()); | 164 tests_.push_back(MakeBookMarksTest()); |
| 165 tests_.push_back(MakeSqliteWebDataDbTest()); | 165 tests_.push_back(MakeSqliteWebDataDbTest()); |
| 166 tests_.push_back(MakeSqliteCookiesDbTest()); | 166 tests_.push_back(MakeSqliteCookiesDbTest()); |
| 167 tests_.push_back(MakeSqliteFaviconsDbTest()); |
| 167 tests_.push_back(MakeSqliteHistoryDbTest()); | 168 tests_.push_back(MakeSqliteHistoryDbTest()); |
| 168 tests_.push_back(MakeSqliteThumbnailsDbTest()); | 169 tests_.push_back(MakeSqliteTopSitesDbTest()); |
| 169 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); | 170 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); |
| 170 } | 171 } |
| 171 | 172 |
| 172 private: | 173 private: |
| 173 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelWin); | 174 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelWin); |
| 174 }; | 175 }; |
| 175 | 176 |
| 176 #elif defined(OS_MACOSX) | 177 #elif defined(OS_MACOSX) |
| 177 class DiagnosticsModelMac : public DiagnosticsModelImpl { | 178 class DiagnosticsModelMac : public DiagnosticsModelImpl { |
| 178 public: | 179 public: |
| 179 DiagnosticsModelMac() { | 180 DiagnosticsModelMac() { |
| 180 tests_.push_back(MakeInstallTypeTest()); | 181 tests_.push_back(MakeInstallTypeTest()); |
| 181 tests_.push_back(MakeUserDirTest()); | 182 tests_.push_back(MakeUserDirTest()); |
| 182 tests_.push_back(MakeLocalStateFileTest()); | 183 tests_.push_back(MakeLocalStateFileTest()); |
| 183 tests_.push_back(MakeDictonaryDirTest()); | 184 tests_.push_back(MakeDictonaryDirTest()); |
| 184 tests_.push_back(MakeDiskSpaceTest()); | 185 tests_.push_back(MakeDiskSpaceTest()); |
| 185 tests_.push_back(MakePreferencesTest()); | 186 tests_.push_back(MakePreferencesTest()); |
| 186 tests_.push_back(MakeLocalStateTest()); | 187 tests_.push_back(MakeLocalStateTest()); |
| 187 tests_.push_back(MakeBookMarksTest()); | 188 tests_.push_back(MakeBookMarksTest()); |
| 188 tests_.push_back(MakeSqliteWebDataDbTest()); | 189 tests_.push_back(MakeSqliteWebDataDbTest()); |
| 189 tests_.push_back(MakeSqliteCookiesDbTest()); | 190 tests_.push_back(MakeSqliteCookiesDbTest()); |
| 191 tests_.push_back(MakeSqliteFaviconsDbTest()); |
| 190 tests_.push_back(MakeSqliteHistoryDbTest()); | 192 tests_.push_back(MakeSqliteHistoryDbTest()); |
| 191 tests_.push_back(MakeSqliteThumbnailsDbTest()); | 193 tests_.push_back(MakeSqliteTopSitesDbTest()); |
| 192 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); | 194 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); |
| 193 } | 195 } |
| 194 | 196 |
| 195 private: | 197 private: |
| 196 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelMac); | 198 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelMac); |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 #elif defined(OS_POSIX) | 201 #elif defined(OS_POSIX) |
| 200 class DiagnosticsModelPosix : public DiagnosticsModelImpl { | 202 class DiagnosticsModelPosix : public DiagnosticsModelImpl { |
| 201 public: | 203 public: |
| 202 DiagnosticsModelPosix() { | 204 DiagnosticsModelPosix() { |
| 203 tests_.push_back(MakeInstallTypeTest()); | 205 tests_.push_back(MakeInstallTypeTest()); |
| 204 tests_.push_back(MakeVersionTest()); | 206 tests_.push_back(MakeVersionTest()); |
| 205 tests_.push_back(MakeUserDirTest()); | 207 tests_.push_back(MakeUserDirTest()); |
| 206 tests_.push_back(MakeLocalStateFileTest()); | 208 tests_.push_back(MakeLocalStateFileTest()); |
| 207 tests_.push_back(MakeDictonaryDirTest()); | 209 tests_.push_back(MakeDictonaryDirTest()); |
| 208 tests_.push_back(MakeResourcesFileTest()); | 210 tests_.push_back(MakeResourcesFileTest()); |
| 209 tests_.push_back(MakeDiskSpaceTest()); | 211 tests_.push_back(MakeDiskSpaceTest()); |
| 210 tests_.push_back(MakePreferencesTest()); | 212 tests_.push_back(MakePreferencesTest()); |
| 211 tests_.push_back(MakeLocalStateTest()); | 213 tests_.push_back(MakeLocalStateTest()); |
| 212 tests_.push_back(MakeBookMarksTest()); | 214 tests_.push_back(MakeBookMarksTest()); |
| 213 tests_.push_back(MakeSqliteWebDataDbTest()); | 215 tests_.push_back(MakeSqliteWebDataDbTest()); |
| 214 tests_.push_back(MakeSqliteCookiesDbTest()); | 216 tests_.push_back(MakeSqliteCookiesDbTest()); |
| 217 tests_.push_back(MakeSqliteFaviconsDbTest()); |
| 215 tests_.push_back(MakeSqliteHistoryDbTest()); | 218 tests_.push_back(MakeSqliteHistoryDbTest()); |
| 216 tests_.push_back(MakeSqliteThumbnailsDbTest()); | 219 tests_.push_back(MakeSqliteTopSitesDbTest()); |
| 217 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); | 220 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); |
| 218 #if defined(OS_CHROMEOS) | 221 #if defined(OS_CHROMEOS) |
| 219 tests_.push_back(MakeSqliteNssCertDbTest()); | 222 tests_.push_back(MakeSqliteNssCertDbTest()); |
| 220 tests_.push_back(MakeSqliteNssKeyDbTest()); | 223 tests_.push_back(MakeSqliteNssKeyDbTest()); |
| 221 #endif | 224 #endif |
| 222 } | 225 } |
| 223 | 226 |
| 224 private: | 227 private: |
| 225 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelPosix); | 228 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelPosix); |
| 226 }; | 229 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 237 #if defined(OS_WIN) | 240 #if defined(OS_WIN) |
| 238 return new DiagnosticsModelWin(); | 241 return new DiagnosticsModelWin(); |
| 239 #elif defined(OS_MACOSX) | 242 #elif defined(OS_MACOSX) |
| 240 return new DiagnosticsModelMac(); | 243 return new DiagnosticsModelMac(); |
| 241 #elif defined(OS_POSIX) | 244 #elif defined(OS_POSIX) |
| 242 return new DiagnosticsModelPosix(); | 245 return new DiagnosticsModelPosix(); |
| 243 #endif | 246 #endif |
| 244 } | 247 } |
| 245 | 248 |
| 246 } // namespace diagnostics | 249 } // namespace diagnostics |
| OLD | NEW |