Chromium Code Reviews| Index: extensions/test/test_content_browser_client.cc |
| diff --git a/extensions/test/test_content_browser_client.cc b/extensions/test/test_content_browser_client.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4acb04dbba27a6d2bda15d3cbc1a7bdc088244a6 |
| --- /dev/null |
| +++ b/extensions/test/test_content_browser_client.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "extensions/test/test_content_browser_client.h" |
| + |
| +#include "base/files/file_util.h" |
| +#include "base/json/json_reader.h" |
| +#include "base/path_service.h" |
| +#include "base/values.h" |
| +#include "content/public/common/service_names.mojom.h" |
| +#include "extensions/common/extension_paths.h" |
| + |
| +namespace extensions { |
| + |
| +TestContentBrowserClient::TestContentBrowserClient() = default; |
| + |
| +TestContentBrowserClient::~TestContentBrowserClient() = default; |
| + |
| +std::unique_ptr<base::Value> |
| +TestContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { |
| + if (name != content::mojom::kUtilityServiceName) { |
| + return nullptr; |
| + } |
| + |
| + base::FilePath extensions_test_data; |
| + if (!base::PathService::Get(DIR_TEST_DATA, &extensions_test_data)) { |
| + 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.
|
| + } |
| + |
| + std::string content; |
| + if (!base::ReadFileToString( |
| + extensions_test_data.AppendASCII( |
| + "extensions_test_content_utility_manifest_overlay.json"), |
| + &content)) { |
| + NOTREACHED(); |
| + } |
| + |
| + return base::JSONReader::Read(content); |
| +} |
| + |
| +} // namespace extensions |