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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 base::ScopedTempDir temp_dir; | 339 base::ScopedTempDir temp_dir; |
340 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 340 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
341 | 341 |
342 MockProfileDelegate delegate; | 342 MockProfileDelegate delegate; |
343 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); | 343 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); |
344 | 344 |
345 { | 345 { |
346 std::unique_ptr<Profile> profile(CreateProfile( | 346 std::unique_ptr<Profile> profile(CreateProfile( |
347 temp_dir.GetPath(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); | 347 temp_dir.GetPath(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); |
348 CheckChromeVersion(profile.get(), true); | 348 CheckChromeVersion(profile.get(), true); |
| 349 |
| 350 #if defined(OS_CHROMEOS) |
| 351 // Make sure session is marked as initialized. |
| 352 user_manager::User* user = |
| 353 chromeos::ProfileHelper::Get()->GetUserByProfile(profile.get()); |
| 354 EXPECT_TRUE(user->session_initialized()); |
| 355 #endif |
349 } | 356 } |
350 | 357 |
351 FlushIoTaskRunnerAndSpinThreads(); | 358 FlushIoTaskRunnerAndSpinThreads(); |
352 } | 359 } |
353 | 360 |
354 // Test OnProfileCreate is called with is_new_profile set to false when | 361 // Test OnProfileCreate is called with is_new_profile set to false when |
355 // creating a profile synchronously with an existing prefs file. | 362 // creating a profile synchronously with an existing prefs file. |
356 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileSynchronous) { | 363 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileSynchronous) { |
357 base::ScopedTempDir temp_dir; | 364 base::ScopedTempDir temp_dir; |
358 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 365 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
(...skipping 26 matching lines...) Expand all Loading... |
385 content::WindowedNotificationObserver observer( | 392 content::WindowedNotificationObserver observer( |
386 chrome::NOTIFICATION_PROFILE_CREATED, | 393 chrome::NOTIFICATION_PROFILE_CREATED, |
387 content::NotificationService::AllSources()); | 394 content::NotificationService::AllSources()); |
388 | 395 |
389 std::unique_ptr<Profile> profile(CreateProfile( | 396 std::unique_ptr<Profile> profile(CreateProfile( |
390 temp_dir.GetPath(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); | 397 temp_dir.GetPath(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); |
391 | 398 |
392 // Wait for the profile to be created. | 399 // Wait for the profile to be created. |
393 observer.Wait(); | 400 observer.Wait(); |
394 CheckChromeVersion(profile.get(), true); | 401 CheckChromeVersion(profile.get(), true); |
| 402 #if defined(OS_CHROMEOS) |
| 403 // Make sure session is marked as initialized. |
| 404 user_manager::User* user = |
| 405 chromeos::ProfileHelper::Get()->GetUserByProfile(profile.get()); |
| 406 EXPECT_TRUE(user->session_initialized()); |
| 407 #endif |
395 } | 408 } |
396 | 409 |
397 FlushIoTaskRunnerAndSpinThreads(); | 410 FlushIoTaskRunnerAndSpinThreads(); |
398 } | 411 } |
399 | 412 |
400 | 413 |
401 // Flaky: http://crbug.com/393177 | 414 // Flaky: http://crbug.com/393177 |
402 // Test OnProfileCreate is called with is_new_profile set to false when | 415 // Test OnProfileCreate is called with is_new_profile set to false when |
403 // creating a profile asynchronously with an existing prefs file. | 416 // creating a profile asynchronously with an existing prefs file. |
404 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, | 417 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); | 855 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); |
843 ASSERT_TRUE(hpkp_test_server.Start()); | 856 ASSERT_TRUE(hpkp_test_server.Start()); |
844 | 857 |
845 // To send a report, must use a non-numeric host name for the original | 858 // To send a report, must use a non-numeric host name for the original |
846 // request. This must not match the host name of the server that reports are | 859 // request. This must not match the host name of the server that reports are |
847 // sent to. | 860 // sent to. |
848 ui_test_utils::NavigateToURL(browser(), | 861 ui_test_utils::NavigateToURL(browser(), |
849 hpkp_test_server.GetURL("localhost", "/")); | 862 hpkp_test_server.GetURL("localhost", "/")); |
850 wait_for_report_loop.Run(); | 863 wait_for_report_loop.Run(); |
851 } | 864 } |
OLD | NEW |