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" |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/profiles/chrome_version_service.h" | 13 #include "chrome/browser/profiles/chrome_version_service.h" |
14 #include "chrome/browser/profiles/profile_impl.h" | 14 #include "chrome/browser/profiles/profile_impl.h" |
15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
16 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 class MockProfileDelegate : public Profile::Delegate { | 25 class MockProfileDelegate : public Profile::Delegate { |
26 public: | 26 public: |
| 27 MOCK_METHOD1(OnPrefsLoaded, void(Profile*)); |
27 MOCK_METHOD3(OnProfileCreated, void(Profile*, bool, bool)); | 28 MOCK_METHOD3(OnProfileCreated, void(Profile*, bool, bool)); |
28 }; | 29 }; |
29 | 30 |
30 // Creates a prefs file in the given directory. | 31 // Creates a prefs file in the given directory. |
31 void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { | 32 void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { |
32 base::FilePath pref_path(directory_path.Append(chrome::kPreferencesFilename)); | 33 base::FilePath pref_path(directory_path.Append(chrome::kPreferencesFilename)); |
33 base::PlatformFile file = base::CreatePlatformFile(pref_path, | 34 base::PlatformFile file = base::CreatePlatformFile(pref_path, |
34 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, NULL, NULL); | 35 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, NULL, NULL); |
35 ASSERT_TRUE(file != base::kInvalidPlatformFileValue); | 36 ASSERT_TRUE(file != base::kInvalidPlatformFileValue); |
36 ASSERT_TRUE(base::ClosePlatformFile(file)); | 37 ASSERT_TRUE(base::ClosePlatformFile(file)); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 std::string final_value(prefs->GetString(prefs::kSessionExitType)); | 228 std::string final_value(prefs->GetString(prefs::kSessionExitType)); |
228 EXPECT_EQ(crash_value, final_value); | 229 EXPECT_EQ(crash_value, final_value); |
229 | 230 |
230 // This test runs fast enough that the WebDataService may still be | 231 // This test runs fast enough that the WebDataService may still be |
231 // initializing (which uses the temp directory) when the test | 232 // initializing (which uses the temp directory) when the test |
232 // ends. Give it a chance to complete. | 233 // ends. Give it a chance to complete. |
233 profile.reset(); | 234 profile.reset(); |
234 content::RunAllPendingInMessageLoop(); | 235 content::RunAllPendingInMessageLoop(); |
235 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); | 236 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); |
236 } | 237 } |
OLD | NEW |