Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/profiles/profile_manager_browsertest.cc

Issue 1228723002: Extract duplicated code in browser_tests for closing a browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/WithoutWaiting/Asynchronously Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/password_manager/password_store_factory.h" 9 #include "chrome/browser/password_manager/password_store_factory.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 kOnProfileSwitchDoNothing, 406 kOnProfileSwitchDoNothing,
407 ProfileMetrics::SWITCH_PROFILE_ICON); 407 ProfileMetrics::SWITCH_PROFILE_ICON);
408 EXPECT_EQ(3U, chrome::GetTotalBrowserCount()); 408 EXPECT_EQ(3U, chrome::GetTotalBrowserCount());
409 EXPECT_EQ(3U, browser_list->size()); 409 EXPECT_EQ(3U, browser_list->size());
410 410
411 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); 411 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());
412 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath()); 412 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath());
413 EXPECT_EQ(path_profile2, browser_list->get(2)->profile()->GetPath()); 413 EXPECT_EQ(path_profile2, browser_list->get(2)->profile()->GetPath());
414 414
415 // Closing the first window of the ephemeral profile should not delete it. 415 // Closing the first window of the ephemeral profile should not delete it.
416 browser_list->get(2)->window()->Close(); 416 CloseBrowserSynchronously(browser_list->get(2));
417 content::RunAllPendingInMessageLoop();
418 EXPECT_EQ(2U, browser_list->size()); 417 EXPECT_EQ(2U, browser_list->size());
419 EXPECT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); 418 EXPECT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles());
420 419
421 // The second should though. 420 // The second should though.
422 browser_list->get(1)->window()->Close(); 421 CloseBrowserSynchronously(browser_list->get(1));
423 content::RunAllPendingInMessageLoop();
424 EXPECT_EQ(1U, browser_list->size()); 422 EXPECT_EQ(1U, browser_list->size());
425 EXPECT_EQ(initial_profile_count, cache.GetNumberOfProfiles()); 423 EXPECT_EQ(initial_profile_count, cache.GetNumberOfProfiles());
426 } 424 }
427 425
428 // The test makes sense on those platforms where the keychain exists. 426 // The test makes sense on those platforms where the keychain exists.
429 #if !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 427 #if !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
430 IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeletePasswords) { 428 IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeletePasswords) {
431 Profile* profile = ProfileManager::GetActiveUserProfile(); 429 Profile* profile = ProfileManager::GetActiveUserProfile();
432 ASSERT_TRUE(profile); 430 ASSERT_TRUE(profile);
433 431
(...skipping 23 matching lines...) Expand all
457 profile_manager->ScheduleProfileForDeletion( 455 profile_manager->ScheduleProfileForDeletion(
458 profile->GetPath(), base::Bind(&OnUnblockOnProfileCreation, &run_loop)); 456 profile->GetPath(), base::Bind(&OnUnblockOnProfileCreation, &run_loop));
459 run_loop.Run(); 457 run_loop.Run();
460 458
461 PasswordStoreConsumerVerifier verify_delete; 459 PasswordStoreConsumerVerifier verify_delete;
462 password_store->GetAutofillableLogins(&verify_delete); 460 password_store->GetAutofillableLogins(&verify_delete);
463 verify_delete.Wait(); 461 verify_delete.Wait();
464 EXPECT_EQ(0u, verify_delete.GetPasswords().size()); 462 EXPECT_EQ(0u, verify_delete.GetPasswords().size());
465 } 463 }
466 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 464 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698