| 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 "services/files/files_test_base.h" | 5 #include "services/files/files_test_base.h" |
| 6 | 6 |
| 7 #include "mojo/public/cpp/application/application_impl.h" | 7 #include "mojo/public/cpp/application/application_impl.h" |
| 8 #include "mojo/public/cpp/application/connect.h" |
| 8 #include "mojo/services/files/interfaces/files.mojom.h" | 9 #include "mojo/services/files/interfaces/files.mojom.h" |
| 9 #include "mojo/services/files/interfaces/types.mojom.h" | 10 #include "mojo/services/files/interfaces/types.mojom.h" |
| 10 | 11 |
| 11 namespace mojo { | 12 namespace mojo { |
| 12 namespace files { | 13 namespace files { |
| 13 | 14 |
| 14 FilesTestBase::FilesTestBase() {} | 15 FilesTestBase::FilesTestBase() {} |
| 15 | 16 |
| 16 FilesTestBase::~FilesTestBase() {} | 17 FilesTestBase::~FilesTestBase() {} |
| 17 | 18 |
| 18 void FilesTestBase::SetUp() { | 19 void FilesTestBase::SetUp() { |
| 19 test::ApplicationTestBase::SetUp(); | 20 test::ApplicationTestBase::SetUp(); |
| 20 // TODO(vtl): Fix this. | 21 ConnectToService(application_impl()->shell(), "mojo:files", |
| 21 FilesPtr files_async; | 22 GetSynchronousProxy(&files_)); |
| 22 application_impl()->ConnectToServiceDeprecated("mojo:files", &files_async); | |
| 23 files_ = | |
| 24 SynchronousInterfacePtr<Files>::Create(files_async.PassInterfaceHandle()); | |
| 25 } | 23 } |
| 26 | 24 |
| 27 void FilesTestBase::GetTemporaryRoot( | 25 void FilesTestBase::GetTemporaryRoot( |
| 28 SynchronousInterfacePtr<Directory>* directory) { | 26 SynchronousInterfacePtr<Directory>* directory) { |
| 29 Error error = Error::INTERNAL; | 27 Error error = Error::INTERNAL; |
| 30 ASSERT_TRUE( | 28 ASSERT_TRUE( |
| 31 files_->OpenFileSystem(nullptr, GetSynchronousProxy(directory), &error)); | 29 files_->OpenFileSystem(nullptr, GetSynchronousProxy(directory), &error)); |
| 32 ASSERT_EQ(Error::OK, error); | 30 ASSERT_EQ(Error::OK, error); |
| 33 } | 31 } |
| 34 | 32 |
| 35 void FilesTestBase::GetAppPersistentCacheRoot( | 33 void FilesTestBase::GetAppPersistentCacheRoot( |
| 36 SynchronousInterfacePtr<Directory>* directory) { | 34 SynchronousInterfacePtr<Directory>* directory) { |
| 37 Error error = Error::INTERNAL; | 35 Error error = Error::INTERNAL; |
| 38 ASSERT_TRUE(files_->OpenFileSystem("app_persistent_cache", | 36 ASSERT_TRUE(files_->OpenFileSystem("app_persistent_cache", |
| 39 GetSynchronousProxy(directory), &error)); | 37 GetSynchronousProxy(directory), &error)); |
| 40 ASSERT_EQ(Error::OK, error); | 38 ASSERT_EQ(Error::OK, error); |
| 41 } | 39 } |
| 42 | 40 |
| 43 } // namespace files | 41 } // namespace files |
| 44 } // namespace mojo | 42 } // namespace mojo |
| OLD | NEW |