| 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 = 18; | 27 const int DiagnosticsModel::kDiagnosticsTestCount = 17; |
| 28 #elif defined(OS_MACOSX) | 28 #elif defined(OS_MACOSX) |
| 29 const int DiagnosticsModel::kDiagnosticsTestCount = 14; | 29 const int DiagnosticsModel::kDiagnosticsTestCount = 13; |
| 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 = 18; | 32 const int DiagnosticsModel::kDiagnosticsTestCount = 17; |
| 33 #else | 33 #else |
| 34 const int DiagnosticsModel::kDiagnosticsTestCount = 16; | 34 const int DiagnosticsModel::kDiagnosticsTestCount = 15; |
| 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()); | |
| 168 tests_.push_back(MakeSqliteThumbnailsDbTest()); | 167 tests_.push_back(MakeSqliteThumbnailsDbTest()); |
| 169 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); | 168 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); |
| 170 } | 169 } |
| 171 | 170 |
| 172 private: | 171 private: |
| 173 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelWin); | 172 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelWin); |
| 174 }; | 173 }; |
| 175 | 174 |
| 176 #elif defined(OS_MACOSX) | 175 #elif defined(OS_MACOSX) |
| 177 class DiagnosticsModelMac : public DiagnosticsModelImpl { | 176 class DiagnosticsModelMac : public DiagnosticsModelImpl { |
| 178 public: | 177 public: |
| 179 DiagnosticsModelMac() { | 178 DiagnosticsModelMac() { |
| 180 tests_.push_back(MakeInstallTypeTest()); | 179 tests_.push_back(MakeInstallTypeTest()); |
| 181 tests_.push_back(MakeUserDirTest()); | 180 tests_.push_back(MakeUserDirTest()); |
| 182 tests_.push_back(MakeLocalStateFileTest()); | 181 tests_.push_back(MakeLocalStateFileTest()); |
| 183 tests_.push_back(MakeDictonaryDirTest()); | 182 tests_.push_back(MakeDictonaryDirTest()); |
| 184 tests_.push_back(MakeDiskSpaceTest()); | 183 tests_.push_back(MakeDiskSpaceTest()); |
| 185 tests_.push_back(MakePreferencesTest()); | 184 tests_.push_back(MakePreferencesTest()); |
| 186 tests_.push_back(MakeLocalStateTest()); | 185 tests_.push_back(MakeLocalStateTest()); |
| 187 tests_.push_back(MakeBookMarksTest()); | 186 tests_.push_back(MakeBookMarksTest()); |
| 188 tests_.push_back(MakeSqliteWebDataDbTest()); | 187 tests_.push_back(MakeSqliteWebDataDbTest()); |
| 189 tests_.push_back(MakeSqliteCookiesDbTest()); | 188 tests_.push_back(MakeSqliteCookiesDbTest()); |
| 190 tests_.push_back(MakeSqliteHistoryDbTest()); | 189 tests_.push_back(MakeSqliteHistoryDbTest()); |
| 191 tests_.push_back(MakeSqliteArchivedHistoryDbTest()); | |
| 192 tests_.push_back(MakeSqliteThumbnailsDbTest()); | 190 tests_.push_back(MakeSqliteThumbnailsDbTest()); |
| 193 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); | 191 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); |
| 194 } | 192 } |
| 195 | 193 |
| 196 private: | 194 private: |
| 197 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelMac); | 195 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelMac); |
| 198 }; | 196 }; |
| 199 | 197 |
| 200 #elif defined(OS_POSIX) | 198 #elif defined(OS_POSIX) |
| 201 class DiagnosticsModelPosix : public DiagnosticsModelImpl { | 199 class DiagnosticsModelPosix : public DiagnosticsModelImpl { |
| 202 public: | 200 public: |
| 203 DiagnosticsModelPosix() { | 201 DiagnosticsModelPosix() { |
| 204 tests_.push_back(MakeInstallTypeTest()); | 202 tests_.push_back(MakeInstallTypeTest()); |
| 205 tests_.push_back(MakeVersionTest()); | 203 tests_.push_back(MakeVersionTest()); |
| 206 tests_.push_back(MakeUserDirTest()); | 204 tests_.push_back(MakeUserDirTest()); |
| 207 tests_.push_back(MakeLocalStateFileTest()); | 205 tests_.push_back(MakeLocalStateFileTest()); |
| 208 tests_.push_back(MakeDictonaryDirTest()); | 206 tests_.push_back(MakeDictonaryDirTest()); |
| 209 tests_.push_back(MakeResourcesFileTest()); | 207 tests_.push_back(MakeResourcesFileTest()); |
| 210 tests_.push_back(MakeDiskSpaceTest()); | 208 tests_.push_back(MakeDiskSpaceTest()); |
| 211 tests_.push_back(MakePreferencesTest()); | 209 tests_.push_back(MakePreferencesTest()); |
| 212 tests_.push_back(MakeLocalStateTest()); | 210 tests_.push_back(MakeLocalStateTest()); |
| 213 tests_.push_back(MakeBookMarksTest()); | 211 tests_.push_back(MakeBookMarksTest()); |
| 214 tests_.push_back(MakeSqliteWebDataDbTest()); | 212 tests_.push_back(MakeSqliteWebDataDbTest()); |
| 215 tests_.push_back(MakeSqliteCookiesDbTest()); | 213 tests_.push_back(MakeSqliteCookiesDbTest()); |
| 216 tests_.push_back(MakeSqliteHistoryDbTest()); | 214 tests_.push_back(MakeSqliteHistoryDbTest()); |
| 217 tests_.push_back(MakeSqliteArchivedHistoryDbTest()); | |
| 218 tests_.push_back(MakeSqliteThumbnailsDbTest()); | 215 tests_.push_back(MakeSqliteThumbnailsDbTest()); |
| 219 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); | 216 tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); |
| 220 #if defined(OS_CHROMEOS) | 217 #if defined(OS_CHROMEOS) |
| 221 tests_.push_back(MakeSqliteNssCertDbTest()); | 218 tests_.push_back(MakeSqliteNssCertDbTest()); |
| 222 tests_.push_back(MakeSqliteNssKeyDbTest()); | 219 tests_.push_back(MakeSqliteNssKeyDbTest()); |
| 223 #endif | 220 #endif |
| 224 } | 221 } |
| 225 | 222 |
| 226 private: | 223 private: |
| 227 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelPosix); | 224 DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelPosix); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 239 #if defined(OS_WIN) | 236 #if defined(OS_WIN) |
| 240 return new DiagnosticsModelWin(); | 237 return new DiagnosticsModelWin(); |
| 241 #elif defined(OS_MACOSX) | 238 #elif defined(OS_MACOSX) |
| 242 return new DiagnosticsModelMac(); | 239 return new DiagnosticsModelMac(); |
| 243 #elif defined(OS_POSIX) | 240 #elif defined(OS_POSIX) |
| 244 return new DiagnosticsModelPosix(); | 241 return new DiagnosticsModelPosix(); |
| 245 #endif | 242 #endif |
| 246 } | 243 } |
| 247 | 244 |
| 248 } // namespace diagnostics | 245 } // namespace diagnostics |
| OLD | NEW |