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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc

Issue 2917873003: Ignore download bytes in page load metrics. (Closed)
Patch Set: address comment Created 3 years, 6 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/feature_list.h" 6 #include "base/feature_list.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 // navigation to another page. 1104 // navigation to another page.
1105 NavigateToUntrackedUrl(); 1105 NavigateToUntrackedUrl();
1106 1106
1107 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); 1107 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1);
1108 1108
1109 // Verify that there is a single sample recorded in the 10kB bucket (the size 1109 // Verify that there is a single sample recorded in the 10kB bucket (the size
1110 // of the main HTML response). 1110 // of the main HTML response).
1111 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); 1111 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1);
1112 } 1112 }
1113 1113
1114 IN_PROC_BROWSER_TEST_P(PageLoadMetricsBrowserTest,
1115 PayloadSizeIgnoresDownloads) {
1116 ASSERT_TRUE(embedded_test_server()->Start());
1117
1118 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true);
1119 {
1120 base::ScopedTempDir downloads_directory;
1121 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir());
1122 browser()->profile()->GetPrefs()->SetFilePath(
1123 prefs::kDownloadDefaultDirectory, downloads_directory.GetPath());
1124 content::DownloadTestObserverTerminal downloads_observer(
1125 content::BrowserContext::GetDownloadManager(browser()->profile()),
1126 1, // == wait_count (only waiting for "download-test1.lib").
1127 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL);
1128
1129 ui_test_utils::NavigateToURL(
1130 browser(), embedded_test_server()->GetURL(
1131 "/page_load_metrics/download_anchor_click.html"));
1132 downloads_observer.WaitForFinished();
1133 }
1134 base::ThreadRestrictions::SetIOAllowed(prev_io_allowed);
1135
1136 NavigateToUntrackedUrl();
1137
1138 histogram_tester_.ExpectUniqueSample(internal::kHistogramTotalBytes, 0, 1);
1139 }
1140
1114 INSTANTIATE_TEST_CASE_P( 1141 INSTANTIATE_TEST_CASE_P(
1115 /* no prefix */, 1142 /* no prefix */,
1116 PageLoadMetricsBrowserTest, 1143 PageLoadMetricsBrowserTest,
1117 testing::Values(IPCType::LEGACY, IPCType::MOJO)); 1144 testing::Values(IPCType::LEGACY, IPCType::MOJO));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698