| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sqlite_diagnostics.h" | 5 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Generic diagnostic test class for checking sqlite db integrity. | 25 // Generic diagnostic test class for checking sqlite db integrity. |
| 26 class SqliteIntegrityTest : public DiagnosticTest { | 26 class SqliteIntegrityTest : public DiagnosticTest { |
| 27 public: | 27 public: |
| 28 SqliteIntegrityTest(bool critical, const string16& title, | 28 SqliteIntegrityTest(bool critical, const string16& title, |
| 29 const FilePath& profile_relative_db_path) | 29 const FilePath& profile_relative_db_path) |
| 30 : DiagnosticTest(title), | 30 : DiagnosticTest(title), |
| 31 critical_(critical), | 31 critical_(critical), |
| 32 db_path_(profile_relative_db_path) { | 32 db_path_(profile_relative_db_path) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual int GetId() { return 0; } | 35 virtual int GetId() OVERRIDE { return 0; } |
| 36 | 36 |
| 37 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { | 37 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { |
| 38 FilePath path = GetUserDefaultProfileDir(); | 38 FilePath path = GetUserDefaultProfileDir(); |
| 39 path = path.Append(db_path_); | 39 path = path.Append(db_path_); |
| 40 if (!file_util::PathExists(path)) { | 40 if (!file_util::PathExists(path)) { |
| 41 RecordOutcome(ASCIIToUTF16("File not found"), | 41 RecordOutcome(ASCIIToUTF16("File not found"), |
| 42 critical_ ? DiagnosticsModel::TEST_FAIL_CONTINUE : | 42 critical_ ? DiagnosticsModel::TEST_FAIL_CONTINUE : |
| 43 DiagnosticsModel::TEST_OK); | 43 DiagnosticsModel::TEST_OK); |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 int errors = 0; | 47 int errors = 0; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 appcache_db); | 121 appcache_db); |
| 122 } | 122 } |
| 123 | 123 |
| 124 DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() { | 124 DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() { |
| 125 FilePath databases_dir(webkit_database::kDatabaseDirectoryName); | 125 FilePath databases_dir(webkit_database::kDatabaseDirectoryName); |
| 126 FilePath tracker_db = | 126 FilePath tracker_db = |
| 127 databases_dir.Append(webkit_database::kTrackerDatabaseFileName); | 127 databases_dir.Append(webkit_database::kTrackerDatabaseFileName); |
| 128 return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"), | 128 return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"), |
| 129 tracker_db); | 129 tracker_db); |
| 130 } | 130 } |
| OLD | NEW |