Chromium Code Reviews| Index: chrome/browser/extensions/api/feedback_private/single_log_source_factory.h |
| diff --git a/chrome/browser/extensions/api/feedback_private/single_log_source_factory.h b/chrome/browser/extensions/api/feedback_private/single_log_source_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a3431abf7fb4751da2551aff67a344136c5bb302 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/feedback_private/single_log_source_factory.h |
| @@ -0,0 +1,34 @@ |
| +// 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. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY_H_ |
| + |
| +#include "base/callback.h" |
| +#include "chrome/browser/chromeos/system_logs/single_log_source.h" |
| + |
| +namespace extensions { |
| + |
| +// Provides a way to override the creation of a new SingleLogSource during |
| +// testing. |
| +class SingleLogSourceFactory { |
| + public: |
| + using CreateCallback = base::Callback<system_logs::SingleLogSource*( |
| + system_logs::SingleLogSource::SupportedSource)>; |
| + |
| + // Returns a SingleLogSource with source type of |type|. The caller must take |
| + // ownership of the returned object. |
|
tbarzic
2017/05/22 23:02:55
return unique_ptr
Simon Que
2017/05/23 20:01:20
Done.
|
| + static system_logs::SingleLogSource* CreateSingleLogSource( |
| + system_logs::SingleLogSource::SupportedSource type); |
| + |
| + // Pass in a callback that gets executed instead of the default behavior of |
| + // CreateSingleLogSource. Does not take ownership of |callback|. When done |
| + // testing, call this function again with |callback|=nullptr to restore the |
| + // default behavior. |
| + static void InitForTesting(const CreateCallback* callback); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY_H_ |