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

Side by Side Diff: webkit/fileapi/file_system_directory_database_unittest.cc

Issue 10051002: Merge 129631 - Add database recovery for FileSystemOriginDatabase (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 years, 8 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) 2011 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 "webkit/fileapi/file_system_directory_database.h" 5 #include "webkit/fileapi/file_system_directory_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
(...skipping 10 matching lines...) Expand all
22 FileSystemDirectoryDatabaseTest() { 22 FileSystemDirectoryDatabaseTest() {
23 EXPECT_TRUE(base_.CreateUniqueTempDir()); 23 EXPECT_TRUE(base_.CreateUniqueTempDir());
24 InitDatabase(); 24 InitDatabase();
25 } 25 }
26 26
27 FileSystemDirectoryDatabase* db() { 27 FileSystemDirectoryDatabase* db() {
28 return db_.get(); 28 return db_.get();
29 } 29 }
30 30
31 void InitDatabase() { 31 void InitDatabase() {
32 // First reset() is to avoid multiple database instance for single
33 // directory at once.
32 db_.reset(); 34 db_.reset();
33 FilePath path = base_.path().AppendASCII("db"); 35 db_.reset(new FileSystemDirectoryDatabase(base_.path()));
34 db_.reset(new FileSystemDirectoryDatabase(path));
35 } 36 }
36 37
37 bool AddFileInfo(FileId parent_id, const FilePath::StringType& name) { 38 bool AddFileInfo(FileId parent_id, const FilePath::StringType& name) {
38 FileId file_id; 39 FileId file_id;
39 FileInfo info; 40 FileInfo info;
40 info.parent_id = parent_id; 41 info.parent_id = parent_id;
41 info.name = name; 42 info.name = name;
42 return db_->AddFileInfo(info, &file_id); 43 return db_->AddFileInfo(info, &file_id);
43 } 44 }
44 45
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 EXPECT_TRUE(db()->GetNextInteger(&next)); 412 EXPECT_TRUE(db()->GetNextInteger(&next));
412 EXPECT_EQ(2, next); 413 EXPECT_EQ(2, next);
413 EXPECT_TRUE(db()->GetNextInteger(&next)); 414 EXPECT_TRUE(db()->GetNextInteger(&next));
414 EXPECT_EQ(3, next); 415 EXPECT_EQ(3, next);
415 InitDatabase(); 416 InitDatabase();
416 EXPECT_TRUE(db()->GetNextInteger(&next)); 417 EXPECT_TRUE(db()->GetNextInteger(&next));
417 EXPECT_EQ(4, next); 418 EXPECT_EQ(4, next);
418 } 419 }
419 420
420 } // namespace fileapi 421 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_directory_database.cc ('k') | webkit/fileapi/file_system_origin_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698