Chromium Code Reviews| Index: components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h |
| diff --git a/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h b/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0058f4ad5c06f0f46fe4ef207ecdfd8697f68b04 |
| --- /dev/null |
| +++ b/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h |
| @@ -0,0 +1,38 @@ |
| +// 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 COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE_FILTER_TEST_UTILS_H_ |
| +#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE_FILTER_TEST_UTILS_H_ |
| + |
| +#include "components/subresource_filter/content/browser/async_document_subresource_filter.h" |
|
engedy
2017/03/10 10:56:57
nit: Include activation_state.h instead and get ri
Charlie Harrison
2017/03/10 17:12:47
Done.
|
| + |
| +#include "base/bind.h" |
|
engedy
2017/03/10 10:56:58
nit: callback_forward.h
Charlie Harrison
2017/03/10 17:12:47
Done.
|
| +#include "base/macros.h" |
| + |
| +namespace subresource_filter { |
| +namespace testing { |
| + |
| +// This test class is intended to be used in conjunction with an |
| +// AsyncDocumentSubresourceFilter, and can be used to expect a certain |
| +// activation result occured. |
| +class TestActivationStateCallbackReceiver { |
| + public: |
| + TestActivationStateCallbackReceiver() = default; |
| + |
| + base::Callback<void(ActivationState)> GetCallback(); |
| + void ExpectReceivedOnce(const ActivationState& expected_state) const; |
| + |
| + private: |
| + void Callback(ActivationState activation_state); |
| + |
| + ActivationState last_activation_state_; |
| + int callback_count_ = 0; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestActivationStateCallbackReceiver); |
| +}; |
| + |
| +} // namespace testing |
| +} // namespace subresource_filter |
| + |
| +#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE_FILTER_TEST_UTILS_H_ |