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" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ::testing::PrintToString(args2)); | 90 ::testing::PrintToString(args2)); |
91 } | 91 } |
92 | 92 |
93 TEST(BeginFrameArgsTest, Create) { | 93 TEST(BeginFrameArgsTest, Create) { |
94 // BeginFrames are not valid by default | 94 // BeginFrames are not valid by default |
95 BeginFrameArgs args1; | 95 BeginFrameArgs args1; |
96 EXPECT_FALSE(args1.IsValid()) << args1; | 96 EXPECT_FALSE(args1.IsValid()) << args1; |
97 EXPECT_TRUE(args1.on_critical_path); | 97 EXPECT_TRUE(args1.on_critical_path); |
98 | 98 |
99 BeginFrameArgs args2 = BeginFrameArgs::Create( | 99 BeginFrameArgs args2 = BeginFrameArgs::Create( |
100 BEGINFRAME_FROM_HERE, 123, 10, BeginFrameArgs::kDefaultSourceFrameNumber, | 100 BEGINFRAME_FROM_HERE, 123, 10, base::TimeTicks::FromInternalValue(1), |
101 base::TimeTicks::FromInternalValue(1), | |
102 base::TimeTicks::FromInternalValue(2), | 101 base::TimeTicks::FromInternalValue(2), |
103 base::TimeDelta::FromInternalValue(3), BeginFrameArgs::NORMAL); | 102 base::TimeDelta::FromInternalValue(3), BeginFrameArgs::NORMAL); |
104 EXPECT_TRUE(args2.IsValid()) << args2; | 103 EXPECT_TRUE(args2.IsValid()) << args2; |
105 EXPECT_EQ(123u, args2.source_id) << args2; | 104 EXPECT_EQ(123u, args2.source_id) << args2; |
106 EXPECT_EQ(10u, args2.sequence_number) << args2; | 105 EXPECT_EQ(10u, args2.sequence_number) << args2; |
107 EXPECT_EQ(1, args2.frame_time.ToInternalValue()) << args2; | 106 EXPECT_EQ(1, args2.frame_time.ToInternalValue()) << args2; |
108 EXPECT_EQ(2, args2.deadline.ToInternalValue()) << args2; | 107 EXPECT_EQ(2, args2.deadline.ToInternalValue()) << args2; |
109 EXPECT_EQ(3, args2.interval.ToInternalValue()) << args2; | 108 EXPECT_EQ(3, args2.interval.ToInternalValue()) << args2; |
110 EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type) << args2; | 109 EXPECT_EQ(BeginFrameArgs::NORMAL, args2.type) << args2; |
111 } | 110 } |
112 | 111 |
113 #ifndef NDEBUG | 112 #ifndef NDEBUG |
114 TEST(BeginFrameArgsTest, Location) { | 113 TEST(BeginFrameArgsTest, Location) { |
115 tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE; | 114 tracked_objects::Location expected_location = BEGINFRAME_FROM_HERE; |
116 | 115 |
117 BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location, 0, 1); | 116 BeginFrameArgs args = CreateBeginFrameArgsForTesting(expected_location, 0, 1); |
118 EXPECT_EQ(expected_location.ToString(), args.created_from.ToString()); | 117 EXPECT_EQ(expected_location.ToString(), args.created_from.ToString()); |
119 } | 118 } |
120 #endif | 119 #endif |
121 | 120 |
122 } // namespace | 121 } // namespace |
123 } // namespace cc | 122 } // namespace cc |
OLD | NEW |