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

Unified Diff: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_filesystem.h

Issue 2156503002: [NaCl SDK] Expose Google Drive to nacl_io. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
Index: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_filesystem.h
diff --git a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_filesystem.h b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_filesystem.h
new file mode 100644
index 0000000000000000000000000000000000000000..15c24892f9fd5d070a2dd0e0ed22184be616312e
--- /dev/null
+++ b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_filesystem.h
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBRARIES_NACL_IO_TEST_FAKE_FILESYSTEM_H_
+#define LIBRARIES_NACL_IO_TEST_FAKE_FILESYSTEM_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "ppapi/c/pp_file_info.h"
+
+#include "fake_ppapi/fake_node.h"
+
+class FakeFilesystem {
+ public:
+ typedef std::string Path;
+
+ struct DirectoryEntry {
+ Path path;
+ const FakeNode* node;
+ };
+ typedef std::vector<DirectoryEntry> DirectoryEntries;
+
+ FakeFilesystem();
+ explicit FakeFilesystem(PP_FileSystemType type);
+ FakeFilesystem(const FakeFilesystem& filesystem, PP_FileSystemType type);
+
+ void Clear();
+ bool AddEmptyFile(const Path& path, FakeNode** out_node);
+ bool AddFile(const Path& path,
+ const std::string& contents,
+ FakeNode** out_node);
+ bool AddFile(const Path& path,
+ const std::vector<uint8_t>& contents,
+ FakeNode** out_node);
+ bool AddDirectory(const Path& path, FakeNode** out_node);
+ bool RemoveNode(const Path& path);
+
+ FakeNode* GetNode(const Path& path);
+ bool GetDirectoryEntries(const Path& path,
+ DirectoryEntries* out_dir_entries) const;
+ PP_FileSystemType filesystem_type() const { return filesystem_type_; }
+ static Path GetParentPath(const Path& path);
+
+ private:
+ typedef std::map<Path, FakeNode> NodeMap;
+ NodeMap node_map_;
+ PP_FileSystemType filesystem_type_;
+};
+
+#endif // LIBRARIES_NACL_IO_TEST_FAKE_FILESYSTEM_H_

Powered by Google App Engine
This is Rietveld 408576698