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

Side by Side Diff: chrome/browser/ui/browser_command_controller_browsertest.cc

Issue 1637943003: Remove HostDesktopType from BrowserList::GetInstance() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen-wrapper-land
Patch Set: mac2 Created 4 years, 10 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_finder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ui/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 delegate->Cancel(); 73 delegate->Cancel();
74 content::RunAllPendingInMessageLoop(); 74 content::RunAllPendingInMessageLoop();
75 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND)); 75 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
76 } 76 }
77 77
78 // Note that a Browser's destructor, when the browser's profile is guest, will 78 // Note that a Browser's destructor, when the browser's profile is guest, will
79 // create and execute a BrowsingDataRemover. 79 // create and execute a BrowsingDataRemover.
80 // Flakes http://crbug.com/471953 80 // Flakes http://crbug.com/471953
81 IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest, 81 IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest,
82 DISABLED_NewAvatarMenuEnabledInGuestMode) { 82 DISABLED_NewAvatarMenuEnabledInGuestMode) {
83 EXPECT_EQ(1U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size()); 83 EXPECT_EQ(1U, BrowserList::GetInstance()->size());
84 84
85 // Create a guest browser nicely. Using CreateProfile() and CreateBrowser() 85 // Create a guest browser nicely. Using CreateProfile() and CreateBrowser()
86 // does incomplete initialization that would lead to 86 // does incomplete initialization that would lead to
87 // SystemUrlRequestContextGetter being leaked. 87 // SystemUrlRequestContextGetter being leaked.
88 content::WindowedNotificationObserver browser_creation_observer( 88 content::WindowedNotificationObserver browser_creation_observer(
89 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 89 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
90 content::NotificationService::AllSources()); 90 content::NotificationService::AllSources());
91 profiles::SwitchToGuestProfile(chrome::GetActiveDesktop(), 91 profiles::SwitchToGuestProfile(chrome::GetActiveDesktop(),
92 ProfileManager::CreateCallback()); 92 ProfileManager::CreateCallback());
93 93
94 // RunUntilIdle() (racily) isn't sufficient to ensure browser creation, so 94 // RunUntilIdle() (racily) isn't sufficient to ensure browser creation, so
95 // listen for the notification. 95 // listen for the notification.
96 base::MessageLoop::current()->RunUntilIdle(); 96 base::MessageLoop::current()->RunUntilIdle();
97 browser_creation_observer.Wait(); 97 browser_creation_observer.Wait();
98 EXPECT_EQ(2U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size()); 98 EXPECT_EQ(2U, BrowserList::GetInstance()->size());
99 99
100 // Access the browser that was created for the new Guest Profile. 100 // Access the browser that was created for the new Guest Profile.
101 Profile* guest = g_browser_process->profile_manager()->GetProfileByPath( 101 Profile* guest = g_browser_process->profile_manager()->GetProfileByPath(
102 ProfileManager::GetGuestProfilePath()); 102 ProfileManager::GetGuestProfilePath());
103 Browser* browser = chrome::FindAnyBrowser( 103 Browser* browser = chrome::FindAnyBrowser(
104 guest, true, chrome::GetActiveDesktop()); 104 guest, true, chrome::GetActiveDesktop());
105 EXPECT_TRUE(browser); 105 EXPECT_TRUE(browser);
106 106
107 // The BrowsingDataRemover needs a loaded TemplateUrlService or else it hangs 107 // The BrowsingDataRemover needs a loaded TemplateUrlService or else it hangs
108 // on to a CallbackList::Subscription forever. 108 // on to a CallbackList::Subscription forever.
109 TemplateURLServiceFactory::GetForProfile(guest)->set_loaded(true); 109 TemplateURLServiceFactory::GetForProfile(guest)->set_loaded(true);
110 110
111 const CommandUpdater* command_updater = 111 const CommandUpdater* command_updater =
112 browser->command_controller()->command_updater(); 112 browser->command_controller()->command_updater();
113 #if defined(OS_CHROMEOS) 113 #if defined(OS_CHROMEOS)
114 // Chrome OS uses system tray menu to handle multi-profiles. 114 // Chrome OS uses system tray menu to handle multi-profiles.
115 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 115 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
116 #else 116 #else
117 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 117 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
118 #endif 118 #endif
119 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698