Chromium Code Reviews| Index: chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc |
| diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc |
| index 81de469a7fa9ea91123e163d9ffc5fd3aa5da7c3..6369e45241e0148060008d87b6ffee7684d139c7 100644 |
| --- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc |
| +++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader_unittest.cc |
| @@ -2,14 +2,17 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <memory> |
| #include <string> |
| #include <utility> |
| #include "base/files/file_util.h" |
| #include "base/files/scoped_temp_dir.h" |
| #include "base/location.h" |
| +#include "base/memory/ptr_util.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h" |
| +#include "components/arc/arc_service_manager.h" |
| #include "components/arc/test/fake_arc_bridge_service.h" |
| #include "components/arc/test/fake_file_system_instance.h" |
| #include "content/public/test/test_browser_thread_bundle.h" |
| @@ -80,16 +83,28 @@ class ArcContentFileSystemFileStreamReaderTest : public testing::Test { |
| base::FilePath path = temp_dir_.GetPath().AppendASCII("bar"); |
| ASSERT_TRUE(base::WriteFile(path, kData, arraysize(kData))); |
| - file_system_.reset(new ArcFileSystemInstanceTestImpl(path)); |
| + file_system_ = base::MakeUnique<ArcFileSystemInstanceTestImpl>(path); |
| - fake_arc_bridge_service_.file_system()->SetInstance(file_system_.get()); |
| + ArcServiceManager::SetArcBridgeServiceForTesting( |
| + base::MakeUnique<FakeArcBridgeService>()); |
| + arc_service_manager_ = base::MakeUnique<ArcServiceManager>(nullptr); |
| + arc_service_manager_->arc_bridge_service()->file_system()->SetInstance( |
| + file_system_.get()); |
| + } |
| + |
| + void TearDown() override { |
| + arc_service_manager_->arc_bridge_service()->file_system()->SetInstance( |
|
hashimoto
2016/12/07 04:15:50
Why do we need to do this?
The same goes for the o
hidehiko
2016/12/08 08:13:21
Hmm, I wanted to emulate the real tear down situat
|
| + nullptr); |
| + arc_service_manager_.reset(); |
|
hashimoto
2016/12/07 04:15:50
Why can't we let the dtor handle resetting these u
hidehiko
2016/12/08 08:13:21
Acknowledged.
|
| + |
| + file_system_.reset(); |
|
Luis Héctor Chávez
2016/12/06 19:14:37
nit: Try adding mojo::edk::test::Shutdown()[1] her
hidehiko
2016/12/08 08:13:21
I haven't investigated yet, but causes a crash err
|
| } |
| private: |
| base::ScopedTempDir temp_dir_; |
| content::TestBrowserThreadBundle thread_bundle_; |
| - FakeArcBridgeService fake_arc_bridge_service_; |
| std::unique_ptr<ArcFileSystemInstanceTestImpl> file_system_; |
| + std::unique_ptr<ArcServiceManager> arc_service_manager_; |
|
hashimoto
2016/12/07 04:15:50
In the other test, arc_service_manager_ is placed
hidehiko
2016/12/08 08:13:21
Done.
|
| DISALLOW_COPY_AND_ASSIGN(ArcContentFileSystemFileStreamReaderTest); |
| }; |