OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/basictypes.h" | 5 #include "base/basictypes.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 "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h" | 9 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h" |
10 #include "webkit/browser/fileapi/sandbox_origin_database.h" | 10 #include "webkit/browser/fileapi/sandbox_origin_database.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 EXPECT_TRUE(database.HasOriginPath(kOrigin)); | 69 EXPECT_TRUE(database.HasOriginPath(kOrigin)); |
70 EXPECT_TRUE(database.GetPathForOrigin(kOrigin, &path)); | 70 EXPECT_TRUE(database.GetPathForOrigin(kOrigin, &path)); |
71 EXPECT_FALSE(path.empty()); | 71 EXPECT_FALSE(path.empty()); |
72 | 72 |
73 // The directory content must be kept (or migrated if necessary), | 73 // The directory content must be kept (or migrated if necessary), |
74 // so we should see the same fake data. | 74 // so we should see the same fake data. |
75 std::string origin_db_data; | 75 std::string origin_db_data; |
76 base::FilePath directory_db_path = dir.path().Append(path); | 76 base::FilePath directory_db_path = dir.path().Append(path); |
77 EXPECT_TRUE(base::DirectoryExists(directory_db_path)); | 77 EXPECT_TRUE(base::DirectoryExists(directory_db_path)); |
78 EXPECT_TRUE(base::PathExists(directory_db_path.AppendASCII("dummy"))); | 78 EXPECT_TRUE(base::PathExists(directory_db_path.AppendASCII("dummy"))); |
79 EXPECT_TRUE(file_util::ReadFileToString( | 79 EXPECT_TRUE(base::ReadFileToString( |
80 directory_db_path.AppendASCII("dummy"), &origin_db_data)); | 80 directory_db_path.AppendASCII("dummy"), &origin_db_data)); |
81 EXPECT_EQ(kFakeDirectoryData, origin_db_data); | 81 EXPECT_EQ(kFakeDirectoryData, origin_db_data); |
82 | 82 |
83 // After the migration the database must be gone. | 83 // After the migration the database must be gone. |
84 EXPECT_FALSE(base::PathExists(old_db_path)); | 84 EXPECT_FALSE(base::PathExists(old_db_path)); |
85 } | 85 } |
86 | 86 |
87 } // namespace fileapi | 87 } // namespace fileapi |
OLD | NEW |