| 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 "components/filesystem/files_test_base.h" | 5 #include "components/filesystem/files_test_base.h" |
| 6 | 6 |
| 7 #include "components/filesystem/public/interfaces/directory.mojom.h" | 7 #include "components/filesystem/public/interfaces/directory.mojom.h" |
| 8 #include "components/filesystem/public/interfaces/types.mojom.h" | 8 #include "components/filesystem/public/interfaces/types.mojom.h" |
| 9 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
| 10 #include "mojo/util/capture_util.h" | 10 #include "mojo/util/capture_util.h" |
| 11 | 11 |
| 12 namespace filesystem { | 12 namespace filesystem { |
| 13 | 13 |
| 14 FilesTestBase::FilesTestBase() : binding_(this) { | 14 FilesTestBase::FilesTestBase() : binding_(this) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 FilesTestBase::~FilesTestBase() { | 17 FilesTestBase::~FilesTestBase() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 void FilesTestBase::SetUp() { | 20 void FilesTestBase::SetUp() { |
| 21 ApplicationTestBase::SetUp(); | 21 ApplicationTestBase::SetUp(); |
| 22 | 22 application_impl()->ConnectToService("mojo:filesystem", &files_); |
| 23 mojo::URLRequestPtr request(mojo::URLRequest::New()); | |
| 24 request->url = mojo::String::From("mojo:filesystem"); | |
| 25 application_impl()->ConnectToService(request.Pass(), &files_); | |
| 26 } | 23 } |
| 27 | 24 |
| 28 void FilesTestBase::OnFileSystemShutdown() { | 25 void FilesTestBase::OnFileSystemShutdown() { |
| 29 } | 26 } |
| 30 | 27 |
| 31 void FilesTestBase::GetTemporaryRoot(DirectoryPtr* directory) { | 28 void FilesTestBase::GetTemporaryRoot(DirectoryPtr* directory) { |
| 32 filesystem::FileSystemClientPtr client; | 29 filesystem::FileSystemClientPtr client; |
| 33 binding_.Bind(GetProxy(&client)); | 30 binding_.Bind(GetProxy(&client)); |
| 34 | 31 |
| 35 FileError error = FILE_ERROR_FAILED; | 32 FileError error = FILE_ERROR_FAILED; |
| 36 files()->OpenFileSystem("temp", GetProxy(directory), client.Pass(), | 33 files()->OpenFileSystem("temp", GetProxy(directory), client.Pass(), |
| 37 mojo::Capture(&error)); | 34 mojo::Capture(&error)); |
| 38 ASSERT_TRUE(files().WaitForIncomingResponse()); | 35 ASSERT_TRUE(files().WaitForIncomingResponse()); |
| 39 ASSERT_EQ(FILE_ERROR_OK, error); | 36 ASSERT_EQ(FILE_ERROR_OK, error); |
| 40 } | 37 } |
| 41 | 38 |
| 42 } // namespace filesystem | 39 } // namespace filesystem |
| OLD | NEW |