| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/avatar_menu_model.h" | 5 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/profiles/profile_manager_util.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
| 15 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 typedef InProcessBrowserTest AvatarMenuModelTest; | 20 typedef InProcessBrowserTest AvatarMenuModelTest; |
| 20 | 21 |
| 21 IN_PROC_BROWSER_TEST_F(AvatarMenuModelTest, SignOut) { | 22 IN_PROC_BROWSER_TEST_F(AvatarMenuModelTest, SignOut) { |
| 22 if (!ProfileManager::IsMultipleProfilesEnabled()) | 23 if (!profiles::IsMultipleProfilesEnabled()) |
| 23 return; | 24 return; |
| 24 | 25 |
| 25 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 26 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 26 Profile* current_profile = browser()->profile(); | 27 Profile* current_profile = browser()->profile(); |
| 27 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 28 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
| 28 size_t index = cache.GetIndexOfProfileWithPath(current_profile->GetPath()); | 29 size_t index = cache.GetIndexOfProfileWithPath(current_profile->GetPath()); |
| 29 | 30 |
| 30 AvatarMenuModel model(&cache, NULL, browser()); | 31 AvatarMenuModel model(&cache, NULL, browser()); |
| 31 | 32 |
| 32 BrowserList* browser_list = | 33 BrowserList* browser_list = |
| 33 BrowserList::GetInstance(chrome::GetActiveDesktop()); | 34 BrowserList::GetInstance(chrome::GetActiveDesktop()); |
| 34 EXPECT_EQ(1U, browser_list->size()); | 35 EXPECT_EQ(1U, browser_list->size()); |
| 35 content::WindowedNotificationObserver window_close_observer( | 36 content::WindowedNotificationObserver window_close_observer( |
| 36 chrome::NOTIFICATION_BROWSER_CLOSED, | 37 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 37 content::Source<Browser>(browser())); | 38 content::Source<Browser>(browser())); |
| 38 | 39 |
| 39 EXPECT_FALSE(cache.ProfileIsSigninRequiredAtIndex(index)); | 40 EXPECT_FALSE(cache.ProfileIsSigninRequiredAtIndex(index)); |
| 40 model.SetLogoutURL("about:blank"); | 41 model.SetLogoutURL("about:blank"); |
| 41 model.BeginSignOut(); | 42 model.BeginSignOut(); |
| 42 EXPECT_TRUE(cache.ProfileIsSigninRequiredAtIndex(index)); | 43 EXPECT_TRUE(cache.ProfileIsSigninRequiredAtIndex(index)); |
| 43 | 44 |
| 44 window_close_observer.Wait(); // rely on test time-out for failure indication | 45 window_close_observer.Wait(); // rely on test time-out for failure indication |
| 45 EXPECT_EQ(0U, browser_list->size()); | 46 EXPECT_EQ(0U, browser_list->size()); |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace | 49 } // namespace |
| OLD | NEW |