| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_controller.h" | 5 #include "chrome/browser/diagnostics/diagnostics_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ::unsetenv("HOME"); | 68 ::unsetenv("HOME"); |
| 69 } | 69 } |
| 70 old_home_dir_.clear(); | 70 old_home_dir_.clear(); |
| 71 #endif | 71 #endif |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CorruptDataFile(const base::FilePath& path) { | 74 void CorruptDataFile(const base::FilePath& path) { |
| 75 // Just write some random characters into the file tInvaludUsero "corrupt" | 75 // Just write some random characters into the file tInvaludUsero "corrupt" |
| 76 // it. | 76 // it. |
| 77 const char bogus_data[] = "wwZ2uNYNuyUVzFbDm3DL"; | 77 const char bogus_data[] = "wwZ2uNYNuyUVzFbDm3DL"; |
| 78 file_util::WriteFile(path, bogus_data, arraysize(bogus_data)); | 78 base::WriteFile(path, bogus_data, arraysize(bogus_data)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 scoped_ptr<DiagnosticsModel> model_; | 81 scoped_ptr<DiagnosticsModel> model_; |
| 82 CommandLine cmdline_; | 82 CommandLine cmdline_; |
| 83 base::ScopedTempDir temp_dir_; | 83 base::ScopedTempDir temp_dir_; |
| 84 scoped_ptr<DiagnosticsWriter> writer_; | 84 scoped_ptr<DiagnosticsWriter> writer_; |
| 85 base::FilePath profile_dir_; | 85 base::FilePath profile_dir_; |
| 86 | 86 |
| 87 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
| 88 std::string old_home_dir_; | 88 std::string old_home_dir_; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 EXPECT_EQ(DiagnosticsModel::TEST_FAIL_CONTINUE, info->GetResult()); | 160 EXPECT_EQ(DiagnosticsModel::TEST_FAIL_CONTINUE, info->GetResult()); |
| 161 EXPECT_EQ(DIAG_SQLITE_ERROR_HANDLER_CALLED, info->GetOutcomeCode()); | 161 EXPECT_EQ(DIAG_SQLITE_ERROR_HANDLER_CALLED, info->GetOutcomeCode()); |
| 162 | 162 |
| 163 DiagnosticsController::GetInstance()->RunRecovery(cmdline_, writer_.get()); | 163 DiagnosticsController::GetInstance()->RunRecovery(cmdline_, writer_.get()); |
| 164 EXPECT_EQ(DiagnosticsModel::RECOVERY_OK, info->GetResult()); | 164 EXPECT_EQ(DiagnosticsModel::RECOVERY_OK, info->GetResult()); |
| 165 EXPECT_FALSE(base::PathExists(db_path)); | 165 EXPECT_FALSE(base::PathExists(db_path)); |
| 166 } | 166 } |
| 167 #endif | 167 #endif |
| 168 | 168 |
| 169 } // namespace diagnostics | 169 } // namespace diagnostics |
| OLD | NEW |