Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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 CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_TEST _UTIL_H_ | |
| 6 #define CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_TEST _UTIL_H_ | |
| 7 | |
| 8 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier.h" | |
| 9 | |
| 10 // A light wrapper class around ResourceRequestAllowedNotifier used to expose | |
|
Alexei Svitkine (slow)
2012/09/21 15:52:05
I don't think "wrapper" is the right terminology h
SteveT
2012/09/24 15:38:38
Done.
| |
| 11 // some functionality for testing. | |
|
Alexei Svitkine (slow)
2012/09/21 15:52:05
Nit: Add an empty line within the comment here.
SteveT
2012/09/24 15:38:38
Done.
| |
| 12 // By default, the constructor sets this class to override | |
| 13 // ResourceRequestsAllowed, so its state can be set with SetRequestsAllowed. | |
| 14 // This is meant for higher level tests of services to ensure they adhere to the | |
| 15 // notifications of the ResourceRequestAllowedNotifier. Lower level tests can | |
| 16 // disable this by calling OverrideRequestsAllowed(false). | |
| 17 class TestRequestAllowedNotifier : public ResourceRequestAllowedNotifier { | |
| 18 public: | |
| 19 TestRequestAllowedNotifier(); | |
| 20 virtual ~TestRequestAllowedNotifier(); | |
| 21 | |
| 22 #if defined(OS_CHROMEOS) | |
| 23 void SetEulaAccepted(bool accepted); | |
| 24 #endif | |
| 25 | |
| 26 void SetRequestsAllowed(bool allowed); | |
| 27 | |
| 28 // If |override| is false, ResourceRequestsAllowed will call the base class | |
| 29 // implementation. Otherwise, it will return |requests_allowed_|. | |
| 30 void OverrideRequestsAllowed(bool override); | |
|
Alexei Svitkine (slow)
2012/09/21 15:52:05
Could this be simplified and merged with SetReques
SteveT
2012/09/24 15:38:38
That simplified things a bit, yeah. Done.
| |
| 31 | |
| 32 // Notify observers that requests are allowed. | |
| 33 void NotifyObservers(); | |
| 34 | |
| 35 protected: | |
| 36 #if defined(OS_CHROMEOS) | |
| 37 virtual bool IsEulaAccepted() OVERRIDE; | |
| 38 #endif | |
| 39 | |
| 40 virtual bool ResourceRequestsAllowed() OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 bool requests_allowed_; | |
| 44 #if defined(OS_CHROMEOS) | |
| 45 bool eula_accepted_; | |
| 46 #endif | |
| 47 bool override_requests_allowed_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(TestRequestAllowedNotifier); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_T EST_UTIL_H_ | |
| OLD | NEW |