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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc

Issue 2765763003: Fix the flaky Warmup URL test in data reduction proxy (Closed)
Patch Set: ps Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
index 0a917ea4bf64ef04e1588b09f85802462c010e29..f70b5e700b8fddb4b4a368bbb4bc37a3bb92c37f 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
@@ -165,17 +165,6 @@ class DataReductionProxyConfigTest : public testing::Test {
1);
}
- void WarmupURLFetchedCallBack() const {
- warmup_url_fetched_run_loop_->Quit();
- }
-
- void WarmUpURLFetchedRunLoop() {
- warmup_url_fetched_run_loop_.reset(new base::RunLoop());
- // |warmup_url_fetched_run_loop_| will run until WarmupURLFetchedCallBack()
- // is called.
- warmup_url_fetched_run_loop_->Run();
- }
-
void RunUntilIdle() {
test_context_->RunUntilIdle();
}
@@ -213,7 +202,6 @@ class DataReductionProxyConfigTest : public testing::Test {
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
base::MessageLoopForIO message_loop_;
- std::unique_ptr<base::RunLoop> warmup_url_fetched_run_loop_;
std::unique_ptr<DataReductionProxyTestContext> test_context_;
std::unique_ptr<TestDataReductionProxyParams> expected_params_;
};
@@ -375,9 +363,6 @@ TEST_F(DataReductionProxyConfigTest, WarmupURL) {
new net::TestURLRequestContextGetter(task_runner());
config.InitializeOnIOThread(request_context_getter_.get(),
request_context_getter_.get());
- config.SetWarmupURLFetcherCallbackForTesting(
- base::Bind(&DataReductionProxyConfigTest::WarmupURLFetchedCallBack,
- base::Unretained(this)));
// Set the connection type to WiFi so that warm up URL is fetched even if
// the test device does not have connectivity.
@@ -387,12 +372,8 @@ TEST_F(DataReductionProxyConfigTest, WarmupURL) {
test.data_reduction_proxy_enabled && test.enabled_via_field_trial;
if (warmup_url_enabled) {
- // Block until warm up URL is fetched successfully.
- WarmUpURLFetchedRunLoop();
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.WarmupURL.FetchInitiated", 1, 1);
- histogram_tester.ExpectUniqueSample(
- "DataReductionProxy.WarmupURL.FetchSuccessful", 1, 1);
}
// Set the connection type to 4G so that warm up URL is fetched even if
@@ -402,12 +383,8 @@ TEST_F(DataReductionProxyConfigTest, WarmupURL) {
RunUntilIdle();
if (warmup_url_enabled) {
- // Block until warm up URL is fetched successfully.
- WarmUpURLFetchedRunLoop();
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.WarmupURL.FetchInitiated", 1, 2);
- histogram_tester.ExpectUniqueSample(
- "DataReductionProxy.WarmupURL.FetchSuccessful", 1, 2);
} else {
histogram_tester.ExpectTotalCount(
"DataReductionProxy.WarmupURL.FetchInitiated", 0);
@@ -424,8 +401,6 @@ TEST_F(DataReductionProxyConfigTest, WarmupURL) {
if (warmup_url_enabled) {
histogram_tester.ExpectUniqueSample(
"DataReductionProxy.WarmupURL.FetchInitiated", 1, 2);
- histogram_tester.ExpectUniqueSample(
- "DataReductionProxy.WarmupURL.FetchSuccessful", 1, 2);
} else {
histogram_tester.ExpectTotalCount(
"DataReductionProxy.WarmupURL.FetchInitiated", 0);
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698