зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1772540: Implement OPFS isSameEntry() r=jari,dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D148267
This commit is contained in:
Родитель
5331f2ad4a
Коммит
0f32a80188
|
@ -103,7 +103,11 @@ already_AddRefed<Promise> FileSystemHandle::IsSameEntry(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
promise->MaybeReject(NS_ERROR_NOT_IMPLEMENTED);
|
// Handles the case of "dir = createdir foo; removeEntry(foo); file =
|
||||||
|
// createfile foo; issameentry(dir, file)"
|
||||||
|
const bool result = mMetadata.entryId().Equals(aOther.mMetadata.entryId()) &&
|
||||||
|
Kind() == aOther.Kind();
|
||||||
|
promise->MaybeResolve(result);
|
||||||
|
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,11 +96,11 @@ TEST_F(TestFileSystemHandle, isDifferentEntry) {
|
||||||
RefPtr<Promise> promise = dirHandle->IsSameEntry(*fileHandle, rv);
|
RefPtr<Promise> promise = dirHandle->IsSameEntry(*fileHandle, rv);
|
||||||
ASSERT_TRUE(rv.ErrorCodeIs(NS_OK));
|
ASSERT_TRUE(rv.ErrorCodeIs(NS_OK));
|
||||||
ASSERT_TRUE(promise);
|
ASSERT_TRUE(promise);
|
||||||
ASSERT_EQ(Promise::PromiseState::Rejected, promise->State());
|
ASSERT_EQ(Promise::PromiseState::Resolved, promise->State());
|
||||||
|
|
||||||
nsString result;
|
nsString result;
|
||||||
ASSERT_NSEQ(NS_OK, GetAsString(promise, result));
|
ASSERT_NSEQ(NS_OK, GetAsString(promise, result));
|
||||||
ASSERT_STREQ(u"NS_ERROR_NOT_IMPLEMENTED"_ns, result);
|
ASSERT_STREQ(u"false"_ns, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestFileSystemHandle, isSameEntry) {
|
TEST_F(TestFileSystemHandle, isSameEntry) {
|
||||||
|
@ -111,11 +111,11 @@ TEST_F(TestFileSystemHandle, isSameEntry) {
|
||||||
RefPtr<Promise> promise = fileHandle->IsSameEntry(*fileHandle, rv);
|
RefPtr<Promise> promise = fileHandle->IsSameEntry(*fileHandle, rv);
|
||||||
ASSERT_TRUE(rv.ErrorCodeIs(NS_OK));
|
ASSERT_TRUE(rv.ErrorCodeIs(NS_OK));
|
||||||
ASSERT_TRUE(promise);
|
ASSERT_TRUE(promise);
|
||||||
ASSERT_EQ(Promise::PromiseState::Rejected, promise->State());
|
ASSERT_EQ(Promise::PromiseState::Resolved, promise->State());
|
||||||
|
|
||||||
nsString result;
|
nsString result;
|
||||||
ASSERT_NSEQ(NS_OK, GetAsString(promise, result));
|
ASSERT_NSEQ(NS_OK, GetAsString(promise, result));
|
||||||
ASSERT_STREQ(u"NS_ERROR_NOT_IMPLEMENTED"_ns, result);
|
ASSERT_STREQ(u"true"_ns, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla::dom::fs::test
|
} // namespace mozilla::dom::fs::test
|
||||||
|
|
Загрузка…
Ссылка в новой задаче