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

Side by Side Diff: cc/CCSchedulerTest.cpp

Issue 10956006: Convert CC scheduler logic to use base::TimeTicks/Delta instead of doubles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCScheduler.cpp ('k') | cc/CCThreadProxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 6
7 #include "CCScheduler.h" 7 #include "CCScheduler.h"
8 8
9 #include "CCSchedulerTestCommon.h" 9 #include "CCSchedulerTestCommon.h"
10 #include <gmock/gmock.h> 10 #include <gmock/gmock.h>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 m_numDraws++; 47 m_numDraws++;
48 return CCScheduledActionDrawAndSwapResult(m_drawWillHappen, m_drawWillHa ppen && m_swapWillHappenIfDrawHappens); 48 return CCScheduledActionDrawAndSwapResult(m_drawWillHappen, m_drawWillHa ppen && m_swapWillHappenIfDrawHappens);
49 } 49 }
50 50
51 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced( ) OVERRIDE 51 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced( ) OVERRIDE
52 { 52 {
53 m_actions.push_back("scheduledActionDrawAndSwapForced"); 53 m_actions.push_back("scheduledActionDrawAndSwapForced");
54 return CCScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHa ppens); 54 return CCScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHa ppens);
55 } 55 }
56 56
57 virtual void scheduledActionUpdateMoreResources(double) OVERRIDE { m_actions .push_back("scheduledActionUpdateMoreResources"); } 57 virtual void scheduledActionUpdateMoreResources(base::TimeTicks) OVERRIDE { m_actions.push_back("scheduledActionUpdateMoreResources"); }
58 virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("schedul edActionCommit"); } 58 virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("schedul edActionCommit"); }
59 virtual void scheduledActionBeginContextRecreation() OVERRIDE { m_actions.pu sh_back("scheduledActionBeginContextRecreation"); } 59 virtual void scheduledActionBeginContextRecreation() OVERRIDE { m_actions.pu sh_back("scheduledActionBeginContextRecreation"); }
60 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { m _actions.push_back("scheduledActionAcquireLayerTexturesForMainThread"); } 60 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { m _actions.push_back("scheduledActionAcquireLayerTexturesForMainThread"); }
61 61
62 void setDrawWillHappen(bool drawWillHappen) { m_drawWillHappen = drawWillHap pen; } 62 void setDrawWillHappen(bool drawWillHappen) { m_drawWillHappen = drawWillHap pen; }
63 void setSwapWillHappenIfDrawHappens(bool swapWillHappenIfDrawHappens) { m_sw apWillHappenIfDrawHappens = swapWillHappenIfDrawHappens; } 63 void setSwapWillHappenIfDrawHappens(bool swapWillHappenIfDrawHappens) { m_sw apWillHappenIfDrawHappens = swapWillHappenIfDrawHappens; }
64 64
65 protected: 65 protected:
66 bool m_hasMoreResourceUpdates; 66 bool m_hasMoreResourceUpdates;
67 bool m_drawWillHappen; 67 bool m_drawWillHappen;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 m_scheduler->setNeedsRedraw(); 222 m_scheduler->setNeedsRedraw();
223 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); 223 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible();
224 } 224 }
225 225
226 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced( ) OVERRIDE 226 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced( ) OVERRIDE
227 { 227 {
228 ASSERT_NOT_REACHED(); 228 ASSERT_NOT_REACHED();
229 return CCScheduledActionDrawAndSwapResult(true, true); 229 return CCScheduledActionDrawAndSwapResult(true, true);
230 } 230 }
231 231
232 virtual void scheduledActionUpdateMoreResources(double) OVERRIDE { } 232 virtual void scheduledActionUpdateMoreResources(base::TimeTicks) OVERRIDE { }
233 virtual void scheduledActionCommit() OVERRIDE { } 233 virtual void scheduledActionCommit() OVERRIDE { }
234 virtual void scheduledActionBeginContextRecreation() OVERRIDE { } 234 virtual void scheduledActionBeginContextRecreation() OVERRIDE { }
235 235
236 protected: 236 protected:
237 CCScheduler* m_scheduler; 237 CCScheduler* m_scheduler;
238 }; 238 };
239 239
240 // Tests for two different situations: 240 // Tests for two different situations:
241 // 1. the scheduler dropping setNeedsRedraw requests that happen inside 241 // 1. the scheduler dropping setNeedsRedraw requests that happen inside
242 // a scheduledActionDrawAndSwap 242 // a scheduledActionDrawAndSwap
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 m_scheduler->setNeedsCommit(); 324 m_scheduler->setNeedsCommit();
325 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); 325 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible();
326 } 326 }
327 327
328 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced( ) OVERRIDE 328 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced( ) OVERRIDE
329 { 329 {
330 ASSERT_NOT_REACHED(); 330 ASSERT_NOT_REACHED();
331 return CCScheduledActionDrawAndSwapResult(true, true); 331 return CCScheduledActionDrawAndSwapResult(true, true);
332 } 332 }
333 333
334 virtual void scheduledActionUpdateMoreResources(double) OVERRIDE { } 334 virtual void scheduledActionUpdateMoreResources(base::TimeTicks) OVERRIDE { }
335 virtual void scheduledActionCommit() OVERRIDE { } 335 virtual void scheduledActionCommit() OVERRIDE { }
336 virtual void scheduledActionBeginContextRecreation() OVERRIDE { } 336 virtual void scheduledActionBeginContextRecreation() OVERRIDE { }
337 337
338 protected: 338 protected:
339 CCScheduler* m_scheduler; 339 CCScheduler* m_scheduler;
340 }; 340 };
341 341
342 // Tests for the scheduler infinite-looping on setNeedsCommit requests that 342 // Tests for the scheduler infinite-looping on setNeedsCommit requests that
343 // happen inside a scheduledActionDrawAndSwap 343 // happen inside a scheduledActionDrawAndSwap
344 TEST(CCSchedulerTest, RequestCommitInsideDraw) 344 TEST(CCSchedulerTest, RequestCommitInsideDraw)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // Get the compositor to do a scheduledActionDrawAndSwapForced. 464 // Get the compositor to do a scheduledActionDrawAndSwapForced.
465 scheduler->setNeedsRedraw(); 465 scheduler->setNeedsRedraw();
466 scheduler->setNeedsForcedRedraw(); 466 scheduler->setNeedsForcedRedraw();
467 EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced")); 467 EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced"));
468 468
469 // We should not have told the frame rate controller that we began a frame. 469 // We should not have told the frame rate controller that we began a frame.
470 EXPECT_EQ(0, controllerPtr->numFramesPending()); 470 EXPECT_EQ(0, controllerPtr->numFramesPending());
471 } 471 }
472 472
473 } 473 }
OLDNEW
« no previous file with comments | « cc/CCScheduler.cpp ('k') | cc/CCThreadProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698