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

Side by Side 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: one more asvit nit Created 8 years, 2 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 unified diff | Download patch
OLDNEW
(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 #if defined(OS_CHROMEOS)
9 needs_eula_acceptance_(true),
10 #endif
11 override_requests_allowed_(false),
12 requests_allowed_(true) {
13 }
14
15 TestRequestAllowedNotifier::~TestRequestAllowedNotifier() {
16 }
17
18 #if defined(OS_CHROMEOS)
19 void TestRequestAllowedNotifier::SetNeedsEulaAcceptance(bool needs_acceptance) {
20 needs_eula_acceptance_ = needs_acceptance;
21 }
22 #endif
23
24 void TestRequestAllowedNotifier::SetRequestsAllowedOverride(bool allowed) {
25 override_requests_allowed_ = true;
26 requests_allowed_ = allowed;
27 }
28
29 void TestRequestAllowedNotifier::NotifyObserver() {
30 // Force the allowed state to true. This forces MaybeNotifyObserver to always
31 // notify observers, as MaybeNotifyObserver checks ResourceRequestsAllowed.
32 override_requests_allowed_ = true;
33 requests_allowed_ = true;
34 MaybeNotifyObserver();
35 }
36
37 bool TestRequestAllowedNotifier::ResourceRequestsAllowed() {
38 // Call ResourceRequestAllowedNotifier::ResourceRequestsAllowed once to
39 // simulate that the user requested permission. Only return that result if
40 // the override flag was set.
41 bool requests_allowed =
42 ResourceRequestAllowedNotifier::ResourceRequestsAllowed();
43 if (override_requests_allowed_)
44 return requests_allowed_;
45 return requests_allowed;
46 }
47
48 #if defined(OS_CHROMEOS)
49 bool TestRequestAllowedNotifier::NeedsEulaAcceptance() {
50 return needs_eula_acceptance_;
51 }
52 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698