OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "mojo/file_utils/file_util.h" | 8 #include "mojo/file_utils/file_util.h" |
9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
10 #include "mojo/public/cpp/application/application_test_base.h" | 10 #include "mojo/public/cpp/application/application_test_base.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Close the FilePtr |file| and verify that no error occurs. | 128 // Close the FilePtr |file| and verify that no error occurs. |
129 void CloseFileHelper(mojo::files::FilePtr* file) { | 129 void CloseFileHelper(mojo::files::FilePtr* file) { |
130 mojo::files::Error error = mojo::files::Error::INTERNAL; | 130 mojo::files::Error error = mojo::files::Error::INTERNAL; |
131 (*file)->Close(Capture(&error)); | 131 (*file)->Close(Capture(&error)); |
132 ASSERT_TRUE(file->WaitForIncomingResponse()); | 132 ASSERT_TRUE(file->WaitForIncomingResponse()); |
133 EXPECT_EQ(mojo::files::Error::OK, error); | 133 EXPECT_EQ(mojo::files::Error::OK, error); |
134 } | 134 } |
135 | 135 |
136 TEST_F(FileUtilTest, BasicCreateTemporaryFile) { | 136 TEST_F(FileUtilTest, BasicCreateTemporaryFile) { |
137 mojo::files::FilesPtr files; | 137 mojo::files::FilesPtr files; |
138 application_impl()->ConnectToService("mojo:files", &files); | 138 application_impl()->ConnectToServiceDeprecated("mojo:files", &files); |
139 | 139 |
140 mojo::files::Error error = mojo::files::Error::INTERNAL; | 140 mojo::files::Error error = mojo::files::Error::INTERNAL; |
141 mojo::files::DirectoryPtr directory; | 141 mojo::files::DirectoryPtr directory; |
142 files->OpenFileSystem(nullptr, mojo::GetProxy(&directory), Capture(&error)); | 142 files->OpenFileSystem(nullptr, mojo::GetProxy(&directory), Capture(&error)); |
143 | 143 |
144 ASSERT_TRUE(files.WaitForIncomingResponse()); | 144 ASSERT_TRUE(files.WaitForIncomingResponse()); |
145 EXPECT_EQ(mojo::files::Error::OK, error); | 145 EXPECT_EQ(mojo::files::Error::OK, error); |
146 | 146 |
147 std::string filename1, filename2, filename3; | 147 std::string filename1, filename2, filename3; |
148 mojo::files::FilePtr file1, file2, file3; | 148 mojo::files::FilePtr file1, file2, file3; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 // Test that the files can be closed once more. | 191 // Test that the files can be closed once more. |
192 CloseFileHelper(&file1); | 192 CloseFileHelper(&file1); |
193 CloseFileHelper(&file2); | 193 CloseFileHelper(&file2); |
194 CloseFileHelper(&file3); | 194 CloseFileHelper(&file3); |
195 } | 195 } |
196 | 196 |
197 } // namespace | 197 } // namespace |
198 } // namespace test | 198 } // namespace test |
199 } // namespace file_utils | 199 } // namespace file_utils |
OLD | NEW |