OLD | NEW |
1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <functional> | 6 #include <functional> |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/leveldatabase/src/db/filename.h" | 17 #include "third_party/leveldatabase/src/db/filename.h" |
18 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 18 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
19 #include "webkit/browser/fileapi/sandbox_database_test_helper.h" | 19 #include "webkit/browser/fileapi/sandbox_database_test_helper.h" |
20 #include "webkit/browser/fileapi/sandbox_origin_database.h" | 20 #include "webkit/browser/fileapi/sandbox_origin_database.h" |
21 #include "webkit/common/fileapi/file_system_util.h" | 21 #include "webkit/common/fileapi/file_system_util.h" |
22 | 22 |
23 namespace fileapi { | 23 using fileapi::CorruptDatabase; |
| 24 using fileapi::DeleteDatabaseFile; |
| 25 using fileapi::SandboxOriginDatabase; |
| 26 |
| 27 namespace content { |
24 | 28 |
25 namespace { | 29 namespace { |
26 const base::FilePath::CharType kFileSystemDirName[] = | 30 const base::FilePath::CharType kFileSystemDirName[] = |
27 FILE_PATH_LITERAL("File System"); | 31 FILE_PATH_LITERAL("File System"); |
28 const base::FilePath::CharType kOriginDatabaseName[] = | 32 const base::FilePath::CharType kOriginDatabaseName[] = |
29 FILE_PATH_LITERAL("Origins"); | 33 FILE_PATH_LITERAL("Origins"); |
30 } // namespace | 34 } // namespace |
31 | 35 |
32 TEST(SandboxOriginDatabaseTest, BasicTest) { | 36 TEST(SandboxOriginDatabaseTest, BasicTest) { |
33 base::ScopedTempDir dir; | 37 base::ScopedTempDir dir; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 EXPECT_TRUE(database->ListAllOrigins(&origins_in_db)); | 297 EXPECT_TRUE(database->ListAllOrigins(&origins_in_db)); |
294 | 298 |
295 const std::string kOrigin2("piyo.example.org"); | 299 const std::string kOrigin2("piyo.example.org"); |
296 EXPECT_FALSE(database->HasOriginPath(kOrigin2)); | 300 EXPECT_FALSE(database->HasOriginPath(kOrigin2)); |
297 EXPECT_TRUE(database->GetPathForOrigin(kOrigin2, &path)); | 301 EXPECT_TRUE(database->GetPathForOrigin(kOrigin2, &path)); |
298 EXPECT_FALSE(path.empty()); | 302 EXPECT_FALSE(path.empty()); |
299 EXPECT_TRUE(database->HasOriginPath(kOrigin2)); | 303 EXPECT_TRUE(database->HasOriginPath(kOrigin2)); |
300 } | 304 } |
301 } | 305 } |
302 | 306 |
303 } // namespace fileapi | 307 } // namespace content |
OLD | NEW |