Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: webkit/fileapi/isolated_context_unittest.cc

Issue 10829136: Adding RevokeFileSystemByPath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix!! Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/isolated_context.cc ('k') | webkit/fileapi/isolated_file_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/isolated_context_unittest.cc
diff --git a/webkit/fileapi/isolated_context_unittest.cc b/webkit/fileapi/isolated_context_unittest.cc
index c1319919d92f6acaa1956d69a375e9a000851f72..ac71aece10b378f1fe86ddd71a46a4b6b4549890 100644
--- a/webkit/fileapi/isolated_context_unittest.cc
+++ b/webkit/fileapi/isolated_context_unittest.cc
@@ -58,11 +58,12 @@ class IsolatedContextTest : public testing::Test {
names_.push_back(name);
}
id_ = IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files);
+ IsolatedContext::GetInstance()->AddReference(id_);
ASSERT_FALSE(id_.empty());
}
void TearDown() {
- IsolatedContext::GetInstance()->RevokeFileSystem(id_);
+ IsolatedContext::GetInstance()->RemoveReference(id_);
}
IsolatedContext* isolated_context() const {
@@ -109,8 +110,9 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) {
FilePath path;
ASSERT_FALSE(isolated_context()->GetRegisteredPath(id_, &path));
- // Revoking the current one and registering a new one.
- isolated_context()->RevokeFileSystem(id_);
+ // Deref the current one and registering a new one.
+ isolated_context()->RemoveReference(id_);
+
std::string id2 = isolated_context()->RegisterFileSystemForPath(
kFileSystemTypeIsolated, FilePath(DRIVE FPL("/foo")), NULL);
@@ -119,10 +121,31 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) {
ASSERT_FALSE(isolated_context()->GetDraggedFileInfo(id_, &toplevels));
// Make sure the GetRegisteredPath returns true only for the new one.
- ASSERT_TRUE(isolated_context()->GetRegisteredPath(id2, &path));
ASSERT_FALSE(isolated_context()->GetRegisteredPath(id_, &path));
+ ASSERT_TRUE(isolated_context()->GetRegisteredPath(id2, &path));
+
+ // Try registering two more file systems for the same path as id2.
+ std::string id3 = isolated_context()->RegisterFileSystemForPath(
+ kFileSystemTypeIsolated, path, NULL);
+ std::string id4 = isolated_context()->RegisterFileSystemForPath(
+ kFileSystemTypeIsolated, path, NULL);
+
+ // Remove file system for id4.
+ isolated_context()->AddReference(id4);
+ isolated_context()->RemoveReference(id4);
+
+ // Only id4 should become invalid now.
+ ASSERT_TRUE(isolated_context()->GetRegisteredPath(id2, &path));
+ ASSERT_TRUE(isolated_context()->GetRegisteredPath(id3, &path));
+ ASSERT_FALSE(isolated_context()->GetRegisteredPath(id4, &path));
+
+ // Revoke the file systems by path.
+ isolated_context()->RevokeFileSystemByPath(path);
- isolated_context()->RevokeFileSystem(id2);
+ // Now all the file systems associated to the path must be invalid.
+ ASSERT_FALSE(isolated_context()->GetRegisteredPath(id2, &path));
+ ASSERT_FALSE(isolated_context()->GetRegisteredPath(id3, &path));
+ ASSERT_FALSE(isolated_context()->GetRegisteredPath(id4, &path));
}
TEST_F(IsolatedContextTest, CrackWithRelativePaths) {
« no previous file with comments | « webkit/fileapi/isolated_context.cc ('k') | webkit/fileapi/isolated_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698