Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 7 #include "base/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 | 64 |
| 65 TEST_F(FileSystemUtilTest, RejectBadType) { | 65 TEST_F(FileSystemUtilTest, RejectBadType) { |
| 66 EXPECT_FALSE(CrackFileSystemURL("filesystem:http://c.org/foobar/file")); | 66 EXPECT_FALSE(CrackFileSystemURL("filesystem:http://c.org/foobar/file")); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(FileSystemUtilTest, RejectMalformedURL) { | 69 TEST_F(FileSystemUtilTest, RejectMalformedURL) { |
| 70 EXPECT_FALSE(CrackFileSystemURL("filesystem:///foobar/file")); | 70 EXPECT_FALSE(CrackFileSystemURL("filesystem:///foobar/file")); |
| 71 EXPECT_FALSE(CrackFileSystemURL("filesystem:foobar/file")); | 71 EXPECT_FALSE(CrackFileSystemURL("filesystem:foobar/file")); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST_F(FileSystemUtilTest, GetTempFileSystemRootURI) { | |
| 75 GURL origin_url("http://chromium.org"); | |
| 76 fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary; | |
| 77 GURL uri = GURL("filesystem:http://chromium.org/temporary/"); | |
| 78 EXPECT_EQ(uri, GetFileSystemRootURI(origin_url, type)); | |
| 79 } | |
| 80 | |
| 81 TEST_F(FileSystemUtilTest, GetPersistentFileSystemRootURI) { | |
| 82 GURL origin_url("http://chromium.org"); | |
| 83 fileapi::FileSystemType type = fileapi::kFileSystemTypePersistent; | |
|
kinuko
2011/03/14 11:03:57
A test for kFileSystemTypeUnknown?
ericu
2011/03/15 02:43:11
That will DCHECK(false). I think it's better to l
| |
| 84 GURL uri = GURL("filesystem:http://chromium.org/persistent/"); | |
| 85 EXPECT_EQ(uri, GetFileSystemRootURI(origin_url, type)); | |
| 86 } | |
| 87 | |
| 74 } // namespace (anonymous) | 88 } // namespace (anonymous) |
| 75 } // namespace fileapi | 89 } // namespace fileapi |
| OLD | NEW |