| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/test/scoped_task_environment.h" | 8 #include "base/test/scoped_task_environment.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "content/network/network_context.h" | 10 #include "content/network/network_context.h" |
| 11 #include "content/network/network_service.h" | 11 #include "content/network/network_service_impl.h" |
| 12 #include "content/public/common/network_service.mojom.h" | 12 #include "content/public/common/network_service.mojom.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class NetworkServiceTest : public testing::Test { | 19 class NetworkServiceTest : public testing::Test { |
| 20 public: | 20 public: |
| 21 NetworkServiceTest() | 21 NetworkServiceTest() |
| 22 : scoped_task_environment_( | 22 : scoped_task_environment_( |
| 23 base::test::ScopedTaskEnvironment::MainThreadType::IO), | 23 base::test::ScopedTaskEnvironment::MainThreadType::IO), |
| 24 service_(NetworkService::CreateForTesting()) {} | 24 service_(NetworkServiceImpl::CreateForTesting()) {} |
| 25 ~NetworkServiceTest() override {} | 25 ~NetworkServiceTest() override {} |
| 26 | 26 |
| 27 NetworkService* service() const { return service_.get(); } | 27 NetworkService* service() const { return service_.get(); } |
| 28 | 28 |
| 29 void DestroyService() { service_.reset(); } | 29 void DestroyService() { service_.reset(); } |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 base::test::ScopedTaskEnvironment scoped_task_environment_; | 32 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 33 std::unique_ptr<NetworkService> service_; | 33 std::unique_ptr<NetworkService> service_; |
| 34 }; | 34 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 62 DestroyService(); | 62 DestroyService(); |
| 63 | 63 |
| 64 // Destroying the service should destroy the context, causing a connection | 64 // Destroying the service should destroy the context, causing a connection |
| 65 // error. | 65 // error. |
| 66 run_loop.Run(); | 66 run_loop.Run(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace | 69 } // namespace |
| 70 | 70 |
| 71 } // namespace content | 71 } // namespace content |
| OLD | NEW |