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

Side by Side Diff: chrome/browser/app_controller_mac_browsertest.mm

Issue 631163004: Mac - show user manager before opening browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark's post-test comments Created 6 years, 1 month 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/app_controller_mac.mm ('k') | chrome/browser/profiles/profile_window.h » ('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 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 #import <Cocoa/Cocoa.h> 6 #import <Cocoa/Cocoa.h>
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #import <Foundation/NSAppleEventDescriptor.h> 8 #import <Foundation/NSAppleEventDescriptor.h>
9 #import <objc/message.h> 9 #import <objc/message.h>
10 #import <objc/runtime.h> 10 #import <objc/runtime.h>
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; 271 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO];
272 EXPECT_FALSE(result); 272 EXPECT_FALSE(result);
273 273
274 base::RunLoop().RunUntilIdle(); 274 base::RunLoop().RunUntilIdle();
275 275
276 EXPECT_EQ(1u, active_browser_list_->size()); 276 EXPECT_EQ(1u, active_browser_list_->size());
277 EXPECT_TRUE(UserManager::IsShowing()); 277 EXPECT_TRUE(UserManager::IsShowing());
278 UserManager::Hide(); 278 UserManager::Hide();
279 } 279 }
280 280
281
noms (inactive) 2014/10/30 17:45:11 nit: is there an extra \n here?
Mike Lerman 2014/10/30 18:06:01 Done.
282 IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest,
283 AboutChromeForcesUserManager) {
284 base::scoped_nsobject<AppController> ac([[AppController alloc] init]);
285
286 // Create the guest profile, and set it as the last used profile so the
287 // app controller can use it on init.
288 CreateAndWaitForGuestProfile();
289 PrefService* local_state = g_browser_process->local_state();
290 local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir);
291
292 // Prohibiting guest mode forces the user manager flow for About Chrome.
293 local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, false);
294
295 Profile* guest_profile = [ac lastProfile];
296 EXPECT_EQ(ProfileManager::GetGuestProfilePath(), guest_profile->GetPath());
297 EXPECT_TRUE(guest_profile->IsGuestSession());
298
299 // Tell the browser to open About Chrome
noms (inactive) 2014/10/30 17:45:11 nit: comment should end in a .
Mike Lerman 2014/10/30 18:06:01 Done.
300 EXPECT_EQ(1u, active_browser_list_->size());
301 [ac orderFrontStandardAboutPanel:NSApp];
302
303 base::RunLoop().RunUntilIdle();
304
305 // No new browser is opened; the User Manager opens instead.
306 EXPECT_EQ(1u, active_browser_list_->size());
307 EXPECT_TRUE(UserManager::IsShowing());
noms (inactive) 2014/10/30 17:45:11 I think you have to explicitly call UserManager::H
Mike Lerman 2014/10/30 18:06:01 Done.
308 }
309
281 class AppControllerOpenShortcutBrowserTest : public InProcessBrowserTest { 310 class AppControllerOpenShortcutBrowserTest : public InProcessBrowserTest {
282 protected: 311 protected:
283 AppControllerOpenShortcutBrowserTest() { 312 AppControllerOpenShortcutBrowserTest() {
284 } 313 }
285 314
286 void SetUpInProcessBrowserTestFixture() override { 315 void SetUpInProcessBrowserTestFixture() override {
287 // In order to mimic opening shortcut during browser startup, we need to 316 // In order to mimic opening shortcut during browser startup, we need to
288 // send the event before -applicationDidFinishLaunching is called, but 317 // send the event before -applicationDidFinishLaunching is called, but
289 // after AppController is loaded. 318 // after AppController is loaded.
290 // 319 //
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 }; 352 };
324 353
325 IN_PROC_BROWSER_TEST_F(AppControllerOpenShortcutBrowserTest, 354 IN_PROC_BROWSER_TEST_F(AppControllerOpenShortcutBrowserTest,
326 OpenShortcutOnStartup) { 355 OpenShortcutOnStartup) {
327 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 356 EXPECT_EQ(1, browser()->tab_strip_model()->count());
328 EXPECT_EQ(g_open_shortcut_url, 357 EXPECT_EQ(g_open_shortcut_url,
329 browser()->tab_strip_model()->GetActiveWebContents() 358 browser()->tab_strip_model()->GetActiveWebContents()
330 ->GetLastCommittedURL()); 359 ->GetLastCommittedURL());
331 } 360 }
332 361
362
noms (inactive) 2014/10/30 17:45:11 nit: i think there's an extra \n?
Mike Lerman 2014/10/30 18:06:01 Done.
333 } // namespace 363 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/profiles/profile_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698