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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 AutoreleasePool()->Recycle(); | 309 AutoreleasePool()->Recycle(); |
310 #endif | 310 #endif |
311 observer.Wait(); | 311 observer.Wait(); |
312 } | 312 } |
313 | 313 |
314 virtual Browser* QuitBrowserAndRestore(Browser* browser, | 314 virtual Browser* QuitBrowserAndRestore(Browser* browser, |
315 bool close_all_windows) { | 315 bool close_all_windows) { |
316 Profile* profile = browser->profile(); | 316 Profile* profile = browser->profile(); |
317 | 317 |
318 // Close the browser. | 318 // Close the browser. |
319 chrome::StartKeepAlive(); | 319 chrome::IncrementKeepAliveCount(); |
320 CloseBrowserSynchronously(browser, close_all_windows); | 320 CloseBrowserSynchronously(browser, close_all_windows); |
321 | 321 |
322 SessionServiceTestHelper helper; | 322 SessionServiceTestHelper helper; |
323 helper.SetService( | 323 helper.SetService( |
324 SessionServiceFactory::GetForProfileForSessionRestore(profile)); | 324 SessionServiceFactory::GetForProfileForSessionRestore(profile)); |
325 helper.SetForceBrowserNotAliveWithNoWindows(true); | 325 helper.SetForceBrowserNotAliveWithNoWindows(true); |
326 helper.ReleaseService(); | 326 helper.ReleaseService(); |
327 | 327 |
328 // Create a new window, which should trigger session restore. | 328 // Create a new window, which should trigger session restore. |
329 ui_test_utils::BrowserAddedObserver window_observer; | 329 ui_test_utils::BrowserAddedObserver window_observer; |
330 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 330 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
331 Browser* new_browser = window_observer.WaitForSingleNewBrowser(); | 331 Browser* new_browser = window_observer.WaitForSingleNewBrowser(); |
332 chrome::EndKeepAlive(); | 332 chrome::DecrementKeepAliveCount(); |
333 | 333 |
334 return new_browser; | 334 return new_browser; |
335 } | 335 } |
336 | 336 |
337 std::string fake_server_address() { | 337 std::string fake_server_address() { |
338 return fake_server_address_; | 338 return fake_server_address_; |
339 } | 339 } |
340 | 340 |
341 std::string test_path() { | 341 std::string test_path() { |
342 return test_path_; | 342 return test_path_; |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 CookieSettings::Factory::GetForProfile(new_browser->profile())-> | 841 CookieSettings::Factory::GetForProfile(new_browser->profile())-> |
842 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 842 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
843 // ... even if background mode is active. | 843 // ... even if background mode is active. |
844 EnableBackgroundMode(); | 844 EnableBackgroundMode(); |
845 new_browser = QuitBrowserAndRestore(new_browser, true); | 845 new_browser = QuitBrowserAndRestore(new_browser, true); |
846 StoreDataWithPage(new_browser, "cookies.html"); | 846 StoreDataWithPage(new_browser, "cookies.html"); |
847 DisableBackgroundMode(); | 847 DisableBackgroundMode(); |
848 new_browser = QuitBrowserAndRestore(new_browser, true); | 848 new_browser = QuitBrowserAndRestore(new_browser, true); |
849 StoreDataWithPage(new_browser, "cookies.html"); | 849 StoreDataWithPage(new_browser, "cookies.html"); |
850 } | 850 } |
OLD | NEW |