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

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

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « chrome/browser/session_startup_pref.h ('k') | chrome/browser/spellchecker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/session_startup_pref.h ('k') | chrome/browser/spellchecker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698