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

Unified Diff: content/browser/net_info_browsertest.cc

Issue 2857093002: Expose changes in the network quality to the renderers (Closed)
Patch Set: isherman comments Created 3 years, 7 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 | « content/browser/net/network_quality_observer_impl.cc ('k') | content/common/renderer.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/net_info_browsertest.cc
diff --git a/content/browser/net_info_browsertest.cc b/content/browser/net_info_browsertest.cc
index ba66337c6d943e5d5bb395e351d4d2224d610426..135ac36037517d3752ffb39f2d6df92059f6e029 100644
--- a/content/browser/net_info_browsertest.cc
+++ b/content/browser/net_info_browsertest.cc
@@ -5,7 +5,9 @@
#include "base/command_line.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
+#include "base/test/histogram_tester.h"
#include "build/build_config.h"
+#include "content/browser/net/network_quality_observer_impl.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
@@ -13,6 +15,7 @@
#include "content/shell/browser/shell.h"
#include "net/base/network_change_notifier.h"
#include "net/base/network_change_notifier_factory.h"
+#include "net/nqe/network_quality_estimator_test_util.h"
namespace content {
@@ -141,4 +144,21 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, TwoRenderViewsInOneProcess) {
EXPECT_FALSE(RunScriptExtractBool("getOnLine()"));
}
+// Make sure the changes in the network quality are notified to the render
+// thread.
+IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeNotified) {
+ base::HistogramTester histogram_tester;
+ net::TestNetworkQualityEstimator estimator;
+ NetworkQualityObserverImpl impl(&estimator);
+ estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed(
+ net::nqe::internal::NetworkQuality(base::TimeDelta::FromSeconds(1),
+ base::TimeDelta::FromSeconds(2), 3));
+
+ NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
+
+ FetchHistogramsFromChildProcesses();
+ EXPECT_FALSE(
+ histogram_tester.GetAllSamples("NQE.RenderThreadNotified").empty());
+}
+
} // namespace content
« no previous file with comments | « content/browser/net/network_quality_observer_impl.cc ('k') | content/common/renderer.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698