| Index: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_util.h
|
| diff --git a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_util.h b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_util.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dfe7f2e8b7b31676ded1c00c67a390431dcf5d78
|
| --- /dev/null
|
| +++ b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_util.h
|
| @@ -0,0 +1,73 @@
|
| +// 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_UTIL_H_
|
| +#define LIBRARIES_NACL_IO_TEST_FAKE_UTIL_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include <ppapi/c/pp_completion_callback.h>
|
| +
|
| +#include "fake_ppapi/fake_filesystem.h"
|
| +#include "fake_ppapi/fake_resource_manager.h"
|
| +
|
| +const int32_t STATUSCODE_OK = 200;
|
| +const int32_t STATUSCODE_NO_CONTENT = 204;
|
| +const int32_t STATUSCODE_PARTIAL_CONTENT = 206;
|
| +const int32_t STATUSCODE_BAD_REQUEST = 400;
|
| +const int32_t STATUSCODE_UNAUTHORIZED = 401;
|
| +const int32_t STATUSCODE_FORBIDDEN = 403;
|
| +const int32_t STATUSCODE_NOT_FOUND = 404;
|
| +const int32_t STATUSCODE_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
|
| +const int32_t STATUSCODE_INTERNAL_SERVER_ERROR = 500;
|
| +const int32_t STATUSCODE_NOT_IMPLEMENTED = 501;
|
| +
|
| +class FakeFileSystemResource : public FakeResource {
|
| + public:
|
| + FakeFileSystemResource() : filesystem(NULL), opened(false) {}
|
| + ~FakeFileSystemResource() { delete filesystem; }
|
| + static const char* classname() { return "FakeFileSystemResource"; }
|
| +
|
| + FakeFilesystem* filesystem; // Owned.
|
| + bool opened;
|
| +};
|
| +
|
| +class FakeFileRefResource : public FakeResource {
|
| + public:
|
| + FakeFileRefResource() : filesystem(NULL) {}
|
| + static const char* classname() { return "FakeFileRefResource"; }
|
| +
|
| + FakeFilesystem* filesystem; // Weak reference.
|
| + FakeFilesystem::Path path;
|
| + std::string contents;
|
| +};
|
| +
|
| +class FakeURLRequestInfoResource : public FakeResource {
|
| + public:
|
| + FakeURLRequestInfoResource() {}
|
| + static const char* classname() { return "FakeURLRequestInfoResource"; }
|
| +
|
| + std::string url;
|
| + std::string method;
|
| + std::string headers;
|
| + std::string body;
|
| +};
|
| +
|
| +class FakeURLResponseInfoResource : public FakeResource {
|
| + public:
|
| + FakeURLResponseInfoResource() : status_code(0) {}
|
| + static const char* classname() { return "FakeURLResponseInfoResource"; }
|
| +
|
| + int status_code;
|
| + std::string url;
|
| + std::string headers;
|
| + std::string body;
|
| +};
|
| +
|
| +int32_t RunCompletionCallback(PP_CompletionCallback* callback, int32_t result);
|
| +bool GetHeaderValue(const std::string& headers,
|
| + const std::string& key,
|
| + std::string* out_value);
|
| +
|
| +#endif // LIBRARIES_NACL_IO_TEST_FAKE_UTIL_H_
|
|
|