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 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE
_FILTER_TEST_UTILS_H_ |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE
_FILTER_TEST_UTILS_H_ |
| 7 |
| 8 #include "base/bind.h" |
| 9 #include "base/callback_forward.h" |
| 10 #include "base/macros.h" |
| 11 #include "components/subresource_filter/core/common/activation_state.h" |
| 12 |
| 13 namespace subresource_filter { |
| 14 namespace testing { |
| 15 |
| 16 // This test class is intended to be used in conjunction with an |
| 17 // AsyncDocumentSubresourceFilter, and can be used to expect a certain |
| 18 // activation result occured. |
| 19 class TestActivationStateCallbackReceiver { |
| 20 public: |
| 21 TestActivationStateCallbackReceiver() = default; |
| 22 |
| 23 base::Callback<void(ActivationState)> GetCallback(); |
| 24 void ExpectReceivedOnce(const ActivationState& expected_state) const; |
| 25 |
| 26 private: |
| 27 void Callback(ActivationState activation_state); |
| 28 |
| 29 ActivationState last_activation_state_; |
| 30 int callback_count_ = 0; |
| 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(TestActivationStateCallbackReceiver); |
| 33 }; |
| 34 |
| 35 } // namespace testing |
| 36 } // namespace subresource_filter |
| 37 |
| 38 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOU
RCE_FILTER_TEST_UTILS_H_ |
OLD | NEW |