Skip to content

Commit

Permalink
Make chrome sync response compression as default
Browse files Browse the repository at this point in the history
BUG=509728

Review-Url: https://codereview.chromium.org/2046493007
Cr-Commit-Position: refs/heads/master@{#398730}
  • Loading branch information
gangwu authored and Commit bot committed Jun 8, 2016
1 parent a37f94d commit 1bc923a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion sync/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ test("sync_unit_tests") {
"//testing/gtest",
"//third_party/leveldatabase",
"//third_party/protobuf:protobuf_lite",
"//third_party/zlib",
]

if (is_chromeos) {
Expand Down
15 changes: 0 additions & 15 deletions sync/internal_api/http_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
#include "base/bit_cast.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/load_flags.h"
Expand Down Expand Up @@ -47,12 +45,6 @@ void LogTimeout(bool timed_out) {
UMA_HISTOGRAM_BOOLEAN("Sync.URLFetchTimedOut", timed_out);
}

bool IsSyncHttpContentCompressionEnabled() {
const std::string group_name =
base::FieldTrialList::FindFullName("SyncHttpContentCompression");
return StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
}

void RecordSyncRequestContentLengthHistograms(int64_t compressed_content_length,
int64_t original_content_length) {
UMA_HISTOGRAM_COUNTS("Sync.RequestContentLength.Compressed",
Expand Down Expand Up @@ -253,13 +245,6 @@ void HttpBridge::MakeAsynchronousPost() {
fetch_state_.url_poster->SetRequestContext(request_context_getter_.get());
fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_);

if (!IsSyncHttpContentCompressionEnabled()) {
// We set "accept-encoding" here to avoid URLRequestHttpJob adding "gzip"
// into "accept-encoding" later.
fetch_state_.url_poster->AddExtraRequestHeader(base::StringPrintf(
"%s: %s", net::HttpRequestHeaders::kAcceptEncoding, "deflate"));
}

fetch_state_.url_poster->SetUploadData(content_type_, request_content_);
RecordSyncRequestContentLengthHistograms(request_content_.size(),
request_content_.size());
Expand Down
10 changes: 0 additions & 10 deletions sync/internal_api/http_bridge_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
#include <stdint.h>

#include "base/bit_cast.h"
#include "base/metrics/field_trial.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/mock_entropy_provider.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "net/http/http_response_headers.h"
Expand All @@ -21,7 +19,6 @@
#include "sync/internal_api/public/http_bridge.h"
#include "sync/internal_api/public/http_post_provider_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/zlib/zlib.h"

namespace syncer {

Expand Down Expand Up @@ -270,9 +267,6 @@ TEST_F(MAYBE_SyncHttpBridgeTest, CompressedRequestHeaderCheck) {

int os_error = 0;
int response_code = 0;
base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
base::FieldTrialList::CreateFieldTrial("SyncHttpContentCompression",
"Enabled");
bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code);
EXPECT_TRUE(success);
EXPECT_EQ(200, response_code);
Expand Down Expand Up @@ -312,10 +306,6 @@ TEST_F(MAYBE_SyncHttpBridgeTest, TestMakeSynchronousPostLiveComprehensive) {
std::string response(http_bridge->GetResponseContent(),
http_bridge->GetResponseContentLength());
EXPECT_EQ(std::string::npos, response.find("Cookie:"));
EXPECT_NE(std::string::npos,
response.find(base::StringPrintf(
"%s: %s", net::HttpRequestHeaders::kAcceptEncoding,
"deflate")));
EXPECT_NE(std::string::npos,
response.find(base::StringPrintf("%s: %s",
net::HttpRequestHeaders::kUserAgent, kUserAgent)));
Expand Down

0 comments on commit 1bc923a

Please sign in to comment.