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

Side by Side Diff: content/browser/indexed_db/leveldb/leveldb_unittest.cc

Issue 19117005: IndexedDB: Coding conventions and cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <algorithm> 5 #include <algorithm>
6 #include <cstring> 6 #include <cstring>
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 scoped_ptr<LevelDBDatabase> leveldb = 94 scoped_ptr<LevelDBDatabase> leveldb =
95 LevelDBDatabase::Open(temp_directory.path(), &comparator); 95 LevelDBDatabase::Open(temp_directory.path(), &comparator);
96 EXPECT_TRUE(leveldb); 96 EXPECT_TRUE(leveldb);
97 97
98 const std::string old_value("value"); 98 const std::string old_value("value");
99 put_value = old_value; 99 put_value = old_value;
100 bool success = leveldb->Put(key, &put_value); 100 bool success = leveldb->Put(key, &put_value);
101 EXPECT_TRUE(success); 101 EXPECT_TRUE(success);
102 102
103 scoped_refptr<LevelDBTransaction> transaction = 103 scoped_refptr<LevelDBTransaction> transaction =
104 LevelDBTransaction::Create(leveldb.get()); 104 new LevelDBTransaction(leveldb.get());
105 105
106 const std::string new_value("new value"); 106 const std::string new_value("new value");
107 put_value = new_value; 107 put_value = new_value;
108 success = leveldb->Put(key, &put_value); 108 success = leveldb->Put(key, &put_value);
109 EXPECT_TRUE(success); 109 EXPECT_TRUE(success);
110 110
111 bool found = false; 111 bool found = false;
112 success = transaction->Get(key, &got_value, &found); 112 success = transaction->Get(key, &got_value, &found);
113 EXPECT_TRUE(success); 113 EXPECT_TRUE(success);
114 EXPECT_TRUE(found); 114 EXPECT_TRUE(found);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 EXPECT_TRUE(leveldb); 163 EXPECT_TRUE(leveldb);
164 164
165 put_value = value1; 165 put_value = value1;
166 success = leveldb->Put(key1, &put_value); 166 success = leveldb->Put(key1, &put_value);
167 EXPECT_TRUE(success); 167 EXPECT_TRUE(success);
168 put_value = value2; 168 put_value = value2;
169 success = leveldb->Put(key2, &put_value); 169 success = leveldb->Put(key2, &put_value);
170 EXPECT_TRUE(success); 170 EXPECT_TRUE(success);
171 171
172 scoped_refptr<LevelDBTransaction> transaction = 172 scoped_refptr<LevelDBTransaction> transaction =
173 LevelDBTransaction::Create(leveldb.get()); 173 new LevelDBTransaction(leveldb.get());
174 174
175 success = leveldb->Remove(key2); 175 success = leveldb->Remove(key2);
176 EXPECT_TRUE(success); 176 EXPECT_TRUE(success);
177 177
178 scoped_ptr<LevelDBIterator> it = transaction->CreateIterator(); 178 scoped_ptr<LevelDBIterator> it = transaction->CreateIterator();
179 179
180 it->Seek(std::string()); 180 it->Seek(std::string());
181 181
182 EXPECT_TRUE(it->IsValid()); 182 EXPECT_TRUE(it->IsValid());
183 EXPECT_EQ(comparator.Compare(it->Key(), key1), 0); 183 EXPECT_EQ(comparator.Compare(it->Key(), key1), 0);
184 EXPECT_EQ(comparator.Compare(it->Value(), value1), 0); 184 EXPECT_EQ(comparator.Compare(it->Value(), value1), 0);
185 185
186 it->Next(); 186 it->Next();
187 187
188 EXPECT_TRUE(it->IsValid()); 188 EXPECT_TRUE(it->IsValid());
189 EXPECT_EQ(comparator.Compare(it->Key(), key2), 0); 189 EXPECT_EQ(comparator.Compare(it->Key(), key2), 0);
190 EXPECT_EQ(comparator.Compare(it->Value(), value2), 0); 190 EXPECT_EQ(comparator.Compare(it->Value(), value2), 0);
191 191
192 it->Next(); 192 it->Next();
193 193
194 EXPECT_FALSE(it->IsValid()); 194 EXPECT_FALSE(it->IsValid());
195 } 195 }
196 196
197 } // namespace 197 } // namespace
198 198
199 } // namespace content 199 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698