Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / components / web_resource / resource_request_allowed_notifier_test_util.h
blobefae951abbeb54bf17458f099be412a6800077dd
1 // Copyright 2013 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.
5 #ifndef COMPONENTS_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_TEST_UTIL_H_
6 #define COMPONENTS_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_TEST_UTIL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/web_resource/resource_request_allowed_notifier.h"
11 class PrefService;
13 namespace web_resource {
15 // A subclass of ResourceRequestAllowedNotifier used to expose some
16 // functionality for testing.
18 // By default, the constructor sets this class to override
19 // ResourceRequestsAllowed, so its state can be set with SetRequestsAllowed.
20 // This is meant for higher level tests of services to ensure they adhere to the
21 // notifications of the ResourceRequestAllowedNotifier. Lower level tests can
22 // disable this by calling SetRequestsAllowedOverride with the value they want
23 // it to return.
24 class TestRequestAllowedNotifier : public ResourceRequestAllowedNotifier {
25 public:
26 explicit TestRequestAllowedNotifier(PrefService* local_state);
27 ~TestRequestAllowedNotifier() override;
29 // A version of |Init()| that accepts a custom EulaAcceptedNotifier.
30 void InitWithEulaAcceptNotifier(
31 Observer* observer,
32 scoped_ptr<EulaAcceptedNotifier> eula_notifier);
34 // Makes ResourceRequestsAllowed return |allowed| when it is called.
35 void SetRequestsAllowedOverride(bool allowed);
37 // Notify observers that requests are allowed. This will only work if
38 // the observer is expecting a notification.
39 void NotifyObserver();
41 // ResourceRequestAllowedNotifier overrides:
42 State GetResourceRequestsAllowedState() override;
43 EulaAcceptedNotifier* CreateEulaNotifier() override;
45 private:
46 scoped_ptr<EulaAcceptedNotifier> test_eula_notifier_;
47 bool override_requests_allowed_;
48 bool requests_allowed_;
50 DISALLOW_COPY_AND_ASSIGN(TestRequestAllowedNotifier);
53 } // namespace web_resource
55 #endif // COMPONENTS_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_TEST_UTIL_H_