diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 04:01:07 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 04:01:07 +0000 |
commit | 5784e4490e8d63e65497597a1acdc2ce1b420c6f (patch) | |
tree | 6a770faa60c6658d09501804156902d35c91ad0c /webkit/fileapi/isolated_context_unittest.cc | |
parent | a4e1bf741f2ef9712854f5b5a165545a846dd835 (diff) | |
download | chromium_src-5784e4490e8d63e65497597a1acdc2ce1b420c6f.zip chromium_src-5784e4490e8d63e65497597a1acdc2ce1b420c6f.tar.gz chromium_src-5784e4490e8d63e65497597a1acdc2ce1b420c6f.tar.bz2 |
Add more FS types and introduce type field into IsolatedContext
(Separated from a bigger patch: https://chromiumcodereview.appspot.com/10810053)
BUG=138022
TEST=existing tests
Review URL: https://chromiumcodereview.appspot.com/10817006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/isolated_context_unittest.cc')
-rw-r--r-- | webkit/fileapi/isolated_context_unittest.cc | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/webkit/fileapi/isolated_context_unittest.cc b/webkit/fileapi/isolated_context_unittest.cc index ee54557..92c5b56 100644 --- a/webkit/fileapi/isolated_context_unittest.cc +++ b/webkit/fileapi/isolated_context_unittest.cc @@ -51,9 +51,13 @@ class IsolatedContextTest : public testing::Test { void SetUp() { IsolatedContext::FileInfoSet files; - for (size_t i = 0; i < arraysize(kTestPaths); ++i) - names_.push_back(files.AddPath(kTestPaths[i].NormalizePathSeparators())); - id_ = IsolatedContext::GetInstance()->RegisterFileSystem(files); + for (size_t i = 0; i < arraysize(kTestPaths); ++i) { + std::string name; + ASSERT_TRUE( + files.AddPath(kTestPaths[i].NormalizePathSeparators(), &name)); + names_.push_back(name); + } + id_ = IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); ASSERT_FALSE(id_.empty()); } @@ -77,14 +81,14 @@ class IsolatedContextTest : public testing::Test { TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { // See if the returned top-level entries match with what we registered. std::vector<FileInfo> toplevels; - ASSERT_TRUE(isolated_context()->GetRegisteredFileInfo(id_, &toplevels)); + ASSERT_TRUE(isolated_context()->GetDraggedFileInfo(id_, &toplevels)); ASSERT_EQ(fileset_.size(), toplevels.size()); for (size_t i = 0; i < toplevels.size(); ++i) { ASSERT_TRUE(fileset_.find(toplevels[i].path) != fileset_.end()); } // See if the name of each registered kTestPaths (that is what we - // register in SetUp() by RegisterFileSystem) is properly cracked as + // register in SetUp() by RegisterDraggedFileSystem) is properly cracked as // a valid virtual path in the isolated filesystem. for (size_t i = 0; i < arraysize(kTestPaths); ++i) { FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) @@ -101,14 +105,23 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { ASSERT_EQ(id_, cracked_id); } - // Revoking the current one and registering a new (empty) one. + // Make sure GetRegisteredPath returns false for id_ since it is + // registered for dragged files. + FilePath path; + ASSERT_FALSE(isolated_context()->GetRegisteredPath(id_, &path)); + + // Revoking the current one and registering a new one. isolated_context()->RevokeFileSystem(id_); - std::string id2 = isolated_context()->RegisterFileSystem( - IsolatedContext::FileInfoSet()); + std::string id2 = isolated_context()->RegisterFileSystemForPath( + kFileSystemTypeIsolated, FilePath(DRIVE FPL("/foo")), NULL); + + // Make sure the GetDraggedFileInfo returns false for both ones. + ASSERT_FALSE(isolated_context()->GetDraggedFileInfo(id2, &toplevels)); + ASSERT_FALSE(isolated_context()->GetDraggedFileInfo(id_, &toplevels)); - // Make sure the GetRegisteredFileInfo returns true only for the new one. - ASSERT_TRUE(isolated_context()->GetRegisteredFileInfo(id2, &toplevels)); - ASSERT_FALSE(isolated_context()->GetRegisteredFileInfo(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)); isolated_context()->RevokeFileSystem(id2); } |