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

Unified Diff: sql/mojo/vfs_unittest.cc

Issue 1231493002: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 5 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
« sql/mojo/mojo_vfs.cc ('K') | « sql/mojo/sql_test_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/mojo/vfs_unittest.cc
diff --git a/sql/mojo/vfs_unittest.cc b/sql/mojo/vfs_unittest.cc
index 8ca7c5c21a7dad7c794e5f6a9c5e16ca9623828d..14d219e83885f55a3acb90bca91a5a9f902215be 100644
--- a/sql/mojo/vfs_unittest.cc
+++ b/sql/mojo/vfs_unittest.cc
@@ -30,9 +30,10 @@ namespace sql {
const char kFileName[] = "TestingDatabase.db";
-class VFSTest : public mojo::test::ApplicationTestBase {
+class VFSTest : public mojo::test::ApplicationTestBase,
+ public filesystem::FileSystemClient {
public:
- VFSTest() {}
+ VFSTest() : binding_(this) {}
~VFSTest() override {}
sqlite3_vfs* vfs() {
@@ -51,9 +52,13 @@ class VFSTest : public mojo::test::ApplicationTestBase {
request->url = mojo::String::From("mojo:filesystem");
application_impl()->ConnectToService(request.Pass(), &files_);
+ filesystem::FileSystemClientPtr client;
+ binding_.Bind(GetProxy(&client));
+
filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
filesystem::DirectoryPtr directory;
- files_->OpenFileSystem("temp", GetProxy(&directory), mojo::Capture(&error));
+ files_->OpenFileSystem("temp", GetProxy(&directory), client.Pass(),
+ mojo::Capture(&error));
ASSERT_TRUE(files_.WaitForIncomingResponse());
ASSERT_EQ(filesystem::FILE_ERROR_OK, error);
@@ -65,9 +70,13 @@ class VFSTest : public mojo::test::ApplicationTestBase {
mojo::test::ApplicationTestBase::TearDown();
}
+ void OnFileSystemShutdown() override {
+ }
+
private:
filesystem::FileSystemPtr files_;
scoped_ptr<ScopedMojoFilesystemVFS> vfs_;
+ mojo::Binding<filesystem::FileSystemClient> binding_;
DISALLOW_COPY_AND_ASSIGN(VFSTest);
};
@@ -115,6 +124,19 @@ TEST_F(VFSTest, NonexclusiveOpen) {
file->pMethods->xClose(file2.get());
}
+TEST_F(VFSTest, NullFilenameOpen) {
+ // Opening a file with a null filename should return a valid file object.
+ scoped_ptr<sqlite3_file> file(MakeFile());
+ int out_flags;
+ int rc = vfs()->xOpen(
+ vfs(), nullptr, file.get(),
+ SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,
+ &out_flags);
+ EXPECT_EQ(SQLITE_OK, rc);
+
+ file->pMethods->xClose(file.get());
+}
+
TEST_F(VFSTest, DeleteOnClose) {
{
scoped_ptr<sqlite3_file> file(MakeFile());
« sql/mojo/mojo_vfs.cc ('K') | « sql/mojo/sql_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698