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

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

Issue 10967003: Add desktop type context to most existing instances of FindTabbedBrowser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving check_deps exception to specific_include_rules after chat with Kai. Created 8 years, 2 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 | Annotate | Revision Log
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 "chrome/browser/profiles/profile_info_cache.h" 6 #include "chrome/browser/profiles/profile_info_cache.h"
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 #include "chrome/browser/ui/host_desktop.h"
8 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
9 #include "chrome/test/base/testing_browser_process.h" 10 #include "chrome/test/base/testing_browser_process.h"
10 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
11 12
12 namespace { 13 namespace {
13 14
14 // An observer that returns back to test code after a new profile is 15 // An observer that returns back to test code after a new profile is
15 // initialized. 16 // initialized.
16 void OnUnblockOnProfileCreation(Profile* profile, 17 void OnUnblockOnProfileCreation(Profile* profile,
17 Profile::CreateStatus status) { 18 Profile::CreateStatus status) {
(...skipping 16 matching lines...) Expand all
34 IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeleteSingletonProfile) { 35 IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeleteSingletonProfile) {
35 ProfileManager* profile_manager = g_browser_process->profile_manager(); 36 ProfileManager* profile_manager = g_browser_process->profile_manager();
36 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 37 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
37 38
38 // We should start out with 1 profile. 39 // We should start out with 1 profile.
39 ASSERT_EQ(cache.GetNumberOfProfiles(), 1U); 40 ASSERT_EQ(cache.GetNumberOfProfiles(), 1U);
40 41
41 // Delete singleton profile. 42 // Delete singleton profile.
42 FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0); 43 FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0);
43 EXPECT_FALSE(singleton_profile_path.empty()); 44 EXPECT_FALSE(singleton_profile_path.empty());
44 profile_manager->ScheduleProfileForDeletion(singleton_profile_path); 45 profile_manager->ScheduleProfileForDeletion(singleton_profile_path,
46 chrome::HOST_DESKTOP_TYPE_NATIVE);
45 47
46 // Spin things till profile is actually deleted. 48 // Spin things till profile is actually deleted.
47 content::RunAllPendingInMessageLoop(); 49 content::RunAllPendingInMessageLoop();
48 50
49 // Make sure a new profile was created automatically. 51 // Make sure a new profile was created automatically.
50 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); 52 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U);
51 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); 53 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0);
52 EXPECT_NE(new_profile_path, singleton_profile_path); 54 EXPECT_NE(new_profile_path, singleton_profile_path);
53 55
54 // Make sure that last used profile preference is set correctly. 56 // Make sure that last used profile preference is set correctly.
(...skipping 25 matching lines...) Expand all
80 // by OnUnblockOnProfileCreation when the profile is created. 82 // by OnUnblockOnProfileCreation when the profile is created.
81 content::RunMessageLoop(); 83 content::RunMessageLoop();
82 84
83 ASSERT_EQ(cache.GetNumberOfProfiles(), 2U); 85 ASSERT_EQ(cache.GetNumberOfProfiles(), 2U);
84 86
85 // Delete all profiles. 87 // Delete all profiles.
86 FilePath profile_path1 = cache.GetPathOfProfileAtIndex(0); 88 FilePath profile_path1 = cache.GetPathOfProfileAtIndex(0);
87 FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1); 89 FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1);
88 EXPECT_FALSE(profile_path1.empty()); 90 EXPECT_FALSE(profile_path1.empty());
89 EXPECT_FALSE(profile_path2.empty()); 91 EXPECT_FALSE(profile_path2.empty());
90 profile_manager->ScheduleProfileForDeletion(profile_path1); 92 profile_manager->ScheduleProfileForDeletion(profile_path1,
91 profile_manager->ScheduleProfileForDeletion(profile_path2); 93 chrome::HOST_DESKTOP_TYPE_NATIVE);
94 profile_manager->ScheduleProfileForDeletion(profile_path2,
95 chrome::HOST_DESKTOP_TYPE_NATIVE);
92 96
93 // Spin things so deletion can take place. 97 // Spin things so deletion can take place.
94 content::RunAllPendingInMessageLoop(); 98 content::RunAllPendingInMessageLoop();
95 99
96 // Make sure a new profile was created automatically. 100 // Make sure a new profile was created automatically.
97 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); 101 EXPECT_EQ(cache.GetNumberOfProfiles(), 1U);
98 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); 102 FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0);
99 EXPECT_NE(new_profile_path, profile_path1); 103 EXPECT_NE(new_profile_path, profile_path1);
100 EXPECT_NE(new_profile_path, profile_path2); 104 EXPECT_NE(new_profile_path, profile_path2);
101 105
102 // Make sure that last used profile preference is set correctly. 106 // Make sure that last used profile preference is set correctly.
103 Profile* last_used = ProfileManager::GetLastUsedProfile(); 107 Profile* last_used = ProfileManager::GetLastUsedProfile();
104 EXPECT_EQ(new_profile_path, last_used->GetPath()); 108 EXPECT_EQ(new_profile_path, last_used->GetPath());
105 } 109 }
106 #endif // OS_MACOSX 110 #endif // OS_MACOSX
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/protector/protector_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698