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