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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc

Issue 577343002: Adds UMA to measure when the data reduction proxy via header is missing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings_ test_utils.h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings_ test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/scoped_user_pref_update.h" 11 #include "base/prefs/scoped_user_pref_update.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers_te st_utils.h"
13 #include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names .h" 14 #include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names .h"
14 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h " 15 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h "
15 16
16 using testing::_; 17 using testing::_;
17 using testing::AnyNumber; 18 using testing::AnyNumber;
18 using testing::Return; 19 using testing::Return;
19 20
20 namespace { 21 namespace {
21 22
22 const char kProbeURLWithOKResponse[] = "http://ok.org/"; 23 const char kProbeURLWithOKResponse[] = "http://ok.org/";
23 24
24 const char kProxy[] = "proxy"; 25 const char kProxy[] = "proxy";
25 26
26 } // namespace 27 } // namespace
27 28
28 namespace data_reduction_proxy { 29 namespace data_reduction_proxy {
29 30
30 // Transform "normal"-looking headers (\n-separated) to the appropriate
31 // input format for ParseRawHeaders (\0-separated).
32 void HeadersToRaw(std::string* headers) {
33 std::replace(headers->begin(), headers->end(), '\n', '\0');
34 if (!headers->empty())
35 *headers += '\0';
36 }
37
38 ProbeURLFetchResult FetchResult(bool enabled, bool success) { 31 ProbeURLFetchResult FetchResult(bool enabled, bool success) {
39 if (enabled) { 32 if (enabled) {
40 if (success) 33 if (success)
41 return SUCCEEDED_PROXY_ALREADY_ENABLED; 34 return SUCCEEDED_PROXY_ALREADY_ENABLED;
42 return FAILED_PROXY_DISABLED; 35 return FAILED_PROXY_DISABLED;
43 } 36 }
44 if (success) 37 if (success)
45 return SUCCEEDED_PROXY_ENABLED; 38 return SUCCEEDED_PROXY_ENABLED;
46 return FAILED_PROXY_ALREADY_DISABLED; 39 return FAILED_PROXY_ALREADY_DISABLED;
47 } 40 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 base::Bind(&DataReductionProxySettingsTestBase:: 283 base::Bind(&DataReductionProxySettingsTestBase::
291 RegisterSyntheticFieldTrialCallback, 284 RegisterSyntheticFieldTrialCallback,
292 base::Unretained(this))); 285 base::Unretained(this)));
293 286
294 base::MessageLoop::current()->RunUntilIdle(); 287 base::MessageLoop::current()->RunUntilIdle();
295 CheckProxyConfigs(enabled_at_startup, false, false); 288 CheckProxyConfigs(enabled_at_startup, false, false);
296 EXPECT_EQ(enabled_at_startup, proxy_enabled_); 289 EXPECT_EQ(enabled_at_startup, proxy_enabled_);
297 } 290 }
298 291
299 } // namespace data_reduction_proxy 292 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698