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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 DiagnosticsControllerTest() : cmdline_(base::CommandLine::NO_PROGRAM) {} | 30 DiagnosticsControllerTest() : cmdline_(base::CommandLine::NO_PROGRAM) {} |
31 | 31 |
32 ~DiagnosticsControllerTest() override {} | 32 ~DiagnosticsControllerTest() override {} |
33 | 33 |
34 void SetUp() override { | 34 void SetUp() override { |
35 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
36 base::FilePath test_data; | 36 base::FilePath test_data; |
37 PathService::Get(chrome::DIR_TEST_DATA, &test_data); | 37 PathService::Get(chrome::DIR_TEST_DATA, &test_data); |
38 test_data = test_data.Append(FILE_PATH_LITERAL("diagnostics")); | 38 test_data = test_data.Append(FILE_PATH_LITERAL("diagnostics")); |
39 test_data = test_data.Append(FILE_PATH_LITERAL("user")); | 39 test_data = test_data.Append(FILE_PATH_LITERAL("user")); |
40 base::CopyDirectory(test_data, temp_dir_.path(), true); | 40 base::CopyDirectory(test_data, temp_dir_.GetPath(), true); |
41 profile_dir_ = temp_dir_.path().Append(FILE_PATH_LITERAL("user")); | 41 profile_dir_ = temp_dir_.GetPath().Append(FILE_PATH_LITERAL("user")); |
42 | 42 |
43 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
44 // Redirect the home dir to the profile directory. We have to do this | 44 // Redirect the home dir to the profile directory. We have to do this |
45 // because NSS uses the HOME directory to find where to store it's database, | 45 // because NSS uses the HOME directory to find where to store it's database, |
46 // so that's where the diagnostics and recovery code looks for it. | 46 // so that's where the diagnostics and recovery code looks for it. |
47 PathService::Get(base::DIR_HOME, &old_home_dir_); | 47 PathService::Get(base::DIR_HOME, &old_home_dir_); |
48 PathService::Override(base::DIR_HOME, profile_dir_); | 48 PathService::Override(base::DIR_HOME, profile_dir_); |
49 #endif | 49 #endif |
50 | 50 |
51 cmdline_ = base::CommandLine(base::CommandLine::NO_PROGRAM); | 51 cmdline_ = base::CommandLine(base::CommandLine::NO_PROGRAM); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 EXPECT_EQ(DiagnosticsModel::TEST_FAIL_CONTINUE, info->GetResult()); | 154 EXPECT_EQ(DiagnosticsModel::TEST_FAIL_CONTINUE, info->GetResult()); |
155 EXPECT_EQ(DIAG_SQLITE_ERROR_HANDLER_CALLED, info->GetOutcomeCode()); | 155 EXPECT_EQ(DIAG_SQLITE_ERROR_HANDLER_CALLED, info->GetOutcomeCode()); |
156 | 156 |
157 DiagnosticsController::GetInstance()->RunRecovery(cmdline_, writer_.get()); | 157 DiagnosticsController::GetInstance()->RunRecovery(cmdline_, writer_.get()); |
158 EXPECT_EQ(DiagnosticsModel::RECOVERY_OK, info->GetResult()); | 158 EXPECT_EQ(DiagnosticsModel::RECOVERY_OK, info->GetResult()); |
159 EXPECT_FALSE(base::PathExists(db_path)); | 159 EXPECT_FALSE(base::PathExists(db_path)); |
160 } | 160 } |
161 #endif | 161 #endif |
162 | 162 |
163 } // namespace diagnostics | 163 } // namespace diagnostics |
OLD | NEW |