| 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_util.h" | 5 #include "webkit/fileapi/file_system_util.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_url.h" | 10 #include "webkit/fileapi/file_system_url.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:_bar", &fsid)); | 192 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:_bar", &fsid)); |
| 193 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Isolatedbar", &fsid)); | 193 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Isolatedbar", &fsid)); |
| 194 EXPECT_FALSE(CrackIsolatedFileSystemName("fooIsolatedbar", &fsid)); | 194 EXPECT_FALSE(CrackIsolatedFileSystemName("fooIsolatedbar", &fsid)); |
| 195 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Persistent", &fsid)); | 195 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Persistent", &fsid)); |
| 196 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Temporary", &fsid)); | 196 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Temporary", &fsid)); |
| 197 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:External", &fsid)); | 197 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:External", &fsid)); |
| 198 EXPECT_FALSE(CrackIsolatedFileSystemName(":Isolated_bar", &fsid)); | 198 EXPECT_FALSE(CrackIsolatedFileSystemName(":Isolated_bar", &fsid)); |
| 199 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Isolated_", &fsid)); | 199 EXPECT_FALSE(CrackIsolatedFileSystemName("foo:Isolated_", &fsid)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 TEST_F(FileSystemUtilTest, AreSameFileSystem) { | |
| 203 FileSystemURL url_foo_temp_a = FileSystemURL::CreateForTest( | |
| 204 GURL("http://foo"), kFileSystemTypeTemporary, | |
| 205 base::FilePath::FromUTF8Unsafe("a")); | |
| 206 FileSystemURL url_foo_temp_b = FileSystemURL::CreateForTest( | |
| 207 GURL("http://foo"), kFileSystemTypeTemporary, | |
| 208 base::FilePath::FromUTF8Unsafe("b")); | |
| 209 FileSystemURL url_foo_perm_a = FileSystemURL::CreateForTest( | |
| 210 GURL("http://foo"), kFileSystemTypePersistent, | |
| 211 base::FilePath::FromUTF8Unsafe("a")); | |
| 212 FileSystemURL url_bar_temp_a = FileSystemURL::CreateForTest( | |
| 213 GURL("http://bar"), kFileSystemTypeTemporary, | |
| 214 base::FilePath::FromUTF8Unsafe("a")); | |
| 215 FileSystemURL url_bar_perm_a = FileSystemURL::CreateForTest( | |
| 216 GURL("http://bar"), kFileSystemTypePersistent, | |
| 217 base::FilePath::FromUTF8Unsafe("a")); | |
| 218 | |
| 219 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_a)); | |
| 220 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_b)); | |
| 221 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_foo_perm_a)); | |
| 222 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_temp_a)); | |
| 223 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_perm_a)); | |
| 224 } | |
| 225 | |
| 226 } // namespace (anonymous) | 202 } // namespace (anonymous) |
| 227 } // namespace fileapi | 203 } // namespace fileapi |
| OLD | NEW |