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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 {false, "dir0/file0", "dir1/file1", true}, | 99 {false, "dir0/file0", "dir1/file1", true}, |
100 }; | 100 }; |
101 | 101 |
102 struct OriginEnumerationTestRecord { | 102 struct OriginEnumerationTestRecord { |
103 std::string origin_url; | 103 std::string origin_url; |
104 bool has_temporary; | 104 bool has_temporary; |
105 bool has_persistent; | 105 bool has_persistent; |
106 }; | 106 }; |
107 | 107 |
108 const OriginEnumerationTestRecord kOriginEnumerationTestRecords[] = { | 108 const OriginEnumerationTestRecord kOriginEnumerationTestRecords[] = { |
109 {"http://example.com", false, true}, | 109 {"http://example.com/", false, true}, |
110 {"http://example1.com", true, false}, | 110 {"http://example1.com/", true, false}, |
111 {"https://example1.com", true, true}, | 111 {"https://example1.com/", true, true}, |
112 {"file://", false, true}, | 112 {"file:///", false, true}, |
113 {"http://example.com:8000", false, true}, | 113 {"http://example.com:8000/", false, true}, |
114 }; | 114 }; |
115 | 115 |
116 FileSystemURL FileSystemURLAppend( | 116 FileSystemURL FileSystemURLAppend( |
117 const FileSystemURL& url, const base::FilePath::StringType& child) { | 117 const FileSystemURL& url, const base::FilePath::StringType& child) { |
118 return FileSystemURL::CreateForTest( | 118 return FileSystemURL::CreateForTest( |
119 url.origin(), url.mount_type(), url.virtual_path().Append(child)); | 119 url.origin(), url.mount_type(), url.virtual_path().Append(child)); |
120 } | 120 } |
121 | 121 |
122 FileSystemURL FileSystemURLAppendUTF8( | 122 FileSystemURL FileSystemURLAppendUTF8( |
123 const FileSystemURL& url, const std::string& child) { | 123 const FileSystemURL& url, const std::string& child) { |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 std::set<GURL> origins_found; | 1625 std::set<GURL> origins_found; |
1626 GURL origin_url; | 1626 GURL origin_url; |
1627 while (!(origin_url = enumerator->Next()).is_empty()) { | 1627 while (!(origin_url = enumerator->Next()).is_empty()) { |
1628 origins_found.insert(origin_url); | 1628 origins_found.insert(origin_url); |
1629 SCOPED_TRACE(testing::Message() << "Handling " << origin_url.spec()); | 1629 SCOPED_TRACE(testing::Message() << "Handling " << origin_url.spec()); |
1630 bool found = false; | 1630 bool found = false; |
1631 for (size_t i = 0; !found && i < arraysize(kOriginEnumerationTestRecords); | 1631 for (size_t i = 0; !found && i < arraysize(kOriginEnumerationTestRecords); |
1632 ++i) { | 1632 ++i) { |
1633 const OriginEnumerationTestRecord& record = | 1633 const OriginEnumerationTestRecord& record = |
1634 kOriginEnumerationTestRecords[i]; | 1634 kOriginEnumerationTestRecords[i]; |
1635 if (GURL(record.origin_url) != origin_url) | 1635 if (origin_url != record.origin_url) |
1636 continue; | 1636 continue; |
1637 found = true; | 1637 found = true; |
1638 EXPECT_EQ(record.has_temporary, | 1638 EXPECT_EQ(record.has_temporary, |
1639 HasFileSystemType(enumerator.get(), kFileSystemTypeTemporary)); | 1639 HasFileSystemType(enumerator.get(), kFileSystemTypeTemporary)); |
1640 EXPECT_EQ(record.has_persistent, | 1640 EXPECT_EQ(record.has_persistent, |
1641 HasFileSystemType(enumerator.get(), kFileSystemTypePersistent)); | 1641 HasFileSystemType(enumerator.get(), kFileSystemTypePersistent)); |
1642 } | 1642 } |
1643 // Deal with the default filesystem created by the test helper. | 1643 // Deal with the default filesystem created by the test helper. |
1644 if (!found && origin_url == origin()) { | 1644 if (!found && origin_url == origin()) { |
1645 ASSERT_TRUE(type() == kFileSystemTypeTemporary); | 1645 ASSERT_TRUE(type() == kFileSystemTypeTemporary); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 ofu()->GetDirectoryForOriginAndType( | 2567 ofu()->GetDirectoryForOriginAndType( |
2568 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error); | 2568 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error); |
2569 ASSERT_EQ(base::File::FILE_OK, error); | 2569 ASSERT_EQ(base::File::FILE_OK, error); |
2570 error = base::File::FILE_ERROR_FAILED; | 2570 error = base::File::FILE_ERROR_FAILED; |
2571 ofu()->GetDirectoryForOriginAndType( | 2571 ofu()->GetDirectoryForOriginAndType( |
2572 origin2, GetTypeString(kFileSystemTypePersistent), false, &error); | 2572 origin2, GetTypeString(kFileSystemTypePersistent), false, &error); |
2573 ASSERT_EQ(base::File::FILE_OK, error); | 2573 ASSERT_EQ(base::File::FILE_OK, error); |
2574 } | 2574 } |
2575 | 2575 |
2576 } // namespace content | 2576 } // namespace content |
OLD | NEW |