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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 }; | 31 }; |
32 | 32 |
33 // Creates a prefs file in the given directory. | 33 // Creates a prefs file in the given directory. |
34 void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { | 34 void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { |
35 base::FilePath pref_path(directory_path.Append(chrome::kPreferencesFilename)); | 35 base::FilePath pref_path(directory_path.Append(chrome::kPreferencesFilename)); |
36 base::PlatformFile file = base::CreatePlatformFile(pref_path, | 36 base::PlatformFile file = base::CreatePlatformFile(pref_path, |
37 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, NULL, NULL); | 37 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, NULL, NULL); |
38 ASSERT_TRUE(file != base::kInvalidPlatformFileValue); | 38 ASSERT_TRUE(file != base::kInvalidPlatformFileValue); |
39 ASSERT_TRUE(base::ClosePlatformFile(file)); | 39 ASSERT_TRUE(base::ClosePlatformFile(file)); |
40 std::string data("{}"); | 40 std::string data("{}"); |
41 ASSERT_TRUE(file_util::WriteFile(pref_path, data.c_str(), data.size())); | 41 ASSERT_TRUE(base::WriteFile(pref_path, data.c_str(), data.size())); |
42 } | 42 } |
43 | 43 |
44 void CheckChromeVersion(Profile *profile, bool is_new) { | 44 void CheckChromeVersion(Profile *profile, bool is_new) { |
45 std::string created_by_version; | 45 std::string created_by_version; |
46 if (is_new) { | 46 if (is_new) { |
47 chrome::VersionInfo version_info; | 47 chrome::VersionInfo version_info; |
48 created_by_version = version_info.Version(); | 48 created_by_version = version_info.Version(); |
49 } else { | 49 } else { |
50 created_by_version = "1.0.0.0"; | 50 created_by_version = "1.0.0.0"; |
51 } | 51 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 std::string final_value(prefs->GetString(prefs::kSessionExitType)); | 244 std::string final_value(prefs->GetString(prefs::kSessionExitType)); |
245 EXPECT_EQ(crash_value, final_value); | 245 EXPECT_EQ(crash_value, final_value); |
246 | 246 |
247 // This test runs fast enough that the WebDataService may still be | 247 // This test runs fast enough that the WebDataService may still be |
248 // initializing (which uses the temp directory) when the test | 248 // initializing (which uses the temp directory) when the test |
249 // ends. Give it a chance to complete. | 249 // ends. Give it a chance to complete. |
250 profile.reset(); | 250 profile.reset(); |
251 content::RunAllPendingInMessageLoop(); | 251 content::RunAllPendingInMessageLoop(); |
252 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); | 252 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); |
253 } | 253 } |
OLD | NEW |