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/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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); | 176 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); |
177 | 177 |
178 // Wait for the profile to be created. | 178 // Wait for the profile to be created. |
179 observer.Wait(); | 179 observer.Wait(); |
180 CheckChromeVersion(profile.get(), true); | 180 CheckChromeVersion(profile.get(), true); |
181 } | 181 } |
182 | 182 |
183 FlushIoTaskRunnerAndSpinThreads(); | 183 FlushIoTaskRunnerAndSpinThreads(); |
184 } | 184 } |
185 | 185 |
| 186 |
| 187 // Flaky: http://crbug.com/393177 |
186 // Test OnProfileCreate is called with is_new_profile set to false when | 188 // Test OnProfileCreate is called with is_new_profile set to false when |
187 // creating a profile asynchronously with an existing prefs file. | 189 // creating a profile asynchronously with an existing prefs file. |
188 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileAsynchronous) { | 190 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, |
| 191 DISABLED_CreateOldProfileAsynchronous) { |
189 base::ScopedTempDir temp_dir; | 192 base::ScopedTempDir temp_dir; |
190 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 193 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
191 CreatePrefsFileInDirectory(temp_dir.path()); | 194 CreatePrefsFileInDirectory(temp_dir.path()); |
192 | 195 |
193 MockProfileDelegate delegate; | 196 MockProfileDelegate delegate; |
194 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); | 197 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); |
195 | 198 |
196 { | 199 { |
197 content::WindowedNotificationObserver observer( | 200 content::WindowedNotificationObserver observer( |
198 chrome::NOTIFICATION_PROFILE_CREATED, | 201 chrome::NOTIFICATION_PROFILE_CREATED, |
199 content::NotificationService::AllSources()); | 202 content::NotificationService::AllSources()); |
200 | 203 |
201 scoped_ptr<Profile> profile(CreateProfile( | 204 scoped_ptr<Profile> profile(CreateProfile( |
202 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); | 205 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); |
203 | 206 |
204 // Wait for the profile to be created. | 207 // Wait for the profile to be created. |
205 observer.Wait(); | 208 observer.Wait(); |
206 CheckChromeVersion(profile.get(), false); | 209 CheckChromeVersion(profile.get(), false); |
207 } | 210 } |
208 | 211 |
209 FlushIoTaskRunnerAndSpinThreads(); | 212 FlushIoTaskRunnerAndSpinThreads(); |
210 } | 213 } |
211 | 214 |
| 215 // Flaky: http://crbug.com/393177 |
212 // Test that a README file is created for profiles that didn't have it. | 216 // Test that a README file is created for profiles that didn't have it. |
213 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, ProfileReadmeCreated) { | 217 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_ProfileReadmeCreated) { |
214 base::ScopedTempDir temp_dir; | 218 base::ScopedTempDir temp_dir; |
215 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 219 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
216 | 220 |
217 MockProfileDelegate delegate; | 221 MockProfileDelegate delegate; |
218 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); | 222 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); |
219 | 223 |
220 // No delay before README creation. | 224 // No delay before README creation. |
221 ProfileImpl::create_readme_delay_ms = 0; | 225 ProfileImpl::create_readme_delay_ms = 0; |
222 | 226 |
223 { | 227 { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 g_browser_process->EndSession(); | 371 g_browser_process->EndSession(); |
368 | 372 |
369 // Verify that the setting was indeed written. | 373 // Verify that the setting was indeed written. |
370 for (size_t i = 0; i < loaded_profiles.size(); ++i) { | 374 for (size_t i = 0; i < loaded_profiles.size(); ++i) { |
371 Profile* profile = loaded_profiles[i]; | 375 Profile* profile = loaded_profiles[i]; |
372 // Make sure that the prefs file was written with the expected key/value. | 376 // Make sure that the prefs file was written with the expected key/value. |
373 ASSERT_EQ(GetExitTypePreferenceFromDisk(profile), "SessionEnded"); | 377 ASSERT_EQ(GetExitTypePreferenceFromDisk(profile), "SessionEnded"); |
374 } | 378 } |
375 } | 379 } |
376 #endif // defined(USE_X11) || defined(OS_WIN) | 380 #endif // defined(USE_X11) || defined(OS_WIN) |
OLD | NEW |