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