| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/sessions/session_backend.h" | 10 #include "chrome/browser/sessions/session_backend.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 TEST_F(SessionBackendTest, BigData) { | 129 TEST_F(SessionBackendTest, BigData) { |
| 130 struct TestData data[] = { | 130 struct TestData data[] = { |
| 131 { 1, "a" }, | 131 { 1, "a" }, |
| 132 { 2, "ab" }, | 132 { 2, "ab" }, |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 scoped_refptr<SessionBackend> backend( | 135 scoped_refptr<SessionBackend> backend( |
| 136 new SessionBackend(BaseSessionService::SESSION_RESTORE, path_)); | 136 new SessionBackend(BaseSessionService::SESSION_RESTORE, path_)); |
| 137 std::vector<SessionCommand*> commands; | 137 std::vector<SessionCommand*> commands; |
| 138 commands.push_back(CreateCommandFromData(data[0])); | 138 commands.push_back(CreateCommandFromData(data[0])); |
| 139 const SessionCommand::size_type big_size = SessionBackend::kFileReadBufferSize
+ 100; | 139 const SessionCommand::size_type big_size = |
| 140 SessionBackend::kFileReadBufferSize + 100; |
| 140 const SessionCommand::id_type big_id = 50; | 141 const SessionCommand::id_type big_id = 50; |
| 141 SessionCommand* big_command = new SessionCommand(big_id, big_size); | 142 SessionCommand* big_command = new SessionCommand(big_id, big_size); |
| 142 reinterpret_cast<char*>(big_command->contents())[0] = 'a'; | 143 reinterpret_cast<char*>(big_command->contents())[0] = 'a'; |
| 143 reinterpret_cast<char*>(big_command->contents())[big_size - 1] = 'z'; | 144 reinterpret_cast<char*>(big_command->contents())[big_size - 1] = 'z'; |
| 144 commands.push_back(big_command); | 145 commands.push_back(big_command); |
| 145 commands.push_back(CreateCommandFromData(data[1])); | 146 commands.push_back(CreateCommandFromData(data[1])); |
| 146 backend->AppendCommands(new SessionCommands(commands), false); | 147 backend->AppendCommands(new SessionCommands(commands), false); |
| 147 commands.clear(); | 148 commands.clear(); |
| 148 | 149 |
| 149 backend = NULL; | 150 backend = NULL; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 172 empty_commands->push_back(CreateCommandFromData(empty_command)); | 173 empty_commands->push_back(CreateCommandFromData(empty_command)); |
| 173 backend->AppendCommands(empty_commands, true); | 174 backend->AppendCommands(empty_commands, true); |
| 174 backend->MoveCurrentSessionToLastSession(); | 175 backend->MoveCurrentSessionToLastSession(); |
| 175 | 176 |
| 176 std::vector<SessionCommand*> commands; | 177 std::vector<SessionCommand*> commands; |
| 177 backend->ReadLastSessionCommandsImpl(&commands); | 178 backend->ReadLastSessionCommandsImpl(&commands); |
| 178 ASSERT_EQ(1, commands.size()); | 179 ASSERT_EQ(1, commands.size()); |
| 179 AssertCommandEqualsData(empty_command, commands[0]); | 180 AssertCommandEqualsData(empty_command, commands[0]); |
| 180 STLDeleteElements(&commands); | 181 STLDeleteElements(&commands); |
| 181 } | 182 } |
| OLD | NEW |