| 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_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
| 10 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/sessions/session_restore.h" | 13 #include "chrome/browser/sessions/session_restore.h" |
| 14 #include "chrome/browser/sessions/session_service.h" | 14 #include "chrome/browser/sessions/session_service.h" |
| 15 #include "chrome/browser/sessions/session_service_factory.h" | 15 #include "chrome/browser/sessions/session_service_factory.h" |
| 16 #include "chrome/browser/sessions/session_service_test_helper.h" |
| 16 #include "chrome/browser/sessions/tab_restore_service.h" | 17 #include "chrome/browser/sessions/tab_restore_service.h" |
| 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 18 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
| 20 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 21 #include "chrome/browser/ui/browser_tabstrip.h" | 22 #include "chrome/browser/ui/browser_tabstrip.h" |
| 22 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 virtual void SetUpOnMainThread() OVERRIDE { | 46 virtual void SetUpOnMainThread() OVERRIDE { |
| 46 SessionStartupPref pref(SessionStartupPref::LAST); | 47 SessionStartupPref pref(SessionStartupPref::LAST); |
| 47 SessionStartupPref::SetStartupPref(browser()->profile(), pref); | 48 SessionStartupPref::SetStartupPref(browser()->profile(), pref); |
| 48 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | 49 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) |
| 49 const testing::TestInfo* const test_info = | 50 const testing::TestInfo* const test_info = |
| 50 testing::UnitTest::GetInstance()->current_test_info(); | 51 testing::UnitTest::GetInstance()->current_test_info(); |
| 51 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS")) { | 52 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS")) { |
| 52 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we | 53 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we |
| 53 // can get these test to work without quitting. | 54 // can get these test to work without quitting. |
| 54 SessionServiceFactory::GetForProfile(browser()->profile())-> | 55 SessionServiceTestHelper helper( |
| 55 force_browser_not_alive_with_no_windows_ = true; | 56 SessionServiceFactory::GetForProfile(browser()->profile())); |
| 57 helper.SetForceBrowserNotAliveWithNoWindows(true); |
| 58 helper.ReleaseService(); |
| 56 } | 59 } |
| 57 #endif | 60 #endif |
| 58 } | 61 } |
| 59 | 62 |
| 60 virtual bool SetUpUserDataDirectory() OVERRIDE { | 63 virtual bool SetUpUserDataDirectory() OVERRIDE { |
| 61 // Make sure the first run sentinel file exists before running these tests, | 64 // Make sure the first run sentinel file exists before running these tests, |
| 62 // since some of them customize the session startup pref whose value can | 65 // since some of them customize the session startup pref whose value can |
| 63 // be different than the default during the first run. | 66 // be different than the default during the first run. |
| 64 // TODO(bauerb): set the first run flag instead of creating a sentinel file. | 67 // TODO(bauerb): set the first run flag instead of creating a sentinel file. |
| 65 first_run::CreateSentinel(); | 68 first_run::CreateSentinel(); |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 ASSERT_EQ(1u, BrowserList::size()); | 783 ASSERT_EQ(1u, BrowserList::size()); |
| 781 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); | 784 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); |
| 782 const content::NavigationController& new_controller = | 785 const content::NavigationController& new_controller = |
| 783 chrome::GetActiveWebContents(new_browser)->GetController(); | 786 chrome::GetActiveWebContents(new_browser)->GetController(); |
| 784 ASSERT_TRUE(new_controller.GetSessionStorageNamespace()); | 787 ASSERT_TRUE(new_controller.GetSessionStorageNamespace()); |
| 785 std::string restored_session_storage_persistent_id = | 788 std::string restored_session_storage_persistent_id = |
| 786 new_controller.GetSessionStorageNamespace()->persistent_id(); | 789 new_controller.GetSessionStorageNamespace()->persistent_id(); |
| 787 EXPECT_EQ(session_storage_persistent_id, | 790 EXPECT_EQ(session_storage_persistent_id, |
| 788 restored_session_storage_persistent_id); | 791 restored_session_storage_persistent_id); |
| 789 } | 792 } |
| OLD | NEW |