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

Unified Diff: chrome/test/data/webui/net_internals/bandwidth_view.js

Issue 473723002: Update data reduction proxy statistics prefs less often on desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tooManyWritesPatch
Patch Set: Fixing nits Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/net_internals/bandwidth_view.js
diff --git a/chrome/test/data/webui/net_internals/bandwidth_view.js b/chrome/test/data/webui/net_internals/bandwidth_view.js
index 5bbef70a992fee75d01a10307c8821a69b136e37..c9571c37c3d31bf9d9bbc7a5a8ce550f26baccee 100644
--- a/chrome/test/data/webui/net_internals/bandwidth_view.js
+++ b/chrome/test/data/webui/net_internals/bandwidth_view.js
@@ -42,7 +42,7 @@ BandwidthTask.prototype = {
assertEquals('string', typeof url);
this.url_ = url;
g_browser.addSessionNetworkStatsObserver(this, true);
- g_browser.addHistoricNetworkStatsObserver(this, true);
+ g_browser.addHistoricNetworkStatsObserver(this, false);
NetInternalsTest.switchToView('bandwidth');
chrome.send('loadPage', [this.url_]);
},
@@ -99,7 +99,7 @@ BandwidthTask.prototype = {
* @param {object} networkStats State of the network session.
*/
onSessionNetworkStatsChanged: function(networkStats) {
- if (this.isDone())
+ if (this.isDone() || this.sessionVerified)
return;
// Wait until the received content length is at least the size of
// our test page and favicon.
@@ -120,15 +120,15 @@ BandwidthTask.prototype = {
* @param {object} networkStats State of the network session.
*/
onHistoricNetworkStatsChanged: function(networkStats) {
- if (this.isDone())
+ if (this.isDone() || this.historicVerified)
return;
- // Wait until the received content length is at least the size of
- // our test page and favicon.
- var expectedLength = this.expectedLength_ + this.faviconLength_;
- if (networkStats.historic_received_content_length >= expectedLength) {
+ // The received content length should be zero since the historic
+ // information only updates every hour.
+ var expectedLength = 0;
+ // Wait until the table has changed, otherwise the columns will be NaN
+ if (!isNaN(this.getBandwidthTableCell_(0, 2))) {
expectLE(expectedLength, networkStats.historic_original_content_length);
- // Column 2 contains historic information, and it should be the same as
- // the session information, because previously there was no history.
+ // Column 2 contains historic information.
this.validateBandwidthTableColumn_(2, expectedLength, expectedLength);
this.historicVerified = true;
this.completeIfDone();
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698