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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc

Issue 1400903002: Data reduction proxy enabled/disabled UMA for all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tbansal1 comments Created 5 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
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/core/browser/data_reduction_proxy_sett ings.h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 test_context_->RunUntilIdle(); 621 test_context_->RunUntilIdle();
622 histogram_tester.ExpectBucketCount( 622 histogram_tester.ExpectBucketCount(
623 kUMALoFiSessionState, 623 kUMALoFiSessionState,
624 DataReductionProxyService::LO_FI_SESSION_STATE_NOT_USED, 2); 624 DataReductionProxyService::LO_FI_SESSION_STATE_NOT_USED, 2);
625 625
626 // Total count should be equal to the number of sessions. 626 // Total count should be equal to the number of sessions.
627 histogram_tester.ExpectTotalCount( 627 histogram_tester.ExpectTotalCount(
628 kUMALoFiSessionState, settings_->lo_fi_consecutive_session_disables_ + 3); 628 kUMALoFiSessionState, settings_->lo_fi_consecutive_session_disables_ + 3);
629 } 629 }
630 630
631 TEST_F(DataReductionProxySettingsTest, TestSettingsEnabledStateHistograms) {
632 const char kUMAEnabledState[] = "DataReductionProxy.EnabledState";
633 base::HistogramTester histogram_tester;
634
635 settings_->InitPrefMembers();
636 settings_->data_reduction_proxy_service_->SetIOData(
637 test_context_->io_data()->GetWeakPtr());
638
639 // No settings state histograms should be recorded during startup.
640 test_context_->RunUntilIdle();
641 histogram_tester.ExpectTotalCount(kUMAEnabledState, 0);
642
643 settings_->SetDataReductionProxyEnabled(true);
644 test_context_->RunUntilIdle();
645 histogram_tester.ExpectBucketCount(
646 kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON, 1);
647 histogram_tester.ExpectBucketCount(
648 kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF, 0);
649
650 settings_->SetDataReductionProxyEnabled(false);
651 test_context_->RunUntilIdle();
652 histogram_tester.ExpectBucketCount(
653 kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON, 1);
654 histogram_tester.ExpectBucketCount(
655 kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF, 1);
656 }
657
631 TEST_F(DataReductionProxySettingsTest, TestGetDailyContentLengths) { 658 TEST_F(DataReductionProxySettingsTest, TestGetDailyContentLengths) {
632 ContentLengthList result = 659 ContentLengthList result =
633 settings_->GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength); 660 settings_->GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);
634 661
635 ASSERT_FALSE(result.empty()); 662 ASSERT_FALSE(result.empty());
636 ASSERT_EQ(kNumDaysInHistory, result.size()); 663 ASSERT_EQ(kNumDaysInHistory, result.size());
637 664
638 for (size_t i = 0; i < kNumDaysInHistory; ++i) { 665 for (size_t i = 0; i < kNumDaysInHistory; ++i) {
639 long expected_length = 666 long expected_length =
640 static_cast<long>((kNumDaysInHistory - 1 - i) * 2); 667 static_cast<long>((kNumDaysInHistory - 1 - i) * 2);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 SyntheticFieldTrialRegistrationCallback, 745 SyntheticFieldTrialRegistrationCallback,
719 base::Unretained(this))); 746 base::Unretained(this)));
720 747
721 net::ProxyServer origin = 748 net::ProxyServer origin =
722 test_context_->config()->test_params()->proxies_for_http().front(); 749 test_context_->config()->test_params()->proxies_for_http().front();
723 EXPECT_EQ(tests[i].enable_quic, origin.is_quic()) << i; 750 EXPECT_EQ(tests[i].enable_quic, origin.is_quic()) << i;
724 } 751 }
725 } 752 }
726 753
727 } // namespace data_reduction_proxy 754 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698