OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/scheduler/resource_dispatch_throttler.h" | 5 #include "content/renderer/scheduler/resource_dispatch_throttler.h" |
6 | 6 |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "content/common/resource_messages.h" | 8 #include "content/common/resource_messages.h" |
9 #include "content/test/fake_renderer_scheduler.h" | 9 #include "content/test/fake_renderer_scheduler.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 private: | 59 private: |
60 bool high_priority_work_anticipated_; | 60 bool high_priority_work_anticipated_; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 class ResourceDispatchThrottlerForTest : public ResourceDispatchThrottler { | 65 class ResourceDispatchThrottlerForTest : public ResourceDispatchThrottler { |
66 public: | 66 public: |
67 ResourceDispatchThrottlerForTest(IPC::Sender* sender, | 67 ResourceDispatchThrottlerForTest(IPC::Sender* sender, |
68 RendererScheduler* scheduler) | 68 scheduler::RendererScheduler* scheduler) |
69 : ResourceDispatchThrottler( | 69 : ResourceDispatchThrottler( |
70 sender, | 70 sender, |
71 scheduler, | 71 scheduler, |
72 base::TimeDelta::FromSecondsD(kFlushPeriodSeconds), | 72 base::TimeDelta::FromSecondsD(kFlushPeriodSeconds), |
73 kRequestsPerFlush), | 73 kRequestsPerFlush), |
74 flush_scheduled_(false) {} | 74 flush_scheduled_(false) {} |
75 ~ResourceDispatchThrottlerForTest() override {} | 75 ~ResourceDispatchThrottlerForTest() override {} |
76 | 76 |
77 void Advance(base::TimeDelta delta) { now_ += delta; } | 77 void Advance(base::TimeDelta delta) { now_ += delta; } |
78 | 78 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 EXPECT_EQ(priority_msg.type(), ResourceHostMsg_DidChangePriority::ID); | 361 EXPECT_EQ(priority_msg.type(), ResourceHostMsg_DidChangePriority::ID); |
362 EXPECT_EQ(cancel_msg.type(), ResourceHostMsg_CancelRequest::ID); | 362 EXPECT_EQ(cancel_msg.type(), ResourceHostMsg_CancelRequest::ID); |
363 | 363 |
364 EXPECT_EQ(GetRequestId(request_msg), GetRequestId(priority_msg)); | 364 EXPECT_EQ(GetRequestId(request_msg), GetRequestId(priority_msg)); |
365 EXPECT_EQ(GetRequestId(request_msg) - 1, GetRequestId(cancel_msg)); | 365 EXPECT_EQ(GetRequestId(request_msg) - 1, GetRequestId(cancel_msg)); |
366 } | 366 } |
367 EXPECT_FALSE(FlushScheduled()); | 367 EXPECT_FALSE(FlushScheduled()); |
368 } | 368 } |
369 | 369 |
370 } // namespace content | 370 } // namespace content |
OLD | NEW |