| OLD | NEW |
| 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 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_ | 5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ | 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 ~TestDelayBasedTimeSource() override; | 69 ~TestDelayBasedTimeSource() override; |
| 70 base::TimeTicks Now() const override; | 70 base::TimeTicks Now() const override; |
| 71 std::string TypeString() const override; | 71 std::string TypeString() const override; |
| 72 | 72 |
| 73 scoped_refptr<TestNowSource> now_src_; | 73 scoped_refptr<TestNowSource> now_src_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 struct FakeBeginFrameSource : public BeginFrameSourceMixIn { | 76 struct FakeBeginFrameSource : public BeginFrameSourceMixIn { |
| 77 bool remaining_frames_ = false; | 77 bool remaining_frames_ = false; |
| 78 | 78 |
| 79 BeginFrameObserver* GetObserver() { return observer_; } | 79 BeginFrameObserver* GetObserver() { |
| 80 if ((observer_list_).might_have_observers()) { |
| 81 ObserverList<BeginFrameObserver>::Iterator it(&observer_list_); |
| 82 BeginFrameObserver* obs; |
| 83 while ((obs = it.GetNext()) != nullptr) { |
| 84 return obs; |
| 85 } |
| 86 } |
| 87 return nullptr; |
| 88 } |
| 80 | 89 |
| 81 BeginFrameArgs TestLastUsedBeginFrameArgs() { | 90 BeginFrameArgs TestLastUsedBeginFrameArgs() { |
| 82 if (observer_) { | 91 BeginFrameObserver* obs = GetObserver(); |
| 83 return observer_->LastUsedBeginFrameArgs(); | 92 if (obs) { |
| 93 return obs->LastUsedBeginFrameArgs(); |
| 84 } | 94 } |
| 85 return BeginFrameArgs(); | 95 return BeginFrameArgs(); |
| 86 } | 96 } |
| 87 void TestOnBeginFrame(const BeginFrameArgs& args) { | 97 void TestOnBeginFrame(const BeginFrameArgs& args) { |
| 88 return CallOnBeginFrame(args); | 98 return CallOnBeginFrame(args); |
| 89 } | 99 } |
| 90 | 100 |
| 91 // BeginFrameSource | 101 // BeginFrameSource |
| 92 void DidFinishFrame(size_t remaining_frames) override; | 102 void DidFinishFrame(size_t remaining_frames) override; |
| 93 void AsValueInto(base::trace_event::TracedValue* dict) const override; | 103 void AsValueInto(base::trace_event::TracedValue* dict) override; |
| 94 | 104 |
| 95 ~FakeBeginFrameSource() override {} | 105 ~FakeBeginFrameSource() override {} |
| 96 }; | 106 }; |
| 97 | 107 |
| 98 class TestBackToBackBeginFrameSource : public BackToBackBeginFrameSource { | 108 class TestBackToBackBeginFrameSource : public BackToBackBeginFrameSource { |
| 99 public: | 109 public: |
| 100 ~TestBackToBackBeginFrameSource() override; | 110 ~TestBackToBackBeginFrameSource() override; |
| 101 | 111 |
| 102 static scoped_ptr<TestBackToBackBeginFrameSource> Create( | 112 static scoped_ptr<TestBackToBackBeginFrameSource> Create( |
| 103 scoped_refptr<TestNowSource> now_src, | 113 scoped_refptr<TestNowSource> now_src, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, | 219 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, |
| 210 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, | 220 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, |
| 211 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 221 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
| 212 | 222 |
| 213 scoped_refptr<TestNowSource> now_src_; | 223 scoped_refptr<TestNowSource> now_src_; |
| 214 }; | 224 }; |
| 215 | 225 |
| 216 } // namespace cc | 226 } // namespace cc |
| 217 | 227 |
| 218 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 228 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| OLD | NEW |