OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_directory_reader.h" | 5 #include "ppapi/tests/test_directory_reader.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 bool TestDirectoryReader::Init() { | 34 bool TestDirectoryReader::Init() { |
35 return InitTestingInterface() && EnsureRunningOverHTTP(); | 35 return InitTestingInterface() && EnsureRunningOverHTTP(); |
36 } | 36 } |
37 | 37 |
38 void TestDirectoryReader::RunTest() { | 38 void TestDirectoryReader::RunTest() { |
39 RUN_TEST(GetNextFile); | 39 RUN_TEST(GetNextFile); |
40 } | 40 } |
41 | 41 |
42 std::string TestDirectoryReader::TestGetNextFile() { | 42 std::string TestDirectoryReader::TestGetNextFile() { |
43 TestCompletionCallback callback; | 43 TestCompletionCallback callback(instance_->pp_instance()); |
44 pp::FileSystem_Dev file_system( | 44 pp::FileSystem_Dev file_system( |
45 instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 45 instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
46 int32_t rv = file_system.Open(1024, callback); | 46 int32_t rv = file_system.Open(1024, callback); |
47 if (rv == PP_ERROR_WOULDBLOCK) | 47 if (rv == PP_ERROR_WOULDBLOCK) |
48 rv = callback.WaitForResult(); | 48 rv = callback.WaitForResult(); |
49 if (rv != PP_OK) | 49 if (rv != PP_OK) |
50 return ReportError("FileSystem::Open", rv); | 50 return ReportError("FileSystem::Open", rv); |
51 | 51 |
52 pp::FileRef_Dev dir_ref(file_system, "/"); | 52 pp::FileRef_Dev dir_ref(file_system, "/"); |
53 pp::FileRef_Dev file_ref_1(file_system, "/file_1"); | 53 pp::FileRef_Dev file_ref_1(file_system, "/file_1"); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return "DirectoryReader::GetNextEntry not aborted."; | 166 return "DirectoryReader::GetNextEntry not aborted."; |
167 if (entry.is_null() != entry_is_null) | 167 if (entry.is_null() != entry_is_null) |
168 return "DirectoryReader::GetNextEntry wrote result after destruction."; | 168 return "DirectoryReader::GetNextEntry wrote result after destruction."; |
169 } else if (rv != PP_OK) { | 169 } else if (rv != PP_OK) { |
170 return ReportError("DirectoryReader::GetNextEntry", rv); | 170 return ReportError("DirectoryReader::GetNextEntry", rv); |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 return ""; | 174 return ""; |
175 } | 175 } |
OLD | NEW |