| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/shell/public/cpp/service_test.h" | 5 #include "services/shell/public/cpp/service_test.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "services/shell/background/background_shell.h" | 10 #include "services/shell/background/background_shell.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 background_shell_.reset(new shell::BackgroundShell); | 54 background_shell_.reset(new shell::BackgroundShell); |
| 55 background_shell_->Init(nullptr); | 55 background_shell_->Init(nullptr); |
| 56 | 56 |
| 57 // Create the shell connection. We don't proceed until we get our | 57 // Create the shell connection. We don't proceed until we get our |
| 58 // Service's OnStart() method is called. | 58 // Service's OnStart() method is called. |
| 59 base::RunLoop run_loop; | 59 base::RunLoop run_loop; |
| 60 base::MessageLoop::ScopedNestableTaskAllower allow( | 60 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 61 base::MessageLoop::current()); | 61 base::MessageLoop::current()); |
| 62 initialize_called_ = run_loop.QuitClosure(); | 62 initialize_called_ = run_loop.QuitClosure(); |
| 63 | 63 |
| 64 service_->set_context(base::WrapUnique(new ServiceContext( | 64 service_->set_context(base::MakeUnique<ServiceContext>( |
| 65 service_.get(), | 65 service_.get(), background_shell_->CreateServiceRequest(test_name_))); |
| 66 background_shell_->CreateServiceRequest(test_name_)))); | |
| 67 connector_ = service_->connector(); | 66 connector_ = service_->connector(); |
| 68 | 67 |
| 69 run_loop.Run(); | 68 run_loop.Run(); |
| 70 } | 69 } |
| 71 | 70 |
| 72 void ServiceTest::TearDown() { | 71 void ServiceTest::TearDown() { |
| 73 background_shell_.reset(); | 72 background_shell_.reset(); |
| 74 message_loop_.reset(); | 73 message_loop_.reset(); |
| 75 service_.reset(); | 74 service_.reset(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 } // namespace test | 77 } // namespace test |
| 79 } // namespace shell | 78 } // namespace shell |
| OLD | NEW |