OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "cc/output/begin_frame_args.h" | 7 #include "cc/output/begin_frame_args.h" |
8 #include "cc/test/begin_frame_args_test.h" | 8 #include "cc/test/begin_frame_args_test.h" |
9 #include "testing/gtest/include/gtest/gtest-spi.h" | 9 #include "testing/gtest/include/gtest/gtest-spi.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "ui/gfx/frame_time.h" | |
12 | 11 |
13 namespace cc { | 12 namespace cc { |
14 namespace { | 13 namespace { |
15 | 14 |
16 TEST(BeginFrameArgsTest, Helpers) { | 15 TEST(BeginFrameArgsTest, Helpers) { |
17 // Quick create methods work | 16 // Quick create methods work |
18 BeginFrameArgs args0 = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 17 BeginFrameArgs args0 = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
19 EXPECT_TRUE(args0.IsValid()) << args0; | 18 EXPECT_TRUE(args0.IsValid()) << args0; |
20 | 19 |
21 BeginFrameArgs args1 = | 20 BeginFrameArgs args1 = |
22 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 0, -1); | 21 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 0, -1); |
23 EXPECT_FALSE(args1.IsValid()) << args1; | 22 EXPECT_FALSE(args1.IsValid()) << args1; |
24 | 23 |
25 BeginFrameArgs args2 = | 24 BeginFrameArgs args2 = |
26 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 1, 2, 3); | 25 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 1, 2, 3); |
27 EXPECT_TRUE(args2.IsValid()) << args2; | 26 EXPECT_TRUE(args2.IsValid()) << args2; |
28 EXPECT_EQ(1, args2.frame_time.ToInternalValue()); | 27 EXPECT_EQ(1, args2.frame_time.ToInternalValue()); |
29 EXPECT_EQ(2, args2.deadline.ToInternalValue()); | 28 EXPECT_EQ(2, args2.deadline.ToInternalValue()); |
30 EXPECT_EQ(3, args2.interval.ToInternalValue()); | 29 EXPECT_EQ(3, args2.interval.ToInternalValue()); |
31 EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type); | 30 EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type); |
32 | 31 |
33 BeginFrameArgs args3 = | 32 BeginFrameArgs args3 = |
34 CreateExpiredBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 33 CreateExpiredBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
35 EXPECT_TRUE(args3.IsValid()) << args3; | 34 EXPECT_TRUE(args3.IsValid()) << args3; |
36 EXPECT_GT(gfx::FrameTime::Now(), args3.deadline); | 35 EXPECT_GT(base::TimeTicks::Now(), args3.deadline); |
37 EXPECT_EQ(BeginFrameArgs::NORMAL, args3.type); | 36 EXPECT_EQ(BeginFrameArgs::NORMAL, args3.type); |
38 | 37 |
39 BeginFrameArgs args4 = CreateBeginFrameArgsForTesting( | 38 BeginFrameArgs args4 = CreateBeginFrameArgsForTesting( |
40 BEGINFRAME_FROM_HERE, 1, 2, 3, BeginFrameArgs::MISSED); | 39 BEGINFRAME_FROM_HERE, 1, 2, 3, BeginFrameArgs::MISSED); |
41 EXPECT_TRUE(args4.IsValid()) << args4; | 40 EXPECT_TRUE(args4.IsValid()) << args4; |
42 EXPECT_EQ(1, args4.frame_time.ToInternalValue()); | 41 EXPECT_EQ(1, args4.frame_time.ToInternalValue()); |
43 EXPECT_EQ(2, args4.deadline.ToInternalValue()); | 42 EXPECT_EQ(2, args4.deadline.ToInternalValue()); |
44 EXPECT_EQ(3, args4.interval.ToInternalValue()); | 43 EXPECT_EQ(3, args4.interval.ToInternalValue()); |
45 EXPECT_EQ(BeginFrameArgs::MISSED, args4.type); | 44 EXPECT_EQ(BeginFrameArgs::MISSED, args4.type); |
46 | 45 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TEST(BeginFrameArgsTest, Location) { | 93 TEST(BeginFrameArgsTest, Location) { |
95 tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE; | 94 tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE; |
96 | 95 |
97 BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location); | 96 BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location); |
98 EXPECT_EQ(expected_location.ToString(), args.created_from.ToString()); | 97 EXPECT_EQ(expected_location.ToString(), args.created_from.ToString()); |
99 } | 98 } |
100 #endif | 99 #endif |
101 | 100 |
102 } // namespace | 101 } // namespace |
103 } // namespace cc | 102 } // namespace cc |
OLD | NEW |