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

Unified Diff: ppapi/tests/test_file_system.cc

Issue 52233002: [PPAPI] Added VarResource_Dev class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: FileSystem constructor sets resource to null if not a file system on Release build. Created 7 years, 2 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: ppapi/tests/test_file_system.cc
diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc
index 7badabb4233e79ed632a6a917a9f0179dd0c5337..abcff94c5b7eaa5f165ab2f088662810d3d3d7a5 100644
--- a/ppapi/tests/test_file_system.cc
+++ b/ppapi/tests/test_file_system.cc
@@ -7,7 +7,9 @@
#include <string.h>
#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/file_io.h"
#include "ppapi/cpp/file_system.h"
+#include "ppapi/cpp/resource.h"
#include "ppapi/tests/test_utils.h"
#include "ppapi/tests/testing_instance.h"
@@ -20,6 +22,7 @@ bool TestFileSystem::Init() {
void TestFileSystem::RunTests(const std::string& filter) {
RUN_CALLBACK_TEST(TestFileSystem, Open, filter);
RUN_CALLBACK_TEST(TestFileSystem, MultipleOpens, filter);
+ RUN_CALLBACK_TEST(TestFileSystem, ResourceConversion, filter);
}
std::string TestFileSystem::TestOpen() {
@@ -67,3 +70,21 @@ std::string TestFileSystem::TestMultipleOpens() {
PASS();
}
+
+std::string TestFileSystem::TestResourceConversion() {
+ // Test conversion from file system Resource to FileSystem.
+ pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+ pp::Resource file_system_resource(file_system);
+ ASSERT_TRUE(pp::FileSystem::ResourceIsFileSystem(file_system_resource));
+ pp::FileSystem file_system_resource_file_system(file_system_resource);
+ ASSERT_FALSE(file_system_resource_file_system.is_null());
+
+ // Test conversion that a non-file system Resource does not register as a
+ // FileSystem. (We cannot test conversion, since this is an assertion on a
+ // debug build.)
+ pp::FileIO non_file_system(instance_);
+ pp::Resource non_file_system_resource(non_file_system);
+ ASSERT_FALSE(pp::FileSystem::ResourceIsFileSystem(non_file_system_resource));
+
+ PASS();
+}

Powered by Google App Engine
This is Rietveld 408576698