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 "extensions/test/test_content_browser_client.h" | |
6 | |
7 #include "base/files/file_util.h" | |
8 #include "base/json/json_reader.h" | |
9 #include "base/path_service.h" | |
10 #include "base/values.h" | |
11 #include "content/public/common/service_names.mojom.h" | |
12 #include "extensions/common/extension_paths.h" | |
13 | |
14 namespace extensions { | |
15 | |
16 TestContentBrowserClient::TestContentBrowserClient() = default; | |
17 | |
18 TestContentBrowserClient::~TestContentBrowserClient() = default; | |
19 | |
20 std::unique_ptr<base::Value> | |
21 TestContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { | |
22 if (name != content::mojom::kUtilityServiceName) { | |
23 return nullptr; | |
24 } | |
25 | |
26 base::FilePath extensions_test_data; | |
27 if (!base::PathService::Get(DIR_TEST_DATA, &extensions_test_data)) { | |
28 NOTREACHED(); | |
Devlin
2017/02/14 17:24:59
nit: Given this is test-only code, these may as we
Noel Gordon
2017/02/15 17:28:09
Done.
| |
29 } | |
30 | |
31 std::string content; | |
32 if (!base::ReadFileToString( | |
33 extensions_test_data.AppendASCII( | |
34 "extensions_test_content_utility_manifest_overlay.json"), | |
35 &content)) { | |
36 NOTREACHED(); | |
37 } | |
38 | |
39 return base::JSONReader::Read(content); | |
40 } | |
41 | |
42 } // namespace extensions | |
OLD | NEW |