| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/loader/resource_scheduler.h" | 5 #include "content/browser/loader/resource_scheduler.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 FakeResourceContext context_; | 131 FakeResourceContext context_; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 class ResourceSchedulerTest : public testing::Test { | 134 class ResourceSchedulerTest : public testing::Test { |
| 135 protected: | 135 protected: |
| 136 ResourceSchedulerTest() | 136 ResourceSchedulerTest() |
| 137 : next_request_id_(0), | 137 : next_request_id_(0), |
| 138 ui_thread_(BrowserThread::UI, &message_loop_), | 138 ui_thread_(BrowserThread::UI, &message_loop_), |
| 139 io_thread_(BrowserThread::IO, &message_loop_) { | 139 io_thread_(BrowserThread::IO, &message_loop_) { |
| 140 // TODO(aiolos): remove when throttling and coalescing have both landed | |
| 141 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, | |
| 142 false /* should_coalesce */); | |
| 143 | 140 |
| 144 scheduler_.OnClientCreated(kChildId, kRouteId); | 141 scheduler_.OnClientCreated(kChildId, kRouteId); |
| 145 scheduler_.OnVisibilityChanged(kChildId, kRouteId, true); | 142 scheduler_.OnVisibilityChanged(kChildId, kRouteId, true); |
| 146 scheduler_.OnClientCreated(kBackgroundChildId, kBackgroundRouteId); | 143 scheduler_.OnClientCreated(kBackgroundChildId, kBackgroundRouteId); |
| 147 context_.set_http_server_properties(http_server_properties_.GetWeakPtr()); | 144 context_.set_http_server_properties(http_server_properties_.GetWeakPtr()); |
| 148 } | 145 } |
| 149 | 146 |
| 150 virtual ~ResourceSchedulerTest() { | 147 virtual ~ResourceSchedulerTest() { |
| 151 scheduler_.OnClientDeleted(kChildId, kRouteId); | 148 scheduler_.OnClientDeleted(kChildId, kRouteId); |
| 152 scheduler_.OnClientDeleted(kBackgroundChildId, kBackgroundRouteId); | 149 scheduler_.OnClientDeleted(kBackgroundChildId, kBackgroundRouteId); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // Dummies to enforce scheduling. | 536 // Dummies to enforce scheduling. |
| 540 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); | 537 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); |
| 541 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); | 538 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); |
| 542 | 539 |
| 543 scoped_ptr<TestRequest> request( | 540 scoped_ptr<TestRequest> request( |
| 544 NewRequest("chrome-extension://req", net::LOWEST)); | 541 NewRequest("chrome-extension://req", net::LOWEST)); |
| 545 EXPECT_TRUE(request->started()); | 542 EXPECT_TRUE(request->started()); |
| 546 } | 543 } |
| 547 | 544 |
| 548 TEST_F(ResourceSchedulerTest, ActiveLoadingSyncSchedulesImmediately) { | 545 TEST_F(ResourceSchedulerTest, ActiveLoadingSyncSchedulesImmediately) { |
| 546 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 547 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 548 false /* should_coalesce */); |
| 549 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 549 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 550 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 550 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 551 // Dummies to enforce scheduling. | 551 // Dummies to enforce scheduling. |
| 552 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); | 552 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); |
| 553 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); | 553 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); |
| 554 | 554 |
| 555 scoped_ptr<TestRequest> request( | 555 scoped_ptr<TestRequest> request( |
| 556 NewSyncRequest("http://host/req", net::LOWEST)); | 556 NewSyncRequest("http://host/req", net::LOWEST)); |
| 557 EXPECT_TRUE(request->started()); | 557 EXPECT_TRUE(request->started()); |
| 558 } | 558 } |
| 559 | 559 |
| 560 TEST_F(ResourceSchedulerTest, UnthrottledSyncSchedulesImmediately) { | 560 TEST_F(ResourceSchedulerTest, UnthrottledSyncSchedulesImmediately) { |
| 561 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 562 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 563 false /* should_coalesce */); |
| 561 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); | 564 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
| 562 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 565 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 563 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 566 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 564 kBackgroundRouteId)); | 567 kBackgroundRouteId)); |
| 565 // Dummies to enforce scheduling. | 568 // Dummies to enforce scheduling. |
| 566 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); | 569 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); |
| 567 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); | 570 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); |
| 568 | 571 |
| 569 scoped_ptr<TestRequest> request( | 572 scoped_ptr<TestRequest> request( |
| 570 NewBackgroundSyncRequest("http://host/req", net::LOWEST)); | 573 NewBackgroundSyncRequest("http://host/req", net::LOWEST)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 // Reprioritize a request after we learn the server supports SPDY. | 613 // Reprioritize a request after we learn the server supports SPDY. |
| 611 EXPECT_TRUE(low2_spdy->started()); | 614 EXPECT_TRUE(low2_spdy->started()); |
| 612 http_server_properties_.SetSupportsSpdy( | 615 http_server_properties_.SetSupportsSpdy( |
| 613 net::HostPortPair("spdyhost2", 8080), true); | 616 net::HostPortPair("spdyhost2", 8080), true); |
| 614 ChangeRequestPriority(low2_spdy.get(), net::LOWEST); | 617 ChangeRequestPriority(low2_spdy.get(), net::LOWEST); |
| 615 scoped_ptr<TestRequest> low2(NewRequest("http://host/low", net::LOWEST)); | 618 scoped_ptr<TestRequest> low2(NewRequest("http://host/low", net::LOWEST)); |
| 616 EXPECT_TRUE(low2->started()); | 619 EXPECT_TRUE(low2->started()); |
| 617 } | 620 } |
| 618 | 621 |
| 619 TEST_F(ResourceSchedulerTest, ThrottledClientCreation) { | 622 TEST_F(ResourceSchedulerTest, ThrottledClientCreation) { |
| 623 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 624 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 625 false /* should_coalesce */); |
| 620 EXPECT_TRUE(scheduler_.should_throttle()); | 626 EXPECT_TRUE(scheduler_.should_throttle()); |
| 621 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 627 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 622 | 628 |
| 623 EXPECT_EQ(ResourceScheduler::THROTTLED, | 629 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 624 scheduler_.GetClientStateForTesting(kBackgroundChildId2, | 630 scheduler_.GetClientStateForTesting(kBackgroundChildId2, |
| 625 kBackgroundRouteId2)); | 631 kBackgroundRouteId2)); |
| 626 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 632 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 627 } | 633 } |
| 628 | 634 |
| 629 TEST_F(ResourceSchedulerTest, ActiveClientThrottleUpdateOnLoadingChange) { | 635 TEST_F(ResourceSchedulerTest, ActiveClientThrottleUpdateOnLoadingChange) { |
| 636 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 637 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 638 false /* should_coalesce */); |
| 630 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 639 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 631 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 640 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 632 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); | 641 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
| 633 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 642 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 634 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 643 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 635 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, false); | 644 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, false); |
| 636 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 645 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 637 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 646 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 638 } | 647 } |
| 639 | 648 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 665 kBackgroundRouteId)); | 674 kBackgroundRouteId)); |
| 666 | 675 |
| 667 scheduler_.OnLoadingStateChanged( | 676 scheduler_.OnLoadingStateChanged( |
| 668 kBackgroundChildId, kBackgroundRouteId, false); | 677 kBackgroundChildId, kBackgroundRouteId, false); |
| 669 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 678 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 670 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 679 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 671 kBackgroundRouteId)); | 680 kBackgroundRouteId)); |
| 672 } | 681 } |
| 673 | 682 |
| 674 TEST_F(ResourceSchedulerTest, OneRequestPerThrottledClient) { | 683 TEST_F(ResourceSchedulerTest, OneRequestPerThrottledClient) { |
| 684 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 685 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 686 false /* should_coalesce */); |
| 675 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 687 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 676 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 688 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 677 EXPECT_EQ(ResourceScheduler::THROTTLED, | 689 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 678 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 690 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 679 kBackgroundRouteId)); | 691 kBackgroundRouteId)); |
| 680 scoped_ptr<TestRequest> high( | 692 scoped_ptr<TestRequest> high( |
| 681 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 693 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 682 scoped_ptr<TestRequest> request( | 694 scoped_ptr<TestRequest> request( |
| 683 NewBackgroundRequest("http://host/req", net::IDLE)); | 695 NewBackgroundRequest("http://host/req", net::IDLE)); |
| 684 | 696 |
| 685 EXPECT_TRUE(high->started()); | 697 EXPECT_TRUE(high->started()); |
| 686 EXPECT_FALSE(request->started()); | 698 EXPECT_FALSE(request->started()); |
| 687 } | 699 } |
| 688 | 700 |
| 689 TEST_F(ResourceSchedulerTest, UnthrottleNewlyVisibleClient) { | 701 TEST_F(ResourceSchedulerTest, UnthrottleNewlyVisibleClient) { |
| 702 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 703 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 704 false /* should_coalesce */); |
| 690 EXPECT_EQ(ResourceScheduler::THROTTLED, | 705 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 691 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 706 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 692 kBackgroundRouteId)); | 707 kBackgroundRouteId)); |
| 693 scoped_ptr<TestRequest> high( | 708 scoped_ptr<TestRequest> high( |
| 694 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 709 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 695 scoped_ptr<TestRequest> request( | 710 scoped_ptr<TestRequest> request( |
| 696 NewBackgroundRequest("http://host/req", net::IDLE)); | 711 NewBackgroundRequest("http://host/req", net::IDLE)); |
| 697 EXPECT_FALSE(request->started()); | 712 EXPECT_FALSE(request->started()); |
| 698 | 713 |
| 699 scheduler_.OnVisibilityChanged(kBackgroundChildId, kBackgroundRouteId, true); | 714 scheduler_.OnVisibilityChanged(kBackgroundChildId, kBackgroundRouteId, true); |
| 700 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 715 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 701 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 716 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 702 kBackgroundRouteId)); | 717 kBackgroundRouteId)); |
| 703 EXPECT_TRUE(request->started()); | 718 EXPECT_TRUE(request->started()); |
| 704 } | 719 } |
| 705 | 720 |
| 706 TEST_F(ResourceSchedulerTest, UnthrottleNewlyAudibleClient) { | 721 TEST_F(ResourceSchedulerTest, UnthrottleNewlyAudibleClient) { |
| 722 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 723 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 724 false /* should_coalesce */); |
| 707 EXPECT_EQ(ResourceScheduler::THROTTLED, | 725 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 708 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 726 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 709 kBackgroundRouteId)); | 727 kBackgroundRouteId)); |
| 710 scoped_ptr<TestRequest> high( | 728 scoped_ptr<TestRequest> high( |
| 711 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 729 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 712 scoped_ptr<TestRequest> request( | 730 scoped_ptr<TestRequest> request( |
| 713 NewBackgroundRequest("http://host/req", net::IDLE)); | 731 NewBackgroundRequest("http://host/req", net::IDLE)); |
| 714 EXPECT_FALSE(request->started()); | 732 EXPECT_FALSE(request->started()); |
| 715 | 733 |
| 716 scheduler_.OnAudibilityChanged(kBackgroundChildId, kBackgroundRouteId, true); | 734 scheduler_.OnAudibilityChanged(kBackgroundChildId, kBackgroundRouteId, true); |
| 717 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 735 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 718 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 736 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 719 kBackgroundRouteId)); | 737 kBackgroundRouteId)); |
| 720 EXPECT_TRUE(request->started()); | 738 EXPECT_TRUE(request->started()); |
| 721 } | 739 } |
| 722 | 740 |
| 723 TEST_F(ResourceSchedulerTest, VisibleClientStillUnthrottledOnAudabilityChange) { | 741 TEST_F(ResourceSchedulerTest, VisibleClientStillUnthrottledOnAudabilityChange) { |
| 742 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 743 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 744 false /* should_coalesce */); |
| 724 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 745 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 725 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 746 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 726 EXPECT_EQ(ResourceScheduler::THROTTLED, | 747 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 727 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 748 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 728 kBackgroundRouteId)); | 749 kBackgroundRouteId)); |
| 729 | 750 |
| 730 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); | 751 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
| 731 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 752 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 732 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 753 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 733 EXPECT_EQ(ResourceScheduler::THROTTLED, | 754 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 734 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 755 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 735 kBackgroundRouteId)); | 756 kBackgroundRouteId)); |
| 736 | 757 |
| 737 scheduler_.OnAudibilityChanged(kChildId, kRouteId, false); | 758 scheduler_.OnAudibilityChanged(kChildId, kRouteId, false); |
| 738 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 759 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 739 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 760 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 740 EXPECT_EQ(ResourceScheduler::THROTTLED, | 761 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 741 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 762 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 742 kBackgroundRouteId)); | 763 kBackgroundRouteId)); |
| 743 } | 764 } |
| 744 | 765 |
| 745 TEST_F(ResourceSchedulerTest, AudibleClientStillUnthrottledOnVisabilityChange) { | 766 TEST_F(ResourceSchedulerTest, AudibleClientStillUnthrottledOnVisabilityChange) { |
| 767 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 768 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 769 false /* should_coalesce */); |
| 746 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 770 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 747 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); | 771 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
| 748 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 772 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 749 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 773 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 750 EXPECT_EQ(ResourceScheduler::THROTTLED, | 774 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 751 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 775 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 752 kBackgroundRouteId)); | 776 kBackgroundRouteId)); |
| 753 | 777 |
| 754 scheduler_.OnVisibilityChanged(kChildId, kRouteId, true); | 778 scheduler_.OnVisibilityChanged(kChildId, kRouteId, true); |
| 755 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 779 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 756 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 780 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 757 EXPECT_EQ(ResourceScheduler::THROTTLED, | 781 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 758 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 782 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 759 kBackgroundRouteId)); | 783 kBackgroundRouteId)); |
| 760 | 784 |
| 761 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 785 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 762 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 786 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 763 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 787 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 764 EXPECT_EQ(ResourceScheduler::THROTTLED, | 788 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 765 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 789 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 766 kBackgroundRouteId)); | 790 kBackgroundRouteId)); |
| 767 } | 791 } |
| 768 | 792 |
| 769 TEST_F(ResourceSchedulerTest, ThrottledClientStartsNextHighestPriorityRequest) { | 793 TEST_F(ResourceSchedulerTest, ThrottledClientStartsNextHighestPriorityRequest) { |
| 794 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 795 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 796 false /* should_coalesce */); |
| 770 scoped_ptr<TestRequest> request( | 797 scoped_ptr<TestRequest> request( |
| 771 NewBackgroundRequest("http://host/req", net::IDLE)); | 798 NewBackgroundRequest("http://host/req", net::IDLE)); |
| 772 // Lower priority request started first to test request prioritizaton. | 799 // Lower priority request started first to test request prioritizaton. |
| 773 scoped_ptr<TestRequest> low( | 800 scoped_ptr<TestRequest> low( |
| 774 NewBackgroundRequest("http://host/high", net::IDLE)); | 801 NewBackgroundRequest("http://host/high", net::IDLE)); |
| 775 scoped_ptr<TestRequest> high( | 802 scoped_ptr<TestRequest> high( |
| 776 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 803 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 777 | 804 |
| 778 EXPECT_FALSE(low->started()); | 805 EXPECT_FALSE(low->started()); |
| 779 EXPECT_FALSE(high->started()); | 806 EXPECT_FALSE(high->started()); |
| 780 | 807 |
| 781 // request->CancelRequest(); | 808 // request->CancelRequest(); |
| 782 request->Cancel(); | 809 request->Cancel(); |
| 783 EXPECT_TRUE(high->started()); | 810 EXPECT_TRUE(high->started()); |
| 784 EXPECT_FALSE(low->started()); | 811 EXPECT_FALSE(low->started()); |
| 785 } | 812 } |
| 786 | 813 |
| 787 TEST_F(ResourceSchedulerTest, ThrottledSpdyProxySchedulesImmediately) { | 814 TEST_F(ResourceSchedulerTest, ThrottledSpdyProxySchedulesImmediately) { |
| 815 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 816 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 817 false /* should_coalesce */); |
| 788 EXPECT_EQ(ResourceScheduler::THROTTLED, | 818 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 789 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 819 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 790 kBackgroundRouteId)); | 820 kBackgroundRouteId)); |
| 791 scoped_ptr<TestRequest> high( | 821 scoped_ptr<TestRequest> high( |
| 792 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 822 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 793 scoped_ptr<TestRequest> request( | 823 scoped_ptr<TestRequest> request( |
| 794 NewBackgroundRequest("http://host/req", net::IDLE)); | 824 NewBackgroundRequest("http://host/req", net::IDLE)); |
| 795 | 825 |
| 796 EXPECT_FALSE(request->started()); | 826 EXPECT_FALSE(request->started()); |
| 797 | 827 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 scheduler_.OnReceivedSpdyProxiedHttpResponse(kBackgroundChildId, | 879 scheduler_.OnReceivedSpdyProxiedHttpResponse(kBackgroundChildId, |
| 850 kBackgroundRouteId); | 880 kBackgroundRouteId); |
| 851 EXPECT_FALSE(request->started()); | 881 EXPECT_FALSE(request->started()); |
| 852 | 882 |
| 853 scoped_ptr<TestRequest> after( | 883 scoped_ptr<TestRequest> after( |
| 854 NewBackgroundRequest("http://host/after", net::IDLE)); | 884 NewBackgroundRequest("http://host/after", net::IDLE)); |
| 855 EXPECT_FALSE(after->started()); | 885 EXPECT_FALSE(after->started()); |
| 856 } | 886 } |
| 857 | 887 |
| 858 TEST_F(ResourceSchedulerTest, ThrottledNonHTTPSchedulesImmediately) { | 888 TEST_F(ResourceSchedulerTest, ThrottledNonHTTPSchedulesImmediately) { |
| 889 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 890 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 891 false /* should_coalesce */); |
| 859 // Dummies to enforce scheduling. | 892 // Dummies to enforce scheduling. |
| 860 scoped_ptr<TestRequest> high( | 893 scoped_ptr<TestRequest> high( |
| 861 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 894 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 862 scoped_ptr<TestRequest> low( | 895 scoped_ptr<TestRequest> low( |
| 863 NewBackgroundRequest("http://host/low", net::LOWEST)); | 896 NewBackgroundRequest("http://host/low", net::LOWEST)); |
| 864 | 897 |
| 865 scoped_ptr<TestRequest> request( | 898 scoped_ptr<TestRequest> request( |
| 866 NewBackgroundRequest("chrome-extension://req", net::LOWEST)); | 899 NewBackgroundRequest("chrome-extension://req", net::LOWEST)); |
| 867 EXPECT_TRUE(request->started()); | 900 EXPECT_TRUE(request->started()); |
| 868 EXPECT_FALSE(low->started()); | 901 EXPECT_FALSE(low->started()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 883 scoped_ptr<TestRequest> low( | 916 scoped_ptr<TestRequest> low( |
| 884 NewBackgroundRequest("http://host/low", net::LOWEST)); | 917 NewBackgroundRequest("http://host/low", net::LOWEST)); |
| 885 | 918 |
| 886 scoped_ptr<TestRequest> request( | 919 scoped_ptr<TestRequest> request( |
| 887 NewBackgroundRequest("chrome-extension://req", net::LOWEST)); | 920 NewBackgroundRequest("chrome-extension://req", net::LOWEST)); |
| 888 EXPECT_TRUE(request->started()); | 921 EXPECT_TRUE(request->started()); |
| 889 EXPECT_FALSE(low->started()); | 922 EXPECT_FALSE(low->started()); |
| 890 } | 923 } |
| 891 | 924 |
| 892 TEST_F(ResourceSchedulerTest, ThrottledSyncSchedulesImmediately) { | 925 TEST_F(ResourceSchedulerTest, ThrottledSyncSchedulesImmediately) { |
| 926 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 927 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 928 false /* should_coalesce */); |
| 893 // Dummies to enforce scheduling. | 929 // Dummies to enforce scheduling. |
| 894 scoped_ptr<TestRequest> high( | 930 scoped_ptr<TestRequest> high( |
| 895 NewBackgroundRequest("http://host/high", net::HIGHEST)); | 931 NewBackgroundRequest("http://host/high", net::HIGHEST)); |
| 896 scoped_ptr<TestRequest> low( | 932 scoped_ptr<TestRequest> low( |
| 897 NewBackgroundRequest("http://host/low", net::LOWEST)); | 933 NewBackgroundRequest("http://host/low", net::LOWEST)); |
| 898 | 934 |
| 899 scoped_ptr<TestRequest> request( | 935 scoped_ptr<TestRequest> request( |
| 900 NewBackgroundSyncRequest("http://host/req", net::LOWEST)); | 936 NewBackgroundSyncRequest("http://host/req", net::LOWEST)); |
| 901 EXPECT_TRUE(request->started()); | 937 EXPECT_TRUE(request->started()); |
| 902 EXPECT_FALSE(low->started()); | 938 EXPECT_FALSE(low->started()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 918 NewBackgroundRequest("http://host/low", net::LOWEST)); | 954 NewBackgroundRequest("http://host/low", net::LOWEST)); |
| 919 | 955 |
| 920 scoped_ptr<TestRequest> request( | 956 scoped_ptr<TestRequest> request( |
| 921 NewBackgroundSyncRequest("http://host/req", net::LOWEST)); | 957 NewBackgroundSyncRequest("http://host/req", net::LOWEST)); |
| 922 EXPECT_TRUE(request->started()); | 958 EXPECT_TRUE(request->started()); |
| 923 EXPECT_FALSE(low->started()); | 959 EXPECT_FALSE(low->started()); |
| 924 EXPECT_FALSE(high->started()); | 960 EXPECT_FALSE(high->started()); |
| 925 } | 961 } |
| 926 | 962 |
| 927 TEST_F(ResourceSchedulerTest, AllBackgroundClientsUnthrottle) { | 963 TEST_F(ResourceSchedulerTest, AllBackgroundClientsUnthrottle) { |
| 964 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 965 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 966 false /* should_coalesce */); |
| 928 EXPECT_EQ(ResourceScheduler::THROTTLED, | 967 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 929 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 968 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 930 kBackgroundRouteId)); | 969 kBackgroundRouteId)); |
| 931 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 970 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 932 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 971 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 933 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 972 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 934 | 973 |
| 935 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 974 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 936 EXPECT_TRUE(scheduler_.active_clients_loaded()); | 975 EXPECT_TRUE(scheduler_.active_clients_loaded()); |
| 937 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 976 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 959 kBackgroundChildId, kBackgroundRouteId, true); | 998 kBackgroundChildId, kBackgroundRouteId, true); |
| 960 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 999 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 961 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1000 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 962 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 1001 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 963 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1002 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 964 kBackgroundRouteId)); | 1003 kBackgroundRouteId)); |
| 965 } | 1004 } |
| 966 | 1005 |
| 967 TEST_F(ResourceSchedulerTest, | 1006 TEST_F(ResourceSchedulerTest, |
| 968 UnloadedClientVisibilityChangedCorrectlyUnthrottles) { | 1007 UnloadedClientVisibilityChangedCorrectlyUnthrottles) { |
| 1008 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1009 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1010 false /* should_coalesce */); |
| 969 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1011 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 970 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1012 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 971 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); | 1013 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
| 972 scheduler_.OnLoadingStateChanged( | 1014 scheduler_.OnLoadingStateChanged( |
| 973 kBackgroundChildId2, kBackgroundRouteId2, true); | 1015 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 974 | 1016 |
| 975 // 1 visible, 3 hidden | 1017 // 1 visible, 3 hidden |
| 976 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1018 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 977 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1019 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 978 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1020 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1054 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1013 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1055 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1014 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1056 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1015 | 1057 |
| 1016 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1058 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1017 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1059 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1018 } | 1060 } |
| 1019 | 1061 |
| 1020 TEST_F(ResourceSchedulerTest, | 1062 TEST_F(ResourceSchedulerTest, |
| 1021 UnloadedClientAudibilityChangedCorrectlyUnthrottles) { | 1063 UnloadedClientAudibilityChangedCorrectlyUnthrottles) { |
| 1064 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1065 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1066 false /* should_coalesce */); |
| 1022 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1067 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1023 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1068 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1024 scheduler_.OnLoadingStateChanged( | 1069 scheduler_.OnLoadingStateChanged( |
| 1025 kBackgroundChildId2, kBackgroundRouteId2, true); | 1070 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1026 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 1071 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 1027 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); | 1072 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
| 1028 | 1073 |
| 1029 // 1 audible, 3 hidden | 1074 // 1 audible, 3 hidden |
| 1030 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1075 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1031 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1076 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1111 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1067 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1112 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1068 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1113 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1069 | 1114 |
| 1070 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1115 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1071 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1116 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1072 } | 1117 } |
| 1073 | 1118 |
| 1074 TEST_F(ResourceSchedulerTest, | 1119 TEST_F(ResourceSchedulerTest, |
| 1075 LoadedClientVisibilityChangedCorrectlyUnthrottles) { | 1120 LoadedClientVisibilityChangedCorrectlyUnthrottles) { |
| 1121 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1122 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1123 false /* should_coalesce */); |
| 1076 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1124 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1077 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1125 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1078 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); | 1126 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
| 1079 scheduler_.OnLoadingStateChanged( | 1127 scheduler_.OnLoadingStateChanged( |
| 1080 kBackgroundChildId2, kBackgroundRouteId2, true); | 1128 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1081 // 1 visible, 3 hidden | 1129 // 1 visible, 3 hidden |
| 1082 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1130 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1083 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1131 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1084 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1132 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 1085 kBackgroundRouteId)); | 1133 kBackgroundRouteId)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1166 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1119 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1167 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1120 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1168 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1121 | 1169 |
| 1122 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1170 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1123 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1171 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1124 } | 1172 } |
| 1125 | 1173 |
| 1126 TEST_F(ResourceSchedulerTest, | 1174 TEST_F(ResourceSchedulerTest, |
| 1127 LoadedClientAudibilityChangedCorrectlyUnthrottles) { | 1175 LoadedClientAudibilityChangedCorrectlyUnthrottles) { |
| 1176 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1177 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1178 false /* should_coalesce */); |
| 1128 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1179 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1129 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1180 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1130 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); | 1181 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
| 1131 scheduler_.OnLoadingStateChanged( | 1182 scheduler_.OnLoadingStateChanged( |
| 1132 kBackgroundChildId2, kBackgroundRouteId2, true); | 1183 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1133 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 1184 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 1134 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); | 1185 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
| 1135 // 1 audible, 3 hidden | 1186 // 1 audible, 3 hidden |
| 1136 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1187 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1137 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1188 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1222 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1172 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1223 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1173 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1224 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1174 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1225 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1175 | 1226 |
| 1176 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1227 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1177 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1228 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1178 } | 1229 } |
| 1179 | 1230 |
| 1180 TEST_F(ResourceSchedulerTest, UnloadedClientBecomesHiddenCorrectlyUnthrottles) { | 1231 TEST_F(ResourceSchedulerTest, UnloadedClientBecomesHiddenCorrectlyUnthrottles) { |
| 1232 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1233 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1234 false /* should_coalesce */); |
| 1181 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1235 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1182 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1236 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1183 scheduler_.OnLoadingStateChanged( | 1237 scheduler_.OnLoadingStateChanged( |
| 1184 kBackgroundChildId2, kBackgroundRouteId2, true); | 1238 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1185 | 1239 |
| 1186 // 2 visible, 2 hidden | 1240 // 2 visible, 2 hidden |
| 1187 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); | 1241 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); |
| 1188 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1242 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1189 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1243 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1190 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1244 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1291 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1238 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1292 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1239 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1293 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1240 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1294 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1241 | 1295 |
| 1242 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1296 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1243 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1297 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1244 } | 1298 } |
| 1245 | 1299 |
| 1246 TEST_F(ResourceSchedulerTest, UnloadedClientBecomesSilentCorrectlyUnthrottles) { | 1300 TEST_F(ResourceSchedulerTest, UnloadedClientBecomesSilentCorrectlyUnthrottles) { |
| 1301 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1302 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1303 false /* should_coalesce */); |
| 1247 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1304 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1248 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1305 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1249 scheduler_.OnLoadingStateChanged( | 1306 scheduler_.OnLoadingStateChanged( |
| 1250 kBackgroundChildId2, kBackgroundRouteId2, true); | 1307 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1251 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); | 1308 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
| 1252 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 1309 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 1253 scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); | 1310 scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); |
| 1254 // 2 audible, 2 hidden | 1311 // 2 audible, 2 hidden |
| 1255 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1312 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1256 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1313 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1361 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1305 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1362 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1306 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1363 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1307 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1364 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1308 | 1365 |
| 1309 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1366 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1310 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1367 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1311 } | 1368 } |
| 1312 | 1369 |
| 1313 TEST_F(ResourceSchedulerTest, LoadedClientBecomesHiddenCorrectlyThrottles) { | 1370 TEST_F(ResourceSchedulerTest, LoadedClientBecomesHiddenCorrectlyThrottles) { |
| 1371 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1372 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1373 false /* should_coalesce */); |
| 1314 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1374 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1315 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1375 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1316 scheduler_.OnLoadingStateChanged( | 1376 scheduler_.OnLoadingStateChanged( |
| 1317 kBackgroundChildId2, kBackgroundRouteId2, true); | 1377 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1318 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); | 1378 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
| 1319 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); | 1379 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); |
| 1320 // 2 visible, 2 hidden | 1380 // 2 visible, 2 hidden |
| 1321 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1381 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1322 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1382 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1323 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1383 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 1430 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 1371 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1431 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1372 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 1432 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 1373 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1433 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1374 | 1434 |
| 1375 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1435 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1376 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1436 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1377 } | 1437 } |
| 1378 | 1438 |
| 1379 TEST_F(ResourceSchedulerTest, LoadedClientBecomesSilentCorrectlyThrottles) { | 1439 TEST_F(ResourceSchedulerTest, LoadedClientBecomesSilentCorrectlyThrottles) { |
| 1440 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1441 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1442 false /* should_coalesce */); |
| 1380 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1443 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1381 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1444 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1382 scheduler_.OnLoadingStateChanged( | 1445 scheduler_.OnLoadingStateChanged( |
| 1383 kBackgroundChildId2, kBackgroundRouteId2, true); | 1446 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1384 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); | 1447 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
| 1385 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); | 1448 scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); |
| 1386 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); | 1449 scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); |
| 1387 scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); | 1450 scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); |
| 1388 // 2 audible, 2 hidden | 1451 // 2 audible, 2 hidden |
| 1389 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1452 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 1501 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 1439 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1502 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1440 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 1503 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 1441 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1504 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1442 | 1505 |
| 1443 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1506 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1444 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1507 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1445 } | 1508 } |
| 1446 | 1509 |
| 1447 TEST_F(ResourceSchedulerTest, HiddenLoadedChangesCorrectlyStayThrottled) { | 1510 TEST_F(ResourceSchedulerTest, HiddenLoadedChangesCorrectlyStayThrottled) { |
| 1511 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1512 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1513 false /* should_coalesce */); |
| 1448 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1514 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1449 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1515 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1450 | 1516 |
| 1451 // 1 visible and 2 hidden loading, 1 visible loaded | 1517 // 1 visible and 2 hidden loading, 1 visible loaded |
| 1452 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); | 1518 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); |
| 1453 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); | 1519 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
| 1454 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1520 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1455 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1521 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1456 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1522 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| 1457 kBackgroundRouteId)); | 1523 kBackgroundRouteId)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1572 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1507 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1573 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1508 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, | 1574 EXPECT_EQ(ResourceScheduler::UNTHROTTLED, |
| 1509 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1575 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1510 | 1576 |
| 1511 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1577 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1512 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1578 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1513 } | 1579 } |
| 1514 | 1580 |
| 1515 TEST_F(ResourceSchedulerTest, PartialVisibleClientLoadedDoesNotUnthrottle) { | 1581 TEST_F(ResourceSchedulerTest, PartialVisibleClientLoadedDoesNotUnthrottle) { |
| 1582 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1583 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1584 false /* should_coalesce */); |
| 1516 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1585 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1517 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1586 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1518 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); | 1587 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); |
| 1519 | 1588 |
| 1520 // 2 visible loading, 1 hidden loading, 1 hidden loaded | 1589 // 2 visible loading, 1 hidden loading, 1 hidden loaded |
| 1521 scheduler_.OnLoadingStateChanged( | 1590 scheduler_.OnLoadingStateChanged( |
| 1522 kBackgroundChildId2, kBackgroundRouteId2, true); | 1591 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1523 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1592 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1524 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1593 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| 1525 scheduler_.GetClientStateForTesting(kBackgroundChildId, | 1594 scheduler_.GetClientStateForTesting(kBackgroundChildId, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1627 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1559 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1628 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1560 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1629 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1561 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1630 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1562 | 1631 |
| 1563 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1632 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1564 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1633 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1565 } | 1634 } |
| 1566 | 1635 |
| 1567 TEST_F(ResourceSchedulerTest, FullVisibleLoadedCorrectlyUnthrottle) { | 1636 TEST_F(ResourceSchedulerTest, FullVisibleLoadedCorrectlyUnthrottle) { |
| 1637 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1638 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1639 false /* should_coalesce */); |
| 1568 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1640 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1569 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1641 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1570 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); | 1642 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); |
| 1571 | 1643 |
| 1572 // 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading | 1644 // 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading |
| 1573 scheduler_.OnLoadingStateChanged( | 1645 scheduler_.OnLoadingStateChanged( |
| 1574 kBackgroundChildId2, kBackgroundRouteId2, true); | 1646 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1575 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); | 1647 scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); |
| 1576 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1648 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1577 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1649 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); | 1694 scheduler_.GetClientStateForTesting(kChildId2, kRouteId2)); |
| 1623 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1695 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1624 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1696 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1625 | 1697 |
| 1626 scheduler_.OnClientDeleted(kChildId2, kRouteId2); | 1698 scheduler_.OnClientDeleted(kChildId2, kRouteId2); |
| 1627 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1699 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1628 } | 1700 } |
| 1629 | 1701 |
| 1630 TEST_F(ResourceSchedulerTest, | 1702 TEST_F(ResourceSchedulerTest, |
| 1631 ActiveAndLoadingClientDeletedCorrectlyUnthrottle) { | 1703 ActiveAndLoadingClientDeletedCorrectlyUnthrottle) { |
| 1704 // TODO(aiolos): remove when throttling and coalescing have both landed |
| 1705 scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, |
| 1706 false /* should_coalesce */); |
| 1632 scheduler_.OnClientCreated(kChildId2, kRouteId2); | 1707 scheduler_.OnClientCreated(kChildId2, kRouteId2); |
| 1633 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); | 1708 scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2); |
| 1634 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); | 1709 scheduler_.OnVisibilityChanged(kChildId2, kRouteId2, true); |
| 1635 | 1710 |
| 1636 // 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading | 1711 // 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading |
| 1637 scheduler_.OnLoadingStateChanged( | 1712 scheduler_.OnLoadingStateChanged( |
| 1638 kBackgroundChildId2, kBackgroundRouteId2, true); | 1713 kBackgroundChildId2, kBackgroundRouteId2, true); |
| 1639 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); | 1714 scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); |
| 1640 EXPECT_FALSE(scheduler_.active_clients_loaded()); | 1715 EXPECT_FALSE(scheduler_.active_clients_loaded()); |
| 1641 EXPECT_EQ(ResourceScheduler::THROTTLED, | 1716 EXPECT_EQ(ResourceScheduler::THROTTLED, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1672 kBackgroundRouteId2)); | 1747 kBackgroundRouteId2)); |
| 1673 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, | 1748 EXPECT_EQ(ResourceScheduler::ACTIVE_AND_LOADING, |
| 1674 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); | 1749 scheduler_.GetClientStateForTesting(kChildId, kRouteId)); |
| 1675 | 1750 |
| 1676 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); | 1751 scheduler_.OnClientDeleted(kBackgroundChildId2, kBackgroundRouteId2); |
| 1677 } | 1752 } |
| 1678 | 1753 |
| 1679 } // unnamed namespace | 1754 } // unnamed namespace |
| 1680 | 1755 |
| 1681 } // namespace content | 1756 } // namespace content |
| OLD | NEW |