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

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: noms nits 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 IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest,
282 AboutChromeForcesUserManager) {
283 base::scoped_nsobject<AppController> ac([[AppController alloc] init]);
284
285 // Create the guest profile, and set it as the last used profile so the
286 // app controller can use it on init.
287 CreateAndWaitForGuestProfile();
288 PrefService* local_state = g_browser_process->local_state();
289 local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir);
290
291 // Prohibiting guest mode forces the user manager flow for About Chrome.
292 local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, false);
293
294 Profile* guest_profile = [ac lastProfile];
295 EXPECT_EQ(ProfileManager::GetGuestProfilePath(), guest_profile->GetPath());
296 EXPECT_TRUE(guest_profile->IsGuestSession());
297
298 // Tell the browser to open About Chrome.
299 EXPECT_EQ(1u, active_browser_list_->size());
300 [ac orderFrontStandardAboutPanel:NSApp];
301
302 base::RunLoop().RunUntilIdle();
303
304 // No new browser is opened; the User Manager opens instead.
305 EXPECT_EQ(1u, active_browser_list_->size());
306 EXPECT_TRUE(UserManager::IsShowing());
307
308 UserManager::Hide();
309 }
310
281 class AppControllerOpenShortcutBrowserTest : public InProcessBrowserTest { 311 class AppControllerOpenShortcutBrowserTest : public InProcessBrowserTest {
282 protected: 312 protected:
283 AppControllerOpenShortcutBrowserTest() { 313 AppControllerOpenShortcutBrowserTest() {
284 } 314 }
285 315
286 void SetUpInProcessBrowserTestFixture() override { 316 void SetUpInProcessBrowserTestFixture() override {
287 // In order to mimic opening shortcut during browser startup, we need to 317 // In order to mimic opening shortcut during browser startup, we need to
288 // send the event before -applicationDidFinishLaunching is called, but 318 // send the event before -applicationDidFinishLaunching is called, but
289 // after AppController is loaded. 319 // after AppController is loaded.
290 // 320 //
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 354
325 IN_PROC_BROWSER_TEST_F(AppControllerOpenShortcutBrowserTest, 355 IN_PROC_BROWSER_TEST_F(AppControllerOpenShortcutBrowserTest,
326 OpenShortcutOnStartup) { 356 OpenShortcutOnStartup) {
327 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 357 EXPECT_EQ(1, browser()->tab_strip_model()->count());
328 EXPECT_EQ(g_open_shortcut_url, 358 EXPECT_EQ(g_open_shortcut_url,
329 browser()->tab_strip_model()->GetActiveWebContents() 359 browser()->tab_strip_model()->GetActiveWebContents()
330 ->GetLastCommittedURL()); 360 ->GetLastCommittedURL());
331 } 361 }
332 362
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