Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: components/printing/service/service_main.cc

Issue 2919823004: Add error handling and unit test for pdf compositor service (Closed)
Patch Set: add missing header Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698