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

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.cc

Issue 156373002: Support for new data reduction proxy via header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/md5.h" 8 #include "base/md5.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram_samples.h" 10 #include "base/metrics/histogram_samples.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 EXPECT_EQ(expected[i++], *it); 639 EXPECT_EQ(expected[i++], *it);
640 } 640 }
641 } 641 }
642 642
643 TEST_F(DataReductionProxySettingsTest, WasFetchedViaProxy) { 643 TEST_F(DataReductionProxySettingsTest, WasFetchedViaProxy) {
644 const struct { 644 const struct {
645 const char* headers; 645 const char* headers;
646 bool expected_result; 646 bool expected_result;
647 } tests[] = { 647 } tests[] = {
648 { "HTTP/1.1 200 OK\n" 648 { "HTTP/1.1 200 OK\n"
649 "Via: 1.1 Chrome-Proxy\n",
650 false,
651 },
652 { "HTTP/1.1 200 OK\n"
653 "Via: 1.1 Chrome-Compression-Proxy\n",
654 true,
655 },
656 { "HTTP/1.1 200 OK\n"
657 "Via: 1.0 Chrome-Compression-Proxy\n",
658 true,
659 },
660 { "HTTP/1.1 200 OK\n"
661 "Via: 1.1 Foo Bar, 1.1 Chrome-Compression-Proxy\n",
662 true,
663 },
664 { "HTTP/1.1 200 OK\n"
665 "Via: 1.1 Chrome-Compression-Proxy, 1.1 Bar Foo\n",
666 true,
667 },
668 { "HTTP/1.1 200 OK\n"
669 "Via: 1.1 chrome-compression-proxy\n",
670 false,
671 },
672 { "HTTP/1.1 200 OK\n"
673 "Via: 1.1 Foo Bar\n"
674 "Via: 1.1 Chrome-Compression-Proxy\n",
675 true,
676 },
677 { "HTTP/1.1 200 OK\n"
649 "Via: 1.1 Chrome Proxy\n", 678 "Via: 1.1 Chrome Proxy\n",
650 false, 679 false,
651 }, 680 },
652 { "HTTP/1.1 200 OK\n" 681 { "HTTP/1.1 200 OK\n"
653 "Via: 1.1 Chrome Compression Proxy\n", 682 "Via: 1.1 Chrome Compression Proxy\n",
654 true, 683 true,
655 }, 684 },
656 { "HTTP/1.1 200 OK\n" 685 { "HTTP/1.1 200 OK\n"
657 "Via: 1.1 Foo Bar, 1.1 Chrome Compression Proxy\n", 686 "Via: 1.1 Foo Bar, 1.1 Chrome Compression Proxy\n",
658 true, 687 true,
(...skipping 24 matching lines...) Expand all
683 } 712 }
684 713
685 TEST_F(DataReductionProxySettingsTest, CheckInitMetricsWhenNotAllowed) { 714 TEST_F(DataReductionProxySettingsTest, CheckInitMetricsWhenNotAllowed) {
686 // No call to |AddProxyToCommandLine()| was made, so the proxy feature 715 // No call to |AddProxyToCommandLine()| was made, so the proxy feature
687 // should be unavailable. 716 // should be unavailable.
688 EXPECT_FALSE(DataReductionProxySettings::IsDataReductionProxyAllowed()); 717 EXPECT_FALSE(DataReductionProxySettings::IsDataReductionProxyAllowed());
689 MockSettings* settings = static_cast<MockSettings*>(settings_.get()); 718 MockSettings* settings = static_cast<MockSettings*>(settings_.get());
690 EXPECT_CALL(*settings, RecordStartupState(spdyproxy::PROXY_NOT_AVAILABLE)); 719 EXPECT_CALL(*settings, RecordStartupState(spdyproxy::PROXY_NOT_AVAILABLE));
691 settings_->InitDataReductionProxySettings(); 720 settings_->InitDataReductionProxySettings();
692 } 721 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698