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