| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/common/page_transition_types.h" | 36 #include "content/public/common/page_transition_types.h" |
| 37 #include "content/public/test/test_navigation_observer.h" | 37 #include "content/public/test/test_navigation_observer.h" |
| 38 | 38 |
| 39 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) |
| 40 #include "base/mac/scoped_nsautorelease_pool.h" | 40 #include "base/mac/scoped_nsautorelease_pool.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 class SessionRestoreTest : public InProcessBrowserTest { | 43 class SessionRestoreTest : public InProcessBrowserTest { |
| 44 protected: | 44 protected: |
| 45 #if defined(OS_CHROMEOS) |
| 46 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 47 // TODO(nkostylev): Investigate if we can remove this switch. |
| 48 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); |
| 49 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 50 } |
| 51 #endif |
| 45 | 52 |
| 46 virtual void SetUpOnMainThread() OVERRIDE { | 53 virtual void SetUpOnMainThread() OVERRIDE { |
| 47 SessionStartupPref pref(SessionStartupPref::LAST); | 54 SessionStartupPref pref(SessionStartupPref::LAST); |
| 48 SessionStartupPref::SetStartupPref(browser()->profile(), pref); | 55 SessionStartupPref::SetStartupPref(browser()->profile(), pref); |
| 49 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | 56 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) |
| 50 const testing::TestInfo* const test_info = | 57 const testing::TestInfo* const test_info = |
| 51 testing::UnitTest::GetInstance()->current_test_info(); | 58 testing::UnitTest::GetInstance()->current_test_info(); |
| 52 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS")) { | 59 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS")) { |
| 53 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we | 60 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we |
| 54 // can get these test to work without quitting. | 61 // can get these test to work without quitting. |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 ASSERT_EQ(1u, BrowserList::size()); | 842 ASSERT_EQ(1u, BrowserList::size()); |
| 836 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); | 843 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); |
| 837 content::NavigationController* new_controller = | 844 content::NavigationController* new_controller = |
| 838 &chrome::GetActiveWebContents(new_browser)->GetController(); | 845 &chrome::GetActiveWebContents(new_browser)->GetController(); |
| 839 ASSERT_TRUE(new_controller->GetDefaultSessionStorageNamespace()); | 846 ASSERT_TRUE(new_controller->GetDefaultSessionStorageNamespace()); |
| 840 std::string restored_session_storage_persistent_id = | 847 std::string restored_session_storage_persistent_id = |
| 841 new_controller->GetDefaultSessionStorageNamespace()->persistent_id(); | 848 new_controller->GetDefaultSessionStorageNamespace()->persistent_id(); |
| 842 EXPECT_EQ(session_storage_persistent_id, | 849 EXPECT_EQ(session_storage_persistent_id, |
| 843 restored_session_storage_persistent_id); | 850 restored_session_storage_persistent_id); |
| 844 } | 851 } |
| OLD | NEW |