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 "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/profiles/avatar_menu.h" | 8 #include "chrome/browser/profiles/avatar_menu.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/profiles/profile_window.h" | |
11 #include "chrome/browser/profiles/profiles_state.h" | 10 #include "chrome/browser/profiles/profiles_state.h" |
12 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
14 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/test_switches.h" | 15 #include "chrome/test/base/test_switches.h" |
17 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" |
18 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
19 | 18 |
20 namespace { | 19 namespace { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 menu->RebuildMenu(); | 60 menu->RebuildMenu(); |
62 | 61 |
63 BrowserList* browser_list = | 62 BrowserList* browser_list = |
64 BrowserList::GetInstance(chrome::GetActiveDesktop()); | 63 BrowserList::GetInstance(chrome::GetActiveDesktop()); |
65 EXPECT_EQ(1U, browser_list->size()); | 64 EXPECT_EQ(1U, browser_list->size()); |
66 content::WindowedNotificationObserver window_close_observer( | 65 content::WindowedNotificationObserver window_close_observer( |
67 chrome::NOTIFICATION_BROWSER_CLOSED, | 66 chrome::NOTIFICATION_BROWSER_CLOSED, |
68 content::Source<Browser>(browser())); | 67 content::Source<Browser>(browser())); |
69 | 68 |
70 EXPECT_FALSE(cache.ProfileIsSigninRequiredAtIndex(index)); | 69 EXPECT_FALSE(cache.ProfileIsSigninRequiredAtIndex(index)); |
71 profiles::LockProfile(current_profile); | 70 menu->SetLogoutURL("about:blank"); |
| 71 menu->BeginSignOut(); |
72 EXPECT_TRUE(cache.ProfileIsSigninRequiredAtIndex(index)); | 72 EXPECT_TRUE(cache.ProfileIsSigninRequiredAtIndex(index)); |
73 | 73 |
74 window_close_observer.Wait(); // rely on test time-out for failure indication | 74 window_close_observer.Wait(); // rely on test time-out for failure indication |
75 EXPECT_EQ(0U, browser_list->size()); | 75 EXPECT_EQ(0U, browser_list->size()); |
76 } | 76 } |
77 | 77 |
78 IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, SwitchToProfile) { | 78 IN_PROC_BROWSER_TEST_F(ProfileListDesktopBrowserTest, SwitchToProfile) { |
79 #if defined(OS_WIN) && defined(USE_ASH) | 79 #if defined(OS_WIN) && defined(USE_ASH) |
80 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 80 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
81 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 81 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Open a browser window for the second profile. | 118 // Open a browser window for the second profile. |
119 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile2), false); | 119 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile2), false); |
120 EXPECT_EQ(2U, browser_list->size()); | 120 EXPECT_EQ(2U, browser_list->size()); |
121 | 121 |
122 // Switch to the first profile without opening a new window. | 122 // Switch to the first profile without opening a new window. |
123 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1), false); | 123 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1), false); |
124 EXPECT_EQ(2U, browser_list->size()); | 124 EXPECT_EQ(2U, browser_list->size()); |
125 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); | 125 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); |
126 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath()); | 126 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath()); |
127 } | 127 } |
OLD | NEW |