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

Unified Diff: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_node.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, 4 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_node.h
diff --git a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_node.h b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_node.h
new file mode 100644
index 0000000000000000000000000000000000000000..9afc3fa13c384688231d5e001840fd7ebf831f4b
--- /dev/null
+++ b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_node.h
@@ -0,0 +1,40 @@
+// 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_NODE_H_
+#define LIBRARIES_NACL_IO_TEST_FAKE_NODE_H_
+
+#include <string>
+#include <vector>
+
+#include "ppapi/c/pp_file_info.h"
+
+class FakeNode {
+ public:
+ FakeNode(const PP_FileInfo& info);
+ FakeNode(const PP_FileInfo& info, const std::vector<uint8_t>& contents);
+ FakeNode(const PP_FileInfo& info, const std::string& contents);
+
+ int32_t Read(int64_t offset, char* buffer, int32_t bytes_to_read);
+ int32_t Write(int64_t offset, const char* buffer, int32_t bytes_to_write);
+ int32_t Append(const char* buffer, int32_t bytes_to_write);
+ int32_t SetLength(int64_t length);
+ void GetInfo(PP_FileInfo* out_info);
+ bool IsRegular() const;
+ bool IsDirectory() const;
+ PP_FileType file_type() const { return info_.type; }
+
+ // These times are not modified by the fake implementation.
+ void set_creation_time(PP_Time time) { info_.creation_time = time; }
+ void set_last_access_time(PP_Time time) { info_.last_access_time = time; }
+ void set_last_modified_time(PP_Time time) { info_.last_modified_time = time; }
+
+ const std::vector<uint8_t>& contents() const { return contents_; }
+
+ private:
+ PP_FileInfo info_;
+ std::vector<uint8_t> contents_;
+};
+
+#endif // LIBRARIES_NACL_IO_TEST_FAKE_NODE_H_

Powered by Google App Engine
This is Rietveld 408576698