| 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 "sql/mojo/sql_test_base.h" | 5 #include "sql/mojo/sql_test_base.h" |
| 6 | 6 |
| 7 #include "mojo/application/public/cpp/application_impl.h" | 7 #include "mojo/application/public/cpp/application_impl.h" |
| 8 #include "mojo/util/capture_util.h" | 8 #include "mojo/util/capture_util.h" |
| 9 #include "sql/mojo/mojo_vfs.h" | 9 #include "sql/mojo/mojo_vfs.h" |
| 10 #include "sql/test/test_helpers.h" | 10 #include "sql/test/test_helpers.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 file_ptr->Truncate(0, Capture(&error)); | 128 file_ptr->Truncate(0, Capture(&error)); |
| 129 file_ptr.WaitForIncomingResponse(); | 129 file_ptr.WaitForIncomingResponse(); |
| 130 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); | 130 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void SQLTestBase::SetUp() { | 133 void SQLTestBase::SetUp() { |
| 134 ApplicationTestBase::SetUp(); | 134 ApplicationTestBase::SetUp(); |
| 135 | 135 |
| 136 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 136 application_impl()->ConnectToService("mojo:filesystem", &files_); |
| 137 request->url = mojo::String::From("mojo:filesystem"); | |
| 138 application_impl()->ConnectToService(request.Pass(), &files_); | |
| 139 | 137 |
| 140 filesystem::FileSystemClientPtr client; | 138 filesystem::FileSystemClientPtr client; |
| 141 binding_.Bind(GetProxy(&client)); | 139 binding_.Bind(GetProxy(&client)); |
| 142 | 140 |
| 143 filesystem::FileError error = filesystem::FILE_ERROR_FAILED; | 141 filesystem::FileError error = filesystem::FILE_ERROR_FAILED; |
| 144 filesystem::DirectoryPtr directory; | 142 filesystem::DirectoryPtr directory; |
| 145 files()->OpenFileSystem("temp", GetProxy(&directory), client.Pass(), | 143 files()->OpenFileSystem("temp", GetProxy(&directory), client.Pass(), |
| 146 Capture(&error)); | 144 Capture(&error)); |
| 147 ASSERT_TRUE(files().WaitForIncomingResponse()); | 145 ASSERT_TRUE(files().WaitForIncomingResponse()); |
| 148 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); | 146 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); |
| 149 | 147 |
| 150 vfs_.reset(new ScopedMojoFilesystemVFS(directory.Pass())); | 148 vfs_.reset(new ScopedMojoFilesystemVFS(directory.Pass())); |
| 151 ASSERT_TRUE(db_.Open(db_path())); | 149 ASSERT_TRUE(db_.Open(db_path())); |
| 152 } | 150 } |
| 153 | 151 |
| 154 void SQLTestBase::TearDown() { | 152 void SQLTestBase::TearDown() { |
| 155 db_.Close(); | 153 db_.Close(); |
| 156 vfs_.reset(); | 154 vfs_.reset(); |
| 157 | 155 |
| 158 ApplicationTestBase::TearDown(); | 156 ApplicationTestBase::TearDown(); |
| 159 } | 157 } |
| 160 | 158 |
| 161 void SQLTestBase::OnFileSystemShutdown() { | 159 void SQLTestBase::OnFileSystemShutdown() { |
| 162 } | 160 } |
| 163 | 161 |
| 164 } // namespace sql | 162 } // namespace sql |
| OLD | NEW |