summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-04 15:03:35 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-04 15:03:35 +0000
commit34844e925694d81c381723e766be7db6aa47a54b (patch)
tree14fac4c4b0421f9c5871878ac44ea6cba46f2722 /chrome/browser
parent9886be521bba9840bc620e67ba5c77bc9031066b (diff)
downloadchromium_src-34844e925694d81c381723e766be7db6aa47a54b.zip
chromium_src-34844e925694d81c381723e766be7db6aa47a54b.tar.gz
chromium_src-34844e925694d81c381723e766be7db6aa47a54b.tar.bz2
Test case for session service migration change.
BUG=chromium-os:27610 TEST=none R=marja@chromium.org Review URL: https://chromiumcodereview.appspot.com/9965125 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sessions/session_service.cc2
-rw-r--r--chrome/browser/sessions/session_service_unittest.cc28
2 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 3b80cba..317c31d 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -171,7 +171,7 @@ bool MigrateClosedPayload(const SessionCommand& command,
#if defined(OS_CHROMEOS)
// Pre M17 versions of chromeos were 32bit. Post M17 is 64 bit. Apparently the
// 32 bit versions of chrome on pre M17 resulted in a sizeof 12 for the
- // ClosedPayload, where as post M17 64-bit gives a sizeof 16 (presumaly the
+ // ClosedPayload, where as post M17 64-bit gives a sizeof 16 (presumably the
// struct is padded).
if ((command.id() == kCommandWindowClosedObsolete ||
command.id() == kCommandTabClosedObsolete) &&
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index 43a4dbc..fcf72f3 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -853,3 +853,31 @@ TEST_F(SessionServiceTest, RemovePostDataWithPasswords) {
// navigation with passwords.
EXPECT_NE(content_state, windows[0]->tabs[0]->navigations[0].state());
}
+
+// This test is only applicable to chromeos.
+#if defined(OS_CHROMEOS)
+// Verifies migration of tab/window closed works.
+TEST_F(SessionServiceTest, CanOpenV1TabClosed) {
+ FilePath v1_file_path;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &v1_file_path));
+ // v1_session_file contains a tab closed command with the original id. The
+ // file was generated from ClosingTabStaysClosed. If we successfully processed
+ // the file we'll have one tab.
+ v1_file_path =
+ v1_file_path.AppendASCII("sessions").AppendASCII("v1_session_file");
+ FilePath dest_file_path(path_);
+ dest_file_path = dest_file_path.AppendASCII("Current Session");
+
+ // Forces closing the file.
+ helper_.set_service(NULL);
+
+ ASSERT_TRUE(file_util::CopyFile(v1_file_path, dest_file_path));
+
+ SessionService* session_service = new SessionService(path_);
+ helper_.set_service(session_service);
+ ScopedVector<SessionWindow> windows;
+ helper_.ReadWindows(&(windows.get()));
+ ASSERT_EQ(1u, windows.size());
+ EXPECT_EQ(1u, windows[0]->tabs.size());
+}
+#endif