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

Unified Diff: content/browser/loader/resource_scheduler_unittest.cc

Issue 2708323002: Revert of [ResourceScheduler] Yield after starting several requests (Closed)
Patch Set: Created 3 years, 10 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/loader/resource_scheduler.cc ('k') | testing/variations/fieldtrial_testing_config.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_scheduler_unittest.cc
diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc
index 2f0233c1d152eef7b8db5d24925425e8070bfa1f..fb881611df6ba79e7632d0220190092b510755a5 100644
--- a/content/browser/loader/resource_scheduler_unittest.cc
+++ b/content/browser/loader/resource_scheduler_unittest.cc
@@ -9,11 +9,8 @@
#include <vector>
#include "base/memory/ptr_util.h"
-#include "base/metrics/field_trial.h"
-#include "base/metrics/field_trial_param_associator.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
-#include "base/test/mock_entropy_provider.h"
#include "base/test/scoped_feature_list.h"
#include "base/timer/mock_timer.h"
#include "base/timer/timer.h"
@@ -51,9 +48,6 @@
const char kPrioritySupportedRequestsDelayable[] =
"PrioritySupportedRequestsDelayable";
-const char kNetworkSchedulerYielding[] = "NetworkSchedulerYielding";
-const int kMaxRequestsBeforeYielding = 5; // sync with .cc.
-
class TestRequest : public ResourceThrottle::Delegate {
public:
TestRequest(std::unique_ptr<net::URLRequest> url_request,
@@ -323,84 +317,6 @@
EXPECT_TRUE(lowest2->started());
}
-TEST_F(ResourceSchedulerTest, SchedulerYieldsWithFeatureEnabled) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitFromCommandLine(kNetworkSchedulerYielding, "");
- InitializeScheduler();
-
- // Use spdy so that we don't throttle.
- http_server_properties_.SetSupportsSpdy(
- url::SchemeHostPort("https", "spdyhost", 443), true);
-
- // Add enough async requests that the last one should yield.
- std::vector<std::unique_ptr<TestRequest>> requests;
- for (int i = 0; i < kMaxRequestsBeforeYielding + 1; ++i)
- requests.push_back(NewRequest("http://host/higher", net::HIGHEST));
-
- // Verify that the number of requests before yielding started.
- for (int i = 0; i < kMaxRequestsBeforeYielding; ++i)
- EXPECT_TRUE(requests[i]->started());
-
- // The next async request should have yielded.
- EXPECT_FALSE(requests[kMaxRequestsBeforeYielding]->started());
-
- // Verify that with time the yielded request eventually runs.
- base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(requests[kMaxRequestsBeforeYielding]->started());
-}
-
-TEST_F(ResourceSchedulerTest, SchedulerDoesNotYieldForSyncRequests) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitFromCommandLine(kNetworkSchedulerYielding, "");
- InitializeScheduler();
-
- // Use spdy so that we don't throttle.
- http_server_properties_.SetSupportsSpdy(
- url::SchemeHostPort("https", "spdyhost", 443), true);
-
- // Add enough async requests that the last one should yield.
- std::vector<std::unique_ptr<TestRequest>> requests;
- for (int i = 0; i < kMaxRequestsBeforeYielding + 1; ++i)
- requests.push_back(NewRequest("http://host/higher", net::HIGHEST));
-
- // Add a sync requests.
- requests.push_back(NewSyncRequest("http://host/higher", net::HIGHEST));
-
- // Verify that the number of requests before yielding started.
- for (int i = 0; i < kMaxRequestsBeforeYielding; ++i)
- EXPECT_TRUE(requests[i]->started());
-
- // The next async request should have yielded.
- EXPECT_FALSE(requests[kMaxRequestsBeforeYielding]->started());
-
- // The next sync request should have started even though async is yielding.
- EXPECT_TRUE(requests[kMaxRequestsBeforeYielding + 1]->started());
-
- // Verify that with time the yielded request eventually runs.
- base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(requests[kMaxRequestsBeforeYielding]->started());
-}
-
-TEST_F(ResourceSchedulerTest, SchedulerDoesNotYieldWithFeatureDisabled) {
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitFromCommandLine("", kNetworkSchedulerYielding);
- InitializeScheduler();
-
- // Use spdy so that we don't throttle.
- http_server_properties_.SetSupportsSpdy(
- url::SchemeHostPort("https", "spdyhost", 443), true);
-
- // Add enough async requests that the last one would yield if yielding were
- // enabled.
- std::vector<std::unique_ptr<TestRequest>> requests;
- for (int i = 0; i < kMaxRequestsBeforeYielding + 1; ++i)
- requests.push_back(NewRequest("http://host/higher", net::HIGHEST));
-
- // Verify that none of the requests yield.
- for (int i = 0; i < kMaxRequestsBeforeYielding + 1; ++i)
- EXPECT_TRUE(requests[i]->started());
-}
-
TEST_F(ResourceSchedulerTest, OneLowLoadsUntilBodyInsertedExceptSpdy) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitFromCommandLine("",
@@ -543,11 +459,6 @@
}
TEST_F(ResourceSchedulerTest, LimitedNumberOfDelayableRequestsInFlight) {
- // The yielding feature will sometimes yield requests before they get a
- // chance to start, which conflicts this test. So disable the feature.
- base::test::ScopedFeatureList scoped_feature_list;
- scoped_feature_list.InitFromCommandLine("", kNetworkSchedulerYielding);
-
// We only load low priority resources if there's a body.
scheduler()->OnWillInsertBody(kChildId, kRouteId);
« no previous file with comments | « content/browser/loader/resource_scheduler.cc ('k') | testing/variations/fieldtrial_testing_config.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698