| 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 "webkit/fileapi/file_system_url.h" | 5 #include "webkit/fileapi/file_system_url.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "webkit/fileapi/file_system_types.h" | 10 #include "webkit/fileapi/file_system_types.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const GURL kOrigin("http://example.com"); | 161 const GURL kOrigin("http://example.com"); |
| 162 const base::FilePath kPath(FPL("dir/file")); | 162 const base::FilePath kPath(FPL("dir/file")); |
| 163 | 163 |
| 164 const FileSystemURL kURL1 = FileSystemURL::CreateForTest( | 164 const FileSystemURL kURL1 = FileSystemURL::CreateForTest( |
| 165 kOrigin, kFileSystemTypeTemporary, kPath); | 165 kOrigin, kFileSystemTypeTemporary, kPath); |
| 166 EXPECT_EQ("filesystem:http://example.com/temporary/" + | 166 EXPECT_EQ("filesystem:http://example.com/temporary/" + |
| 167 NormalizedUTF8Path(kPath), | 167 NormalizedUTF8Path(kPath), |
| 168 kURL1.DebugString()); | 168 kURL1.DebugString()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 TEST(FileSystemURLTest, IsInSameFileSystem) { |
| 172 FileSystemURL url_foo_temp_a = FileSystemURL::CreateForTest( |
| 173 GURL("http://foo"), kFileSystemTypeTemporary, |
| 174 base::FilePath::FromUTF8Unsafe("a")); |
| 175 FileSystemURL url_foo_temp_b = FileSystemURL::CreateForTest( |
| 176 GURL("http://foo"), kFileSystemTypeTemporary, |
| 177 base::FilePath::FromUTF8Unsafe("b")); |
| 178 FileSystemURL url_foo_perm_a = FileSystemURL::CreateForTest( |
| 179 GURL("http://foo"), kFileSystemTypePersistent, |
| 180 base::FilePath::FromUTF8Unsafe("a")); |
| 181 FileSystemURL url_bar_temp_a = FileSystemURL::CreateForTest( |
| 182 GURL("http://bar"), kFileSystemTypeTemporary, |
| 183 base::FilePath::FromUTF8Unsafe("a")); |
| 184 FileSystemURL url_bar_perm_a = FileSystemURL::CreateForTest( |
| 185 GURL("http://bar"), kFileSystemTypePersistent, |
| 186 base::FilePath::FromUTF8Unsafe("a")); |
| 187 |
| 188 EXPECT_TRUE(url_foo_temp_a.IsInSameFileSystem(url_foo_temp_a)); |
| 189 EXPECT_TRUE(url_foo_temp_a.IsInSameFileSystem(url_foo_temp_b)); |
| 190 EXPECT_FALSE(url_foo_temp_a.IsInSameFileSystem(url_foo_perm_a)); |
| 191 EXPECT_FALSE(url_foo_temp_a.IsInSameFileSystem(url_bar_temp_a)); |
| 192 EXPECT_FALSE(url_foo_temp_a.IsInSameFileSystem(url_bar_perm_a)); |
| 193 } |
| 194 |
| 171 } // namespace fileapi | 195 } // namespace fileapi |
| OLD | NEW |