Index: chrome/browser/profiles/profile_manager_browsertest.cc |
diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc |
index f07472902f85fa851324cbb7d1a820141d046a84..92d00d08db511c7df01a1759e137e8a5dc7200cf 100644 |
--- a/chrome/browser/profiles/profile_manager_browsertest.cc |
+++ b/chrome/browser/profiles/profile_manager_browsertest.cc |
@@ -265,6 +265,22 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, |
} |
} |
+base::FilePath GetNonSigninProfileAt(ProfileInfoCache& cache, size_t index) { |
mtomasz
2015/02/18 03:13:06
ProfileInfoCache& -> const ProfileInfoCache&
Ivan Podogov
2015/02/24 11:43:16
Done.
|
+ base::FilePath result; |
+ size_t i, idx = 0, profile_num = cache.GetNumberOfProfiles(); |
mtomasz
2015/02/18 03:13:06
We have here i, idx, index. It's really difficult
Ivan Podogov
2015/02/24 11:43:16
Done.
|
+ for (i = 0; i != profile_num; ++i) { |
+ base::FilePath path = cache.GetPathOfProfileAtIndex(i); |
+#if defined(OS_CHROMEOS) |
+ if (path.BaseName().value() == chrome::kInitialProfile) |
+ continue; |
+#endif |
+ if (idx == index) |
Mr4D (OOO till 08-26)
2015/02/17 15:46:51
You could do a "idx++" here to eliminate line 279.
Ivan Podogov
2015/02/24 11:43:16
Done.
|
+ return path; |
+ ++idx; |
+ } |
+ return result; |
+} |
+ |
IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, |
SwitchToProfile) { |
#if defined(OS_WIN) && defined(USE_ASH) |
@@ -280,9 +296,10 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, |
ProfileManager* profile_manager = g_browser_process->profile_manager(); |
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
- base::FilePath path_profile1 = cache.GetPathOfProfileAtIndex(0); |
+ unsigned int initial_profile_count = profile_manager->GetNumberOfProfiles(); |
mtomasz
2015/02/18 03:13:07
Is number of profiles "unsigned int" or "size_t"?
Ivan Podogov
2015/02/24 11:43:16
Done.
|
+ base::FilePath path_profile1 = GetNonSigninProfileAt(cache, 0); |
- ASSERT_EQ(profile_manager->GetNumberOfProfiles(), 1U); |
+ ASSERT_NE(initial_profile_count, 0U); |
mtomasz
2015/02/18 03:13:06
Opposite argument order. Should be:
ASSERT(expecte
Ivan Podogov
2015/02/24 11:43:16
Done.
|
EXPECT_EQ(chrome::GetTotalBrowserCount(), 1U); |
// Create an additional profile. |
@@ -299,7 +316,7 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, |
chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); |
BrowserList* browser_list = BrowserList::GetInstance(desktop_type); |
- ASSERT_EQ(cache.GetNumberOfProfiles(), 2U); |
+ ASSERT_EQ(cache.GetNumberOfProfiles(), initial_profile_count + 1); |
EXPECT_EQ(1U, browser_list->size()); |
// Open a browser window for the first profile. |
@@ -349,9 +366,10 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_EphemeralProfile) { |
ProfileManager* profile_manager = g_browser_process->profile_manager(); |
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
- base::FilePath path_profile1 = cache.GetPathOfProfileAtIndex(0); |
+ unsigned int initial_profile_count = profile_manager->GetNumberOfProfiles(); |
mtomasz
2015/02/18 03:13:07
ditto
Ivan Podogov
2015/02/24 11:43:16
Done.
|
+ base::FilePath path_profile1 = GetNonSigninProfileAt(cache, 0); |
- ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles()); |
+ ASSERT_NE(0U, initial_profile_count); |
EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); |
// Create an ephemeral profile. |
@@ -367,7 +385,7 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_EphemeralProfile) { |
chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); |
BrowserList* browser_list = BrowserList::GetInstance(desktop_type); |
- ASSERT_EQ(2U, cache.GetNumberOfProfiles()); |
+ ASSERT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); |
EXPECT_EQ(1U, browser_list->size()); |
// Open a browser window for the second profile. |
@@ -393,13 +411,13 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_EphemeralProfile) { |
browser_list->get(2)->window()->Close(); |
content::RunAllPendingInMessageLoop(); |
EXPECT_EQ(2U, browser_list->size()); |
- ASSERT_EQ(2U, cache.GetNumberOfProfiles()); |
+ ASSERT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); |
// The second should though. |
browser_list->get(1)->window()->Close(); |
content::RunAllPendingInMessageLoop(); |
EXPECT_EQ(1U, browser_list->size()); |
- ASSERT_EQ(1U, cache.GetNumberOfProfiles()); |
+ ASSERT_EQ(initial_profile_count, cache.GetNumberOfProfiles()); |
mtomasz
2015/02/18 03:13:06
This can be EXPECT. AFAIK ASSERT should be used on
Ivan Podogov
2015/02/24 11:43:16
Done.
|
} |
// The test makes sense on those platforms where the keychain exists. |