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 subclass around ResourceRequestAllowedNotifier used to expose some | |
| 11 // functionality for testing. | |
| 12 // | |
| 13 // By default, the constructor sets this class to override | |
| 14 // ResourceRequestsAllowed, so its state can be set with SetRequestsAllowed. | |
| 15 // This is meant for higher level tests of services to ensure they adhere to the | |
| 16 // notifications of the ResourceRequestAllowedNotifier. Lower level tests can | |
| 17 // disable this by calling SetRequestsAllowedOverride with the value they want | |
| 18 // it to return. | |
| 19 class TestRequestAllowedNotifier : public ResourceRequestAllowedNotifier { | |
| 20 public: | |
| 21 TestRequestAllowedNotifier(); | |
| 22 virtual ~TestRequestAllowedNotifier(); | |
| 23 | |
| 24 #if defined(OS_CHROMEOS) | |
| 25 void SetEulaAccepted(bool accepted); | |
| 26 #endif | |
| 27 | |
| 28 // Makes ResourceRequestsAllowed return |allowed| when it is called. | |
| 29 void SetRequestsAllowedOverride(bool allowed); | |
| 30 | |
| 31 // Notify observers that requests are allowed. | |
|
Alexei Svitkine (slow)
2012/09/24 15:59:36
Expand comment to say that this will only work if
SteveT
2012/09/24 18:04:27
Done.
| |
| 32 void NotifyObservers(); | |
| 33 | |
| 34 protected: | |
| 35 #if defined(OS_CHROMEOS) | |
| 36 virtual bool IsEulaAccepted() OVERRIDE; | |
| 37 #endif | |
| 38 | |
| 39 virtual bool ResourceRequestsAllowed() OVERRIDE; | |
| 40 | |
| 41 private: | |
| 42 bool requests_allowed_; | |
|
Alexei Svitkine (slow)
2012/09/24 15:59:36
Nit: Move this below "override_requests_allowed_"
SteveT
2012/09/24 18:04:27
Done, but this makes the constructor implementatio
| |
| 43 #if defined(OS_CHROMEOS) | |
| 44 bool eula_accepted_; | |
| 45 #endif | |
| 46 bool override_requests_allowed_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(TestRequestAllowedNotifier); | |
| 49 }; | |
| 50 | |
| 51 #endif // CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_T EST_UTIL_H_ | |
| OLD | NEW |