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

Side by Side Diff: cc/scheduler/scheduler_unittest.cc

Issue 787763006: cc: Adding BeginFrameTracker object and removing Now() from LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing for Brian's comments. Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(), 1139 EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(),
1140 should_send_begin_main_frame); 1140 should_send_begin_main_frame);
1141 EXPECT_EQ(client.HasAction("ScheduledActionSendBeginMainFrame"), 1141 EXPECT_EQ(client.HasAction("ScheduledActionSendBeginMainFrame"),
1142 should_send_begin_main_frame); 1142 should_send_begin_main_frame);
1143 } 1143 }
1144 1144
1145 TEST(SchedulerTest, 1145 TEST(SchedulerTest,
1146 SkipMainFrameIfHighLatencyAndCanCommitAndActivateBeforeDeadline) { 1146 SkipMainFrameIfHighLatencyAndCanCommitAndActivateBeforeDeadline) {
1147 // Set up client so that estimates indicate that we can commit and activate 1147 // Set up client so that estimates indicate that we can commit and activate
1148 // before the deadline (~8ms by default). 1148 // before the deadline (~8ms by default).
1149 MainFrameInHighLatencyMode(1, 1, false, false); 1149 EXPECT_SCOPED(MainFrameInHighLatencyMode(1, 1, false, false));
1150 } 1150 }
1151 1151
1152 TEST(SchedulerTest, NotSkipMainFrameIfHighLatencyAndCanCommitTooLong) { 1152 TEST(SchedulerTest, NotSkipMainFrameIfHighLatencyAndCanCommitTooLong) {
1153 // Set up client so that estimates indicate that the commit cannot finish 1153 // Set up client so that estimates indicate that the commit cannot finish
1154 // before the deadline (~8ms by default). 1154 // before the deadline (~8ms by default).
1155 MainFrameInHighLatencyMode(10, 1, false, true); 1155 EXPECT_SCOPED(MainFrameInHighLatencyMode(10, 1, false, true));
1156 } 1156 }
1157 1157
1158 TEST(SchedulerTest, NotSkipMainFrameIfHighLatencyAndCanActivateTooLong) { 1158 TEST(SchedulerTest, NotSkipMainFrameIfHighLatencyAndCanActivateTooLong) {
1159 // Set up client so that estimates indicate that the activate cannot finish 1159 // Set up client so that estimates indicate that the activate cannot finish
1160 // before the deadline (~8ms by default). 1160 // before the deadline (~8ms by default).
1161 MainFrameInHighLatencyMode(1, 10, false, true); 1161 EXPECT_SCOPED(MainFrameInHighLatencyMode(1, 10, false, true));
1162 } 1162 }
1163 1163
1164 TEST(SchedulerTest, NotSkipMainFrameInPreferImplLatencyMode) { 1164 TEST(SchedulerTest, NotSkipMainFrameInPreferImplLatencyMode) {
1165 // Set up client so that estimates indicate that we can commit and activate 1165 // Set up client so that estimates indicate that we can commit and activate
1166 // before the deadline (~8ms by default), but also enable impl latency takes 1166 // before the deadline (~8ms by default), but also enable impl latency takes
1167 // priority mode. 1167 // priority mode.
1168 MainFrameInHighLatencyMode(1, 1, true, true); 1168 EXPECT_SCOPED(MainFrameInHighLatencyMode(1, 1, true, true));
1169 } 1169 }
1170 1170
1171 TEST(SchedulerTest, PollForCommitCompletion) { 1171 TEST(SchedulerTest, PollForCommitCompletion) {
1172 // Since we are simulating a long commit, set up a client with draw duration 1172 // Since we are simulating a long commit, set up a client with draw duration
1173 // estimates that prevent skipping main frames to get to low latency mode. 1173 // estimates that prevent skipping main frames to get to low latency mode.
1174 SchedulerClientWithFixedEstimates client( 1174 SchedulerClientWithFixedEstimates client(
1175 base::TimeDelta::FromMilliseconds(1), 1175 base::TimeDelta::FromMilliseconds(1),
1176 base::TimeDelta::FromMilliseconds(32), 1176 base::TimeDelta::FromMilliseconds(32),
1177 base::TimeDelta::FromMilliseconds(32)); 1177 base::TimeDelta::FromMilliseconds(32));
1178 SchedulerSettings scheduler_settings; 1178 SchedulerSettings scheduler_settings;
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 2195
2196 // Deadline task is pending 2196 // Deadline task is pending
2197 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 2197 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
2198 client.task_runner().RunPendingTasks(); 2198 client.task_runner().RunPendingTasks();
2199 // Deadline task runs immediately 2199 // Deadline task runs immediately
2200 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 2200 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
2201 } 2201 }
2202 2202
2203 } // namespace 2203 } // namespace
2204 } // namespace cc 2204 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698