OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |