OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <algorithm> | 5 #include <algorithm> |
6 #include <list> | 6 #include <list> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // SendBeginFrame is not called when compositor is reset. | 87 // SendBeginFrame is not called when compositor is reset. |
88 begin_frame_observer.ResetCompositor(); | 88 begin_frame_observer.ResetCompositor(); |
89 cc::BeginFrameArgs args3 = | 89 cc::BeginFrameArgs args3 = |
90 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, | 90 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, |
91 base::TimeTicks::FromInternalValue(99)); | 91 base::TimeTicks::FromInternalValue(99)); |
92 EXPECT_CALL(client, SendBeginFrame(_)).Times(0); | 92 EXPECT_CALL(client, SendBeginFrame(_)).Times(0); |
93 compositor()->SendBeginFramesToChildren(args3); | 93 compositor()->SendBeginFramesToChildren(args3); |
94 Mock::VerifyAndClearExpectations(&client); | 94 Mock::VerifyAndClearExpectations(&client); |
95 } | 95 } |
96 | 96 |
| 97 TEST_F(BeginFrameObserverProxyTest, SingleBeginFrameScheduling) { |
| 98 MockBeginFrameObserverProxyClient client; |
| 99 BeginFrameObserverProxy begin_frame_observer(&client); |
| 100 begin_frame_observer.SetCompositor(compositor()); |
| 101 begin_frame_observer.SetNeedsOneBeginFrame(); |
| 102 |
| 103 // SendBeginFrame is called when new |args| is delivered. |
| 104 cc::BeginFrameArgs args = cc::CreateBeginFrameArgsForTesting( |
| 105 BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(33)); |
| 106 EXPECT_CALL(client, SendBeginFrame(args)); |
| 107 compositor()->SendBeginFramesToChildren(args); |
| 108 Mock::VerifyAndClearExpectations(&client); |
| 109 |
| 110 // SendBeginFrame is not called when new |args2| is delivered, as the |
| 111 // single frame request was already satisified. |
| 112 cc::BeginFrameArgs args2 = cc::CreateBeginFrameArgsForTesting( |
| 113 BEGINFRAME_FROM_HERE, base::TimeTicks::FromInternalValue(66)); |
| 114 EXPECT_CALL(client, SendBeginFrame(_)).Times(0); |
| 115 compositor()->SendBeginFramesToChildren(args2); |
| 116 Mock::VerifyAndClearExpectations(&client); |
| 117 |
| 118 begin_frame_observer.ResetCompositor(); |
| 119 } |
| 120 |
97 } // namespace content | 121 } // namespace content |
OLD | NEW |