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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 819 |
820 // The pinned tab is the selected tab. | 820 // The pinned tab is the selected tab. |
821 ASSERT_EQ(2, new_browser->tab_count()); | 821 ASSERT_EQ(2, new_browser->tab_count()); |
822 EXPECT_EQ(0, new_browser->active_index()); | 822 EXPECT_EQ(0, new_browser->active_index()); |
823 EXPECT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); | 823 EXPECT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); |
824 EXPECT_EQ(url2_, chrome::GetWebContentsAt(new_browser, 1)->GetURL()); | 824 EXPECT_EQ(url2_, chrome::GetWebContentsAt(new_browser, 1)->GetURL()); |
825 } | 825 } |
826 | 826 |
827 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorage) { | 827 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorage) { |
828 ui_test_utils::NavigateToURL(browser(), url1_); | 828 ui_test_utils::NavigateToURL(browser(), url1_); |
829 content::NavigationController* controller = | 829 const content::NavigationController& controller = |
830 &chrome::GetActiveWebContents(browser())->GetController(); | 830 chrome::GetActiveWebContents(browser())->GetController(); |
831 ASSERT_TRUE(controller->GetDefaultSessionStorageNamespace()); | 831 const content::SessionStorageNamespaceMap& session_storage_namspace_map = |
832 std::string session_storage_persistent_id = | 832 controller.GetSessionStorageNamespaceMap(); |
833 controller->GetDefaultSessionStorageNamespace()->persistent_id(); | 833 ASSERT_TRUE(!session_storage_namspace_map.empty()); |
| 834 std::map<std::string, std::string> expected_persistent_ids; |
| 835 for (content::SessionStorageNamespaceMap::const_iterator it = |
| 836 session_storage_namspace_map.begin(); |
| 837 it != session_storage_namspace_map.end(); |
| 838 ++it) { |
| 839 expected_persistent_ids[it->first] = it->second->persistent_id(); |
| 840 } |
834 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 841 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
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 |
838 &chrome::GetActiveWebContents(new_browser)->GetController(); | 845 const content::NavigationController& new_controller = |
839 ASSERT_TRUE(new_controller->GetDefaultSessionStorageNamespace()); | 846 chrome::GetActiveWebContents(new_browser)->GetController(); |
840 std::string restored_session_storage_persistent_id = | 847 |
841 new_controller->GetDefaultSessionStorageNamespace()->persistent_id(); | 848 const content::SessionStorageNamespaceMap& restored_storage_namespace_map = |
842 EXPECT_EQ(session_storage_persistent_id, | 849 new_controller.GetSessionStorageNamespaceMap(); |
843 restored_session_storage_persistent_id); | 850 ASSERT_TRUE(!restored_storage_namespace_map.empty()); |
| 851 for (content::SessionStorageNamespaceMap::const_iterator it = |
| 852 restored_storage_namespace_map.begin(); |
| 853 it != restored_storage_namespace_map.end(); |
| 854 ++it) { |
| 855 EXPECT_EQ(expected_persistent_ids[it->first], it->second->persistent_id()) |
| 856 << " for storage partition --" << it->first << "--"; |
| 857 } |
844 } | 858 } |
OLD | NEW |