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" |
11 | 11 |
12 using mojo::Capture; | 12 using mojo::Capture; |
13 | 13 |
14 namespace sql { | 14 namespace sql { |
15 | 15 |
16 SQLTestBase::SQLTestBase() { | 16 SQLTestBase::SQLTestBase() |
| 17 : binding_(this) { |
17 } | 18 } |
18 | 19 |
19 SQLTestBase::~SQLTestBase() { | 20 SQLTestBase::~SQLTestBase() { |
20 } | 21 } |
21 | 22 |
22 base::FilePath SQLTestBase::db_path() { | 23 base::FilePath SQLTestBase::db_path() { |
23 return base::FilePath(FILE_PATH_LITERAL("SQLTest.db")); | 24 return base::FilePath(FILE_PATH_LITERAL("SQLTest.db")); |
24 } | 25 } |
25 | 26 |
26 sql::Connection& SQLTestBase::db() { | 27 sql::Connection& SQLTestBase::db() { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); | 130 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); |
130 } | 131 } |
131 | 132 |
132 void SQLTestBase::SetUp() { | 133 void SQLTestBase::SetUp() { |
133 ApplicationTestBase::SetUp(); | 134 ApplicationTestBase::SetUp(); |
134 | 135 |
135 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 136 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
136 request->url = mojo::String::From("mojo:filesystem"); | 137 request->url = mojo::String::From("mojo:filesystem"); |
137 application_impl()->ConnectToService(request.Pass(), &files_); | 138 application_impl()->ConnectToService(request.Pass(), &files_); |
138 | 139 |
| 140 filesystem::FileSystemClientPtr client; |
| 141 binding_.Bind(GetProxy(&client)); |
| 142 |
139 filesystem::FileError error = filesystem::FILE_ERROR_FAILED; | 143 filesystem::FileError error = filesystem::FILE_ERROR_FAILED; |
140 filesystem::DirectoryPtr directory; | 144 filesystem::DirectoryPtr directory; |
141 files()->OpenFileSystem("temp", GetProxy(&directory), Capture(&error)); | 145 files()->OpenFileSystem("temp", GetProxy(&directory), client.Pass(), |
| 146 Capture(&error)); |
142 ASSERT_TRUE(files().WaitForIncomingResponse()); | 147 ASSERT_TRUE(files().WaitForIncomingResponse()); |
143 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); | 148 ASSERT_EQ(filesystem::FILE_ERROR_OK, error); |
144 | 149 |
145 vfs_.reset(new ScopedMojoFilesystemVFS(directory.Pass())); | 150 vfs_.reset(new ScopedMojoFilesystemVFS(directory.Pass())); |
146 ASSERT_TRUE(db_.Open(db_path())); | 151 ASSERT_TRUE(db_.Open(db_path())); |
147 } | 152 } |
148 | 153 |
149 void SQLTestBase::TearDown() { | 154 void SQLTestBase::TearDown() { |
150 db_.Close(); | 155 db_.Close(); |
151 vfs_.reset(); | 156 vfs_.reset(); |
152 | 157 |
153 ApplicationTestBase::TearDown(); | 158 ApplicationTestBase::TearDown(); |
154 } | 159 } |
155 | 160 |
| 161 void SQLTestBase::OnFileSystemShutdown() { |
| 162 } |
| 163 |
156 } // namespace sql | 164 } // namespace sql |
OLD | NEW |