Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 10850010: Make session restore understand that tabs have multiple SessionStorageNamespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, with test robustified. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 ASSERT_EQ(2, new_browser->tab_count()); 766 ASSERT_EQ(2, new_browser->tab_count());
767 EXPECT_EQ(0, new_browser->active_index()); 767 EXPECT_EQ(0, new_browser->active_index());
768 EXPECT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); 768 EXPECT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL());
769 EXPECT_EQ(url2_, chrome::GetWebContentsAt(new_browser, 1)->GetURL()); 769 EXPECT_EQ(url2_, chrome::GetWebContentsAt(new_browser, 1)->GetURL());
770 } 770 }
771 771
772 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorage) { 772 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorage) {
773 ui_test_utils::NavigateToURL(browser(), url1_); 773 ui_test_utils::NavigateToURL(browser(), url1_);
774 const content::NavigationController& controller = 774 const content::NavigationController& controller =
775 chrome::GetActiveWebContents(browser())->GetController(); 775 chrome::GetActiveWebContents(browser())->GetController();
776 ASSERT_TRUE(controller.GetSessionStorageNamespaceMap().find("")->second); 776 const content::SessionStorageNamespaceMap& session_storage_namspace_map =
777 std::string session_storage_persistent_id = 777 controller.GetSessionStorageNamespaceMap();
778 controller.GetSessionStorageNamespaceMap().find("") 778 ASSERT_TRUE(!session_storage_namspace_map.empty());
779 ->second->persistent_id(); 779 std::map<std::string, std::string> expected_persistent_ids;
780 for (content::SessionStorageNamespaceMap::const_iterator it =
781 session_storage_namspace_map.begin();
782 it != session_storage_namspace_map.end();
783 ++it) {
784 expected_persistent_ids[it->first] = it->second->persistent_id();
785 }
786
780 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 787 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
781 ASSERT_EQ(1u, BrowserList::size()); 788 ASSERT_EQ(1u, BrowserList::size());
782 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); 789 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL());
790
783 const content::NavigationController& new_controller = 791 const content::NavigationController& new_controller =
784 chrome::GetActiveWebContents(new_browser)->GetController(); 792 chrome::GetActiveWebContents(new_browser)->GetController();
785 ASSERT_TRUE(new_controller.GetSessionStorageNamespaceMap().find("")->second); 793
786 std::string restored_session_storage_persistent_id = 794 const content::SessionStorageNamespaceMap& restored_storage_namespace_map =
787 new_controller.GetSessionStorageNamespaceMap().find("") 795 new_controller.GetSessionStorageNamespaceMap();
788 ->second->persistent_id(); 796 ASSERT_TRUE(!restored_storage_namespace_map.empty());
789 EXPECT_EQ(session_storage_persistent_id, 797 for (content::SessionStorageNamespaceMap::const_iterator it =
790 restored_session_storage_persistent_id); 798 restored_storage_namespace_map.begin();
799 it != restored_storage_namespace_map.end();
800 ++it) {
801 EXPECT_EQ(expected_persistent_ids[it->first], it->second->persistent_id())
802 << " for storage partition --" << it->first << "--";
803 }
791 } 804 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698