| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/profiles/avatar_menu.h" | 7 #include "chrome/browser/profiles/avatar_menu.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/profiles/profile_window.h" | 9 #include "chrome/browser/profiles/profile_window.h" |
| 10 #include "chrome/browser/profiles/profiles_state.h" | 10 #include "chrome/browser/profiles/profiles_state.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/ui/user_manager.h" | 13 #include "chrome/browser/ui/user_manager.h" |
| 14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/test_switches.h" | 16 #include "chrome/test/base/test_switches.h" |
| 17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // An observer that returns back to test code after a new profile is | 22 // An observer that returns back to test code after a new profile is |
| 23 // initialized. | 23 // initialized. |
| 24 void OnUnblockOnProfileCreation(Profile* profile, | 24 void OnUnblockOnProfileCreation(Profile* profile, |
| 25 Profile::CreateStatus status) { | 25 Profile::CreateStatus status) { |
| 26 if (status == Profile::CREATE_STATUS_INITIALIZED) | 26 if (status == Profile::CREATE_STATUS_INITIALIZED) |
| 27 base::MessageLoop::current()->Quit(); | 27 base::MessageLoop::current()->QuitWhenIdle(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 class ProfileListDesktopBrowserTest : public InProcessBrowserTest { | 32 class ProfileListDesktopBrowserTest : public InProcessBrowserTest { |
| 33 public: | 33 public: |
| 34 ProfileListDesktopBrowserTest() {} | 34 ProfileListDesktopBrowserTest() {} |
| 35 | 35 |
| 36 scoped_ptr<AvatarMenu> CreateAvatarMenu(ProfileInfoCache* cache) { | 36 scoped_ptr<AvatarMenu> CreateAvatarMenu(ProfileInfoCache* cache) { |
| 37 return scoped_ptr<AvatarMenu>(new AvatarMenu(cache, NULL, browser())); | 37 return scoped_ptr<AvatarMenu>(new AvatarMenu(cache, NULL, browser())); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 false, ProfileMetrics::SWITCH_PROFILE_ICON); | 138 false, ProfileMetrics::SWITCH_PROFILE_ICON); |
| 139 EXPECT_EQ(2U, browser_list->size()); | 139 EXPECT_EQ(2U, browser_list->size()); |
| 140 | 140 |
| 141 // Switch to the first profile without opening a new window. | 141 // Switch to the first profile without opening a new window. |
| 142 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1), | 142 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1), |
| 143 false, ProfileMetrics::SWITCH_PROFILE_ICON); | 143 false, ProfileMetrics::SWITCH_PROFILE_ICON); |
| 144 EXPECT_EQ(2U, browser_list->size()); | 144 EXPECT_EQ(2U, browser_list->size()); |
| 145 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); | 145 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); |
| 146 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath()); | 146 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath()); |
| 147 } | 147 } |
| OLD | NEW |