| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 const base::FilePath kNestedDir = temp_dir.path().AppendASCII("nested"); | 60 const base::FilePath kNestedDir = temp_dir.path().AppendASCII("nested"); |
| 61 const base::FilePath kOtherFile = kNestedDir.AppendASCII("other_file"); | 61 const base::FilePath kOtherFile = kNestedDir.AppendASCII("other_file"); |
| 62 EXPECT_TRUE(file_util::CreateDirectory(kNestedDir)); | 62 EXPECT_TRUE(file_util::CreateDirectory(kNestedDir)); |
| 63 EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3)); | 63 EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3)); |
| 64 | 64 |
| 65 AppCacheDatabase db(kDbFile); | 65 AppCacheDatabase db(kDbFile); |
| 66 EXPECT_FALSE(db.LazyOpen(false)); | 66 EXPECT_FALSE(db.LazyOpen(false)); |
| 67 EXPECT_TRUE(db.LazyOpen(true)); | 67 EXPECT_TRUE(db.LazyOpen(true)); |
| 68 | 68 |
| 69 EXPECT_TRUE(base::PathExists(kDbFile)); | 69 EXPECT_TRUE(base::PathExists(kDbFile)); |
| 70 EXPECT_TRUE(file_util::DirectoryExists(kNestedDir)); | 70 EXPECT_TRUE(base::DirectoryExists(kNestedDir)); |
| 71 EXPECT_TRUE(base::PathExists(kOtherFile)); | 71 EXPECT_TRUE(base::PathExists(kOtherFile)); |
| 72 | 72 |
| 73 EXPECT_TRUE(db.DeleteExistingAndCreateNewDatabase()); | 73 EXPECT_TRUE(db.DeleteExistingAndCreateNewDatabase()); |
| 74 | 74 |
| 75 EXPECT_TRUE(base::PathExists(kDbFile)); | 75 EXPECT_TRUE(base::PathExists(kDbFile)); |
| 76 EXPECT_FALSE(file_util::DirectoryExists(kNestedDir)); | 76 EXPECT_FALSE(base::DirectoryExists(kNestedDir)); |
| 77 EXPECT_FALSE(base::PathExists(kOtherFile)); | 77 EXPECT_FALSE(base::PathExists(kOtherFile)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 TEST(AppCacheDatabaseTest, ExperimentalFlags) { | 80 TEST(AppCacheDatabaseTest, ExperimentalFlags) { |
| 81 const char kExperimentFlagsKey[] = "ExperimentFlags"; | 81 const char kExperimentFlagsKey[] = "ExperimentFlags"; |
| 82 std::string kInjectedFlags("exp1,exp2"); | 82 std::string kInjectedFlags("exp1,exp2"); |
| 83 | 83 |
| 84 // Real files on disk for this test. | 84 // Real files on disk for this test. |
| 85 base::ScopedTempDir temp_dir; | 85 base::ScopedTempDir temp_dir; |
| 86 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 86 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 EXPECT_EQ(kMockOrigin, fallbacks[i].origin); | 1103 EXPECT_EQ(kMockOrigin, fallbacks[i].origin); |
| 1104 EXPECT_EQ(expected_namespace_url, fallbacks[i].namespace_.namespace_url); | 1104 EXPECT_EQ(expected_namespace_url, fallbacks[i].namespace_.namespace_url); |
| 1105 EXPECT_EQ(expected_target_url, fallbacks[i].namespace_.target_url); | 1105 EXPECT_EQ(expected_target_url, fallbacks[i].namespace_.target_url); |
| 1106 EXPECT_FALSE(fallbacks[i].namespace_.is_pattern); | 1106 EXPECT_FALSE(fallbacks[i].namespace_.is_pattern); |
| 1107 EXPECT_EQ(expected_whitelist_url, whitelists[i].namespace_url); | 1107 EXPECT_EQ(expected_whitelist_url, whitelists[i].namespace_url); |
| 1108 EXPECT_FALSE(whitelists[i].is_pattern); | 1108 EXPECT_FALSE(whitelists[i].is_pattern); |
| 1109 } | 1109 } |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 } // namespace appcache | 1112 } // namespace appcache |
| OLD | NEW |