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

Side by Side Diff: cc/scheduler_unittest.cc

Issue 11361223: cc: Remove cc::settings, move them to LayerTreeSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using WebLayerTreeSettings for things WebKit can set Created 8 years, 1 month 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
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.h" 5 #include "cc/scheduler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/test/scheduler_test_common.h" 8 #include "cc/test/scheduler_test_common.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE 48 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE
49 { 49 {
50 m_actions.push_back("scheduledActionDrawAndSwapForced"); 50 m_actions.push_back("scheduledActionDrawAndSwapForced");
51 return ScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHapp ens); 51 return ScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHapp ens);
52 } 52 }
53 53
54 virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("schedul edActionCommit"); } 54 virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("schedul edActionCommit"); }
55 virtual void scheduledActionBeginContextRecreation() OVERRIDE { m_actions.pu sh_back("scheduledActionBeginContextRecreation"); } 55 virtual void scheduledActionBeginContextRecreation() OVERRIDE { m_actions.pu sh_back("scheduledActionBeginContextRecreation"); }
56 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { m _actions.push_back("scheduledActionAcquireLayerTexturesForMainThread"); } 56 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { m _actions.push_back("scheduledActionAcquireLayerTexturesForMainThread"); }
57 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } 57 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { }
58 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; }
58 59
59 void setDrawWillHappen(bool drawWillHappen) { m_drawWillHappen = drawWillHap pen; } 60 void setDrawWillHappen(bool drawWillHappen) { m_drawWillHappen = drawWillHap pen; }
60 void setSwapWillHappenIfDrawHappens(bool swapWillHappenIfDrawHappens) { m_sw apWillHappenIfDrawHappens = swapWillHappenIfDrawHappens; } 61 void setSwapWillHappenIfDrawHappens(bool swapWillHappenIfDrawHappens) { m_sw apWillHappenIfDrawHappens = swapWillHappenIfDrawHappens; }
61 62
62 protected: 63 protected:
63 bool m_drawWillHappen; 64 bool m_drawWillHappen;
64 bool m_swapWillHappenIfDrawHappens; 65 bool m_swapWillHappenIfDrawHappens;
65 int m_numDraws; 66 int m_numDraws;
66 std::vector<const char*> m_actions; 67 std::vector<const char*> m_actions;
68 LayerTreeSettings m_settings;
67 }; 69 };
68 70
69 TEST(SchedulerTest, RequestCommit) 71 TEST(SchedulerTest, RequestCommit)
70 { 72 {
71 FakeSchedulerClient client; 73 FakeSchedulerClient client;
72 scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); 74 scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource());
73 scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr (new FrameRateController(timeSource))); 75 scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr (new FrameRateController(timeSource)));
74 scheduler->setCanBeginFrame(true); 76 scheduler->setCanBeginFrame(true);
75 scheduler->setVisible(true); 77 scheduler->setVisible(true);
76 scheduler->setCanDraw(true); 78 scheduler->setCanDraw(true);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 scheduler->setNeedsRedraw(); 462 scheduler->setNeedsRedraw();
461 scheduler->setNeedsForcedRedraw(); 463 scheduler->setNeedsForcedRedraw();
462 EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced")); 464 EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced"));
463 465
464 // We should not have told the frame rate controller that we began a frame. 466 // We should not have told the frame rate controller that we began a frame.
465 EXPECT_EQ(0, controllerPtr->numFramesPending()); 467 EXPECT_EQ(0, controllerPtr->numFramesPending());
466 } 468 }
467 469
468 } // namespace 470 } // namespace
469 } // namespace cc 471 } // namespace cc
OLDNEW
« cc/layer_tree_host.cc ('K') | « cc/scheduler_state_machine.cc ('k') | cc/settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698