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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "sql/connection.h" | 9 #include "sql/connection.h" |
10 #include "sql/meta_table.h" | 10 #include "sql/meta_table.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 EXPECT_TRUE(origins.empty()); | 48 EXPECT_TRUE(origins.empty()); |
49 } | 49 } |
50 | 50 |
51 TEST(AppCacheDatabaseTest, ReCreate) { | 51 TEST(AppCacheDatabaseTest, ReCreate) { |
52 // Real files on disk for this test. | 52 // Real files on disk for this test. |
53 base::ScopedTempDir temp_dir; | 53 base::ScopedTempDir temp_dir; |
54 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 54 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
55 const base::FilePath kDbFile = temp_dir.path().AppendASCII("appcache.db"); | 55 const base::FilePath kDbFile = temp_dir.path().AppendASCII("appcache.db"); |
56 const base::FilePath kNestedDir = temp_dir.path().AppendASCII("nested"); | 56 const base::FilePath kNestedDir = temp_dir.path().AppendASCII("nested"); |
57 const base::FilePath kOtherFile = kNestedDir.AppendASCII("other_file"); | 57 const base::FilePath kOtherFile = kNestedDir.AppendASCII("other_file"); |
58 EXPECT_TRUE(file_util::CreateDirectory(kNestedDir)); | 58 EXPECT_TRUE(base::CreateDirectory(kNestedDir)); |
59 EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3)); | 59 EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3)); |
60 | 60 |
61 AppCacheDatabase db(kDbFile); | 61 AppCacheDatabase db(kDbFile); |
62 EXPECT_FALSE(db.LazyOpen(false)); | 62 EXPECT_FALSE(db.LazyOpen(false)); |
63 EXPECT_TRUE(db.LazyOpen(true)); | 63 EXPECT_TRUE(db.LazyOpen(true)); |
64 | 64 |
65 EXPECT_TRUE(base::PathExists(kDbFile)); | 65 EXPECT_TRUE(base::PathExists(kDbFile)); |
66 EXPECT_TRUE(base::DirectoryExists(kNestedDir)); | 66 EXPECT_TRUE(base::DirectoryExists(kNestedDir)); |
67 EXPECT_TRUE(base::PathExists(kOtherFile)); | 67 EXPECT_TRUE(base::PathExists(kOtherFile)); |
68 | 68 |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 EXPECT_EQ(expected_namespace_url, fallbacks[i].namespace_.namespace_url); | 1127 EXPECT_EQ(expected_namespace_url, fallbacks[i].namespace_.namespace_url); |
1128 EXPECT_EQ(expected_target_url, fallbacks[i].namespace_.target_url); | 1128 EXPECT_EQ(expected_target_url, fallbacks[i].namespace_.target_url); |
1129 EXPECT_FALSE(fallbacks[i].namespace_.is_pattern); | 1129 EXPECT_FALSE(fallbacks[i].namespace_.is_pattern); |
1130 EXPECT_EQ(expected_whitelist_url, whitelists[i].namespace_url); | 1130 EXPECT_EQ(expected_whitelist_url, whitelists[i].namespace_url); |
1131 EXPECT_FALSE(whitelists[i].is_pattern); | 1131 EXPECT_FALSE(whitelists[i].is_pattern); |
1132 } | 1132 } |
1133 } | 1133 } |
1134 #endif // !APPCACHE_USE_SIMPLE_CACHE | 1134 #endif // !APPCACHE_USE_SIMPLE_CACHE |
1135 | 1135 |
1136 } // namespace appcache | 1136 } // namespace appcache |
OLD | NEW |