Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/test/test_discardable_memory_allocator.h" | |
| 6 #include "components/printing/service/pdf_compositor_service.h" | |
| 7 #include "services/service_manager/public/c/main.h" | |
| 8 #include "services/service_manager/public/cpp/service_runner.h" | |
| 9 | |
| 10 // In order to test PdfCompositorService, this class overrides and | |
| 11 // uses a test discardable memory allocator. | |
| 12 class PdfCompositorTestService : public printing::PdfCompositorService { | |
| 13 public: | |
| 14 explicit PdfCompositorTestService(const std::string& creator) | |
| 15 : PdfCompositorService(creator) {} | |
| 16 | |
| 17 // PdfCompositorService: | |
| 18 void PrepareToStart() override; | |
|
Lei Zhang
2017/06/02 21:54:09
Need a dtor that overrides.
Wei Li
2017/07/07 21:23:57
Done.
| |
| 19 }; | |
| 20 | |
| 21 void PdfCompositorTestService::PrepareToStart() { | |
| 22 base::TestDiscardableMemoryAllocator mem_allocator; | |
| 23 base::DiscardableMemoryAllocator::SetInstance(&mem_allocator); | |
| 24 } | |
| 25 | |
| 26 MojoResult ServiceMain(MojoHandle service_request_handle) { | |
| 27 service_manager::ServiceRunner runner( | |
| 28 new PdfCompositorTestService("pdf_compositor_service_unittest")); | |
| 29 return runner.Run(service_request_handle); | |
| 30 } | |
| OLD | NEW |