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

Side by Side Diff: chrome/browser/android/data_usage/external_data_use_observer_unittest.cc

Issue 1772273002: Remove one thread hop while fetching matching rules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/data_usage/external_data_use_observer.h" 5 #include "chrome/browser/android/data_usage/external_data_use_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 // Tests if the metrics are recorded correctly. 588 // Tests if the metrics are recorded correctly.
589 TEST_F(ExternalDataUseObserverTest, DataUseReportTimedOut) { 589 TEST_F(ExternalDataUseObserverTest, DataUseReportTimedOut) {
590 base::HistogramTester histogram_tester; 590 base::HistogramTester histogram_tester;
591 std::map<std::string, std::string> variation_params; 591 std::map<std::string, std::string> variation_params;
592 variation_params["data_report_submit_timeout_msec"] = "0"; 592 variation_params["data_report_submit_timeout_msec"] = "0";
593 variation_params["data_use_report_min_bytes"] = "0"; 593 variation_params["data_use_report_min_bytes"] = "0";
594 594
595 // Create another ExternalDataUseObserver object. 595 // Create another ExternalDataUseObserver object.
596 ReplaceExternalDataUseObserver(variation_params); 596 ReplaceExternalDataUseObserver(variation_params);
597 histogram_tester.ExpectTotalCount(kUMAMatchingRuleFirstFetchDurationHistogram,
598 0);
597 599
598 // Trigger the control app install, and matching rules will be fetched. 600 // Trigger the control app install, and matching rules will be fetched.
599 external_data_use_observer() 601 external_data_use_observer()
600 ->GetDataUseTabModel() 602 ->GetDataUseTabModel()
601 ->OnControlAppInstallStateChange(true); 603 ->OnControlAppInstallStateChange(true);
602 base::RunLoop().RunUntilIdle(); 604 base::RunLoop().RunUntilIdle();
603 histogram_tester.ExpectTotalCount(kUMAMatchingRuleFirstFetchDurationHistogram, 605 histogram_tester.ExpectTotalCount(kUMAMatchingRuleFirstFetchDurationHistogram,
604 1); 606 1);
605 607
606 // Verify that matching rules are fetched on every navigation after the 608 // Verify that matching rules are fetched on every navigation after the
(...skipping 15 matching lines...) Expand all
622 ExternalDataUseObserver::DATAUSAGE_REPORT_SUBMISSION_TIMED_OUT, 1); 624 ExternalDataUseObserver::DATAUSAGE_REPORT_SUBMISSION_TIMED_OUT, 1);
623 histogram_tester.ExpectUniqueSample( 625 histogram_tester.ExpectUniqueSample(
624 "DataUsage.ReportSubmission.Bytes.TimedOut", 626 "DataUsage.ReportSubmission.Bytes.TimedOut",
625 default_upload_bytes() + default_download_bytes(), 1); 627 default_upload_bytes() + default_download_bytes(), 1);
626 histogram_tester.ExpectTotalCount(kUMAReportSubmissionDurationHistogram, 0); 628 histogram_tester.ExpectTotalCount(kUMAReportSubmissionDurationHistogram, 0);
627 } 629 }
628 630
629 } // namespace android 631 } // namespace android
630 632
631 } // namespace chrome 633 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698