Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1733)

Unified Diff: chrome/browser/metrics/variations/resource_request_allowed_notifier_test_util.cc

Issue 10917120: Activate the VariationsService for ChromeOS and ensure that it does not ping the server until the E… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nonchromeos fixes Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/variations/resource_request_allowed_notifier_test_util.cc
diff --git a/chrome/browser/metrics/variations/resource_request_allowed_notifier_test_util.cc b/chrome/browser/metrics/variations/resource_request_allowed_notifier_test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a423b0b2fcda2102170c0ee3ee0316974d9be4b5
--- /dev/null
+++ b/chrome/browser/metrics/variations/resource_request_allowed_notifier_test_util.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/metrics/variations/resource_request_allowed_notifier_test_util.h"
+
+TestRequestAllowedNotifier::TestRequestAllowedNotifier()
+ : requests_allowed_(true),
+#if defined(OS_CHROMEOS)
+ eula_accepted_(false),
+#endif
+ override_requests_allowed_(false) {
+}
+
+TestRequestAllowedNotifier::~TestRequestAllowedNotifier() {
+}
+
+#if defined(OS_CHROMEOS)
+void TestRequestAllowedNotifier::SetEulaAccepted(bool accepted) {
+ eula_accepted_ = accepted;
+}
+#endif
+
+void TestRequestAllowedNotifier::SetRequestsAllowedOverride(bool allowed) {
+ override_requests_allowed_ = true;
+ requests_allowed_ = allowed;
+}
+
+void TestRequestAllowedNotifier::NotifyObservers() {
+ // Force the allowed state to true. This forces MaybeNotifyObserver to always
+ // 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.
+ override_requests_allowed_ = true;
+ requests_allowed_ = true;
+ MaybeNotifyObserver();
+}
+
+#if defined(OS_CHROMEOS)
+bool TestRequestAllowedNotifier::IsEulaAccepted() {
+ return eula_accepted_;
+}
+#endif
+
+bool TestRequestAllowedNotifier::ResourceRequestsAllowed() {
+ SetObserverRequestedPermissionForTesting(true);
+ if (override_requests_allowed_)
+ return requests_allowed_;
+ return ResourceRequestAllowedNotifier::ResourceRequestsAllowed();
+}

Powered by Google App Engine
This is Rietveld 408576698