| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 EXPECT_EQ(1u, active_browser_list_->size()); | 272 EXPECT_EQ(1u, active_browser_list_->size()); |
| 273 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; | 273 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; |
| 274 EXPECT_FALSE(result); | 274 EXPECT_FALSE(result); |
| 275 | 275 |
| 276 base::RunLoop().RunUntilIdle(); | 276 base::RunLoop().RunUntilIdle(); |
| 277 EXPECT_EQ(1u, active_browser_list_->size()); | 277 EXPECT_EQ(1u, active_browser_list_->size()); |
| 278 EXPECT_TRUE(UserManager::IsShowing()); | 278 EXPECT_TRUE(UserManager::IsShowing()); |
| 279 UserManager::Hide(); | 279 UserManager::Hide(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 #if defined(ADDRESS_SANITIZER) |
| 283 // Flaky under ASAN. See https://crbug.com/674475. |
| 284 #define MAYBE_GuestProfileReopenWithNoWindows DISABLED_GuestProfileReopenWithNoW
indows |
| 285 #else |
| 286 #define MAYBE_GuestProfileReopenWithNoWindows GuestProfileReopenWithNoWindows |
| 287 #endif |
| 282 // Test that for a guest last profile, a reopen event opens the User Manager. | 288 // Test that for a guest last profile, a reopen event opens the User Manager. |
| 283 IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, | 289 IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, |
| 284 GuestProfileReopenWithNoWindows) { | 290 MAYBE_GuestProfileReopenWithNoWindows) { |
| 285 // Create the system profile. Set the guest as the last used profile so the | 291 // Create the system profile. Set the guest as the last used profile so the |
| 286 // app controller can use it on init. | 292 // app controller can use it on init. |
| 287 CreateAndWaitForSystemProfile(); | 293 CreateAndWaitForSystemProfile(); |
| 288 PrefService* local_state = g_browser_process->local_state(); | 294 PrefService* local_state = g_browser_process->local_state(); |
| 289 local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir); | 295 local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir); |
| 290 | 296 |
| 291 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); | 297 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); |
| 292 | 298 |
| 293 Profile* profile = [ac lastProfile]; | 299 Profile* profile = [ac lastProfile]; |
| 294 EXPECT_EQ(ProfileManager::GetGuestProfilePath(), profile->GetPath()); | 300 EXPECT_EQ(ProfileManager::GetGuestProfilePath(), profile->GetPath()); |
| 295 EXPECT_TRUE(profile->IsGuestSession()); | 301 EXPECT_TRUE(profile->IsGuestSession()); |
| 296 | 302 |
| 297 EXPECT_EQ(1u, active_browser_list_->size()); | 303 EXPECT_EQ(1u, active_browser_list_->size()); |
| 298 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; | 304 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; |
| 299 EXPECT_FALSE(result); | 305 EXPECT_FALSE(result); |
| 300 | 306 |
| 301 base::RunLoop().RunUntilIdle(); | 307 base::RunLoop().RunUntilIdle(); |
| 302 | 308 |
| 303 EXPECT_EQ(1u, active_browser_list_->size()); | 309 EXPECT_EQ(1u, active_browser_list_->size()); |
| 304 EXPECT_TRUE(UserManager::IsShowing()); | 310 EXPECT_TRUE(UserManager::IsShowing()); |
| 305 UserManager::Hide(); | 311 UserManager::Hide(); |
| 306 } | 312 } |
| 307 | 313 |
| 314 #if defined(ADDRESS_SANITIZER) |
| 315 // Flaky under ASAN. See https://crbug.com/674475. |
| 316 #define MAYBE_AboutChromeForcesUserManager DISABLED_AboutChromeForcesUserManager |
| 317 #else |
| 318 #define MAYBE_AboutChromeForcesUserManager AboutChromeForcesUserManager |
| 319 #endif |
| 308 IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, | 320 IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, |
| 309 AboutChromeForcesUserManager) { | 321 MAYBE_AboutChromeForcesUserManager) { |
| 310 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); | 322 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); |
| 311 | 323 |
| 312 // Create the guest profile, and set it as the last used profile so the | 324 // Create the guest profile, and set it as the last used profile so the |
| 313 // app controller can use it on init. | 325 // app controller can use it on init. |
| 314 CreateAndWaitForSystemProfile(); | 326 CreateAndWaitForSystemProfile(); |
| 315 PrefService* local_state = g_browser_process->local_state(); | 327 PrefService* local_state = g_browser_process->local_state(); |
| 316 local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir); | 328 local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir); |
| 317 | 329 |
| 318 // Prohibiting guest mode forces the user manager flow for About Chrome. | 330 // Prohibiting guest mode forces the user manager flow for About Chrome. |
| 319 local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, false); | 331 local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, false); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 ui_test_utils::NavigateToURL(browser3, test_url1); | 701 ui_test_utils::NavigateToURL(browser3, test_url1); |
| 690 EXPECT_EQ(g_handoff_url, GURL()); | 702 EXPECT_EQ(g_handoff_url, GURL()); |
| 691 | 703 |
| 692 // Activate the original browser window. | 704 // Activate the original browser window. |
| 693 Browser* browser1 = active_browser_list->get(0); | 705 Browser* browser1 = active_browser_list->get(0); |
| 694 browser1->window()->Show(); | 706 browser1->window()->Show(); |
| 695 EXPECT_EQ(g_handoff_url, test_url2); | 707 EXPECT_EQ(g_handoff_url, test_url2); |
| 696 } | 708 } |
| 697 | 709 |
| 698 } // namespace | 710 } // namespace |
| OLD | NEW |