| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "components/filesystem/public/interfaces/file_system.mojom.h" | 7 #include "components/filesystem/public/interfaces/file_system.mojom.h" |
| 8 #include "mojo/application/public/cpp/application_impl.h" | 8 #include "mojo/application/public/cpp/application_impl.h" |
| 9 #include "mojo/application/public/cpp/application_test_base.h" | 9 #include "mojo/application/public/cpp/application_test_base.h" |
| 10 #include "mojo/util/capture_util.h" | 10 #include "mojo/util/capture_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 scoped_ptr<sqlite3_file> MakeFile() { | 45 scoped_ptr<sqlite3_file> MakeFile() { |
| 46 return scoped_ptr<sqlite3_file>(reinterpret_cast<sqlite3_file*>( | 46 return scoped_ptr<sqlite3_file>(reinterpret_cast<sqlite3_file*>( |
| 47 new uint8_t[vfs()->szOsFile])); | 47 new uint8_t[vfs()->szOsFile])); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void SetUp() override { | 50 void SetUp() override { |
| 51 mojo::test::ApplicationTestBase::SetUp(); | 51 mojo::test::ApplicationTestBase::SetUp(); |
| 52 | 52 |
| 53 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 53 application_impl()->ConnectToService("mojo:filesystem", &files_); |
| 54 request->url = mojo::String::From("mojo:filesystem"); | |
| 55 application_impl()->ConnectToService(request.Pass(), &files_); | |
| 56 | 54 |
| 57 filesystem::FileSystemClientPtr client; | 55 filesystem::FileSystemClientPtr client; |
| 58 binding_.Bind(GetProxy(&client)); | 56 binding_.Bind(GetProxy(&client)); |
| 59 | 57 |
| 60 filesystem::FileError error = filesystem::FILE_ERROR_FAILED; | 58 filesystem::FileError error = filesystem::FILE_ERROR_FAILED; |
| 61 filesystem::DirectoryPtr directory; | 59 filesystem::DirectoryPtr directory; |
| 62 files_->OpenFileSystem("temp", GetProxy(&directory), client.Pass(), | 60 files_->OpenFileSystem("temp", GetProxy(&directory), client.Pass(), |
| 63 mojo::Capture(&error)); | 61 mojo::Capture(&error)); |
| 64 ASSERT_TRUE(files_.WaitForIncomingResponse()); | 62 ASSERT_TRUE(files_.WaitForIncomingResponse()); |
| 65 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); | 63 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 EXPECT_EQ(SQLITE_OK, rc); | 330 EXPECT_EQ(SQLITE_OK, rc); |
| 333 | 331 |
| 334 rc = file->pMethods->xFileSize(file.get(), &size); | 332 rc = file->pMethods->xFileSize(file.get(), &size); |
| 335 EXPECT_EQ(SQLITE_OK, rc); | 333 EXPECT_EQ(SQLITE_OK, rc); |
| 336 EXPECT_EQ(kCharsToThree, size); | 334 EXPECT_EQ(kCharsToThree, size); |
| 337 | 335 |
| 338 file->pMethods->xClose(file.get()); | 336 file->pMethods->xClose(file.get()); |
| 339 } | 337 } |
| 340 | 338 |
| 341 } // namespace sql | 339 } // namespace sql |
| OLD | NEW |