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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 // Wait for the profile to be created. | 157 // Wait for the profile to be created. |
158 content::WindowedNotificationObserver observer( | 158 content::WindowedNotificationObserver observer( |
159 chrome::NOTIFICATION_PROFILE_CREATED, | 159 chrome::NOTIFICATION_PROFILE_CREATED, |
160 content::Source<Profile>(profile.get())); | 160 content::Source<Profile>(profile.get())); |
161 observer.Wait(); | 161 observer.Wait(); |
162 | 162 |
163 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); | 163 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); |
164 | 164 |
165 // Verify that README exists. | 165 // Verify that README exists. |
166 EXPECT_TRUE(file_util::PathExists( | 166 EXPECT_TRUE(base::PathExists( |
167 temp_dir.path().Append(chrome::kReadmeFilename))); | 167 temp_dir.path().Append(chrome::kReadmeFilename))); |
168 } | 168 } |
169 | 169 |
170 // Test that Profile can be deleted before README file is created. | 170 // Test that Profile can be deleted before README file is created. |
171 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, ProfileDeletedBeforeReadmeCreated) { | 171 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, ProfileDeletedBeforeReadmeCreated) { |
172 base::ScopedTempDir temp_dir; | 172 base::ScopedTempDir temp_dir; |
173 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 173 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
174 | 174 |
175 MockProfileDelegate delegate; | 175 MockProfileDelegate delegate; |
176 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); | 176 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 std::string final_value(prefs->GetString(prefs::kSessionExitType)); | 226 std::string final_value(prefs->GetString(prefs::kSessionExitType)); |
227 EXPECT_EQ(crash_value, final_value); | 227 EXPECT_EQ(crash_value, final_value); |
228 | 228 |
229 // This test runs fast enough that the WebDataService may still be | 229 // This test runs fast enough that the WebDataService may still be |
230 // initializing (which uses the temp directory) when the test | 230 // initializing (which uses the temp directory) when the test |
231 // ends. Give it a chance to complete. | 231 // ends. Give it a chance to complete. |
232 profile.reset(); | 232 profile.reset(); |
233 content::RunAllPendingInMessageLoop(); | 233 content::RunAllPendingInMessageLoop(); |
234 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); | 234 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); |
235 } | 235 } |
OLD | NEW |