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 a7baed109358fda5a0663ff5462aee710587e015..76d0094155ea255da65824829a0c37302e4e3d7d 100644 |
--- a/content/browser/loader/resource_scheduler_unittest.cc |
+++ b/content/browser/loader/resource_scheduler_unittest.cc |
@@ -149,8 +149,9 @@ class ResourceSchedulerTest : public testing::Test { |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId, kRouteId, true); |
- scheduler_.OnClientCreated(kBackgroundChildId, kBackgroundRouteId, false); |
+ scheduler_.OnClientCreated(kChildId, kRouteId, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId, kBackgroundRouteId, false, false); |
context_.set_http_server_properties(http_server_properties_.GetWeakPtr()); |
} |
@@ -661,7 +662,8 @@ TEST_F(ResourceSchedulerTest, ThrottledClientCreation) { |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
EXPECT_TRUE(scheduler_.should_throttle()); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
EXPECT_EQ(ResourceScheduler::THROTTLED, |
scheduler_.GetClientStateForTesting(kBackgroundChildId2, |
@@ -1045,8 +1047,9 @@ TEST_F(ResourceSchedulerTest, |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, false); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
@@ -1101,8 +1104,9 @@ TEST_F(ResourceSchedulerTest, |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, false); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
@@ -1158,8 +1162,9 @@ TEST_F(ResourceSchedulerTest, |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, false); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
@@ -1213,8 +1218,9 @@ TEST_F(ResourceSchedulerTest, |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, false); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
@@ -1269,8 +1275,9 @@ TEST_F(ResourceSchedulerTest, UnloadedClientBecomesHiddenCorrectlyUnthrottles) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, true); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
@@ -1337,13 +1344,13 @@ TEST_F(ResourceSchedulerTest, UnloadedClientBecomesSilentCorrectlyUnthrottles) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, false); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, false, true); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
- scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); |
// 2 audible, 2 hidden |
EXPECT_FALSE(scheduler_.active_clients_loaded()); |
EXPECT_EQ(ResourceScheduler::THROTTLED, |
@@ -1407,8 +1414,9 @@ TEST_F(ResourceSchedulerTest, LoadedClientBecomesHiddenCorrectlyThrottles) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, true); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
@@ -1475,14 +1483,14 @@ TEST_F(ResourceSchedulerTest, LoadedClientBecomesSilentCorrectlyThrottles) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, false); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, false, true); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
scheduler_.OnLoadingStateChanged( |
kBackgroundChildId2, kBackgroundRouteId2, true); |
scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
- scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); |
// 2 audible, 2 hidden |
EXPECT_FALSE(scheduler_.active_clients_loaded()); |
EXPECT_EQ(ResourceScheduler::THROTTLED, |
@@ -1546,8 +1554,9 @@ TEST_F(ResourceSchedulerTest, HiddenLoadedChangesCorrectlyStayThrottled) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, true); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
// 1 visible and 2 hidden loading, 1 visible loaded |
scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
@@ -1616,8 +1625,9 @@ TEST_F(ResourceSchedulerTest, PartialVisibleClientLoadedDoesNotUnthrottle) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, true); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
// 2 visible loading, 1 hidden loading, 1 hidden loaded |
scheduler_.OnLoadingStateChanged( |
@@ -1670,8 +1680,9 @@ TEST_F(ResourceSchedulerTest, FullVisibleLoadedCorrectlyUnthrottle) { |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, true); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
// 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading |
scheduler_.OnLoadingStateChanged( |
@@ -1736,8 +1747,9 @@ TEST_F(ResourceSchedulerTest, |
// TODO(aiolos): remove when throttling and coalescing have both landed |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
false /* should_coalesce */); |
- scheduler_.OnClientCreated(kChildId2, kRouteId2, true); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
// 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading |
scheduler_.OnLoadingStateChanged( |
@@ -1873,7 +1885,8 @@ TEST_F(ResourceSchedulerTest, CoalescedClientBecomesAudibleStopsTimer) { |
TEST_F(ResourceSchedulerTest, LastCoalescedClientDeletionStopsTimer) { |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
true /* should_coalesce */); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
EXPECT_FALSE(mock_timer_->IsRunning()); |
scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
EXPECT_FALSE(mock_timer_->IsRunning()); |
@@ -1896,13 +1909,15 @@ TEST_F(ResourceSchedulerTest, LastCoalescedClientDeletionStopsTimer) { |
EXPECT_FALSE(mock_timer_->IsRunning()); |
// To avoid errors on test tear down. |
- scheduler_.OnClientCreated(kBackgroundChildId, kBackgroundRouteId, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId, kBackgroundRouteId, false, false); |
} |
TEST_F(ResourceSchedulerTest, LastCoalescedClientStartsLoadingStopsTimer) { |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
true /* should_coalesce */); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
EXPECT_FALSE(mock_timer_->IsRunning()); |
scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
EXPECT_FALSE(mock_timer_->IsRunning()); |
@@ -1933,7 +1948,8 @@ TEST_F(ResourceSchedulerTest, LastCoalescedClientStartsLoadingStopsTimer) { |
TEST_F(ResourceSchedulerTest, LastCoalescedClientBecomesVisibleStopsTimer) { |
scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
true /* should_coalesce */); |
- scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); |
+ scheduler_.OnClientCreated( |
+ kBackgroundChildId2, kBackgroundRouteId2, false, false); |
EXPECT_FALSE(mock_timer_->IsRunning()); |
scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
EXPECT_FALSE(mock_timer_->IsRunning()); |