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 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier_te st_util.h" | |
| 6 | |
| 7 TestRequestAllowedNotifier::TestRequestAllowedNotifier() | |
| 8 : requests_allowed_(true), | |
| 9 #if defined(OS_CHROMEOS) | |
| 10 eula_accepted_(false), | |
| 11 #endif | |
| 12 override_requests_allowed_(false) { | |
| 13 } | |
| 14 | |
| 15 TestRequestAllowedNotifier::~TestRequestAllowedNotifier() { | |
| 16 } | |
| 17 | |
| 18 #if defined(OS_CHROMEOS) | |
| 19 void TestRequestAllowedNotifier::SetEulaAccepted(bool accepted) { | |
| 20 eula_accepted_ = accepted; | |
| 21 } | |
| 22 #endif | |
| 23 | |
| 24 void TestRequestAllowedNotifier::SetRequestsAllowedOverride(bool allowed) { | |
| 25 override_requests_allowed_ = true; | |
| 26 requests_allowed_ = allowed; | |
| 27 } | |
| 28 | |
| 29 void TestRequestAllowedNotifier::NotifyObservers() { | |
| 30 // Force the allowed state to true. This forces MaybeNotifyObserver to always | |
| 31 // notify observers. | |
|
Alexei Svitkine (slow)
2012/09/24 15:59:36
Nit: Expand comment to say that MaybeNotifyObserve
SteveT
2012/09/24 18:04:27
Done.
| |
| 32 override_requests_allowed_ = true; | |
| 33 requests_allowed_ = true; | |
| 34 MaybeNotifyObserver(); | |
| 35 } | |
| 36 | |
| 37 #if defined(OS_CHROMEOS) | |
| 38 bool TestRequestAllowedNotifier::IsEulaAccepted() { | |
| 39 return eula_accepted_; | |
| 40 } | |
| 41 #endif | |
| 42 | |
| 43 bool TestRequestAllowedNotifier::ResourceRequestsAllowed() { | |
| 44 SetObserverRequestedPermissionForTesting(true); | |
| 45 if (override_requests_allowed_) | |
| 46 return requests_allowed_; | |
| 47 return ResourceRequestAllowedNotifier::ResourceRequestsAllowed(); | |
| 48 } | |
| OLD | NEW |