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

Side by Side 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: Fix Windows compile. Created 7 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ppapi/tests/test_file_system.h ('k') | ppapi/tests/test_post_message.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/tests/test_file_system.h" 5 #include "ppapi/tests/test_file_system.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/cpp/file_io.h"
10 #include "ppapi/cpp/file_system.h" 11 #include "ppapi/cpp/file_system.h"
12 #include "ppapi/cpp/resource.h"
11 #include "ppapi/tests/test_utils.h" 13 #include "ppapi/tests/test_utils.h"
12 #include "ppapi/tests/testing_instance.h" 14 #include "ppapi/tests/testing_instance.h"
13 15
14 REGISTER_TEST_CASE(FileSystem); 16 REGISTER_TEST_CASE(FileSystem);
15 17
16 bool TestFileSystem::Init() { 18 bool TestFileSystem::Init() {
17 return CheckTestingInterface() && EnsureRunningOverHTTP(); 19 return CheckTestingInterface() && EnsureRunningOverHTTP();
18 } 20 }
19 21
20 void TestFileSystem::RunTests(const std::string& filter) { 22 void TestFileSystem::RunTests(const std::string& filter) {
21 RUN_CALLBACK_TEST(TestFileSystem, Open, filter); 23 RUN_CALLBACK_TEST(TestFileSystem, Open, filter);
22 RUN_CALLBACK_TEST(TestFileSystem, MultipleOpens, filter); 24 RUN_CALLBACK_TEST(TestFileSystem, MultipleOpens, filter);
25 RUN_CALLBACK_TEST(TestFileSystem, ResourceConversion, filter);
23 } 26 }
24 27
25 std::string TestFileSystem::TestOpen() { 28 std::string TestFileSystem::TestOpen() {
26 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); 29 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
27 30
28 // Open. 31 // Open.
29 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); 32 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
30 callback.WaitForResult(file_system.Open(1024, callback.GetCallback())); 33 callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
31 CHECK_CALLBACK_BEHAVIOR(callback); 34 CHECK_CALLBACK_BEHAVIOR(callback);
32 ASSERT_EQ(PP_OK, callback.result()); 35 ASSERT_EQ(PP_OK, callback.result());
(...skipping 27 matching lines...) Expand all
60 CHECK_CALLBACK_BEHAVIOR(callback_1); 63 CHECK_CALLBACK_BEHAVIOR(callback_1);
61 ASSERT_EQ(PP_OK, callback_1.result()); 64 ASSERT_EQ(PP_OK, callback_1.result());
62 65
63 TestCompletionCallback callback_3(instance_->pp_instance(), callback_type()); 66 TestCompletionCallback callback_3(instance_->pp_instance(), callback_type());
64 callback_3.WaitForResult(file_system.Open(1024, callback_3.GetCallback())); 67 callback_3.WaitForResult(file_system.Open(1024, callback_3.GetCallback()));
65 CHECK_CALLBACK_BEHAVIOR(callback_3); 68 CHECK_CALLBACK_BEHAVIOR(callback_3);
66 ASSERT_NE(PP_OK, callback_3.result()); 69 ASSERT_NE(PP_OK, callback_3.result());
67 70
68 PASS(); 71 PASS();
69 } 72 }
73
74 std::string TestFileSystem::TestResourceConversion() {
75 // Test conversion from file system Resource to FileSystem.
76 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
77 pp::Resource file_system_resource(file_system);
78 ASSERT_TRUE(pp::FileSystem::IsFileSystem(file_system_resource));
79 pp::FileSystem file_system_resource_file_system(file_system_resource);
80 ASSERT_FALSE(file_system_resource_file_system.is_null());
81
82 // Test conversion that a non-file system Resource does not register as a
83 // FileSystem. (We cannot test conversion, since this is an assertion on a
84 // debug build.)
85 pp::FileIO non_file_system(instance_);
86 pp::Resource non_file_system_resource(non_file_system);
87 ASSERT_FALSE(pp::FileSystem::IsFileSystem(non_file_system_resource));
88
89 PASS();
90 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_file_system.h ('k') | ppapi/tests/test_post_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698