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 "cc/resources/tile_priority.h" | 5 #include "cc/resources/tile_priority.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace cc { | 8 namespace cc { |
9 | 9 |
10 TEST(TilePriorityTest, IsHigherPriorityThan) { | 10 TEST(TilePriorityTest, IsHigherPriorityThan) { |
11 TilePriority now(HIGH_RESOLUTION, TilePriority::NOW, 0); | 11 TilePriority now(HIGH_RESOLUTION, false, TilePriority::NOW, 0); |
12 TilePriority close_soon(HIGH_RESOLUTION, TilePriority::SOON, 1); | 12 TilePriority occluded_now(HIGH_RESOLUTION, true, TilePriority::NOW, 0); |
13 TilePriority far_soon(HIGH_RESOLUTION, TilePriority::SOON, 500); | 13 TilePriority close_soon(HIGH_RESOLUTION, false, TilePriority::SOON, 1); |
14 TilePriority close_eventually(HIGH_RESOLUTION, TilePriority::EVENTUALLY, 2); | 14 TilePriority far_soon(HIGH_RESOLUTION, false, TilePriority::SOON, 500); |
15 TilePriority far_eventually(HIGH_RESOLUTION, TilePriority::EVENTUALLY, 1000); | 15 TilePriority close_eventually( |
16 TilePriority non_ideal_now(NON_IDEAL_RESOLUTION, TilePriority::NOW, 0); | 16 HIGH_RESOLUTION, false, TilePriority::EVENTUALLY, 2); |
| 17 TilePriority far_eventually( |
| 18 HIGH_RESOLUTION, false, TilePriority::EVENTUALLY, 1000); |
| 19 TilePriority non_ideal_now(NON_IDEAL_RESOLUTION, false, TilePriority::NOW, 0); |
| 20 TilePriority occluded_non_ideal_now( |
| 21 NON_IDEAL_RESOLUTION, true, TilePriority::NOW, 0); |
17 | 22 |
18 EXPECT_FALSE(now.IsHigherPriorityThan(now)); | 23 EXPECT_FALSE(now.IsHigherPriorityThan(now)); |
19 EXPECT_FALSE(now.IsHigherPriorityThan(non_ideal_now)); | 24 EXPECT_FALSE(now.IsHigherPriorityThan(non_ideal_now)); |
20 | 25 |
21 EXPECT_TRUE(now.IsHigherPriorityThan(close_soon)); | 26 EXPECT_TRUE(now.IsHigherPriorityThan(close_soon)); |
22 EXPECT_TRUE(now.IsHigherPriorityThan(far_soon)); | 27 EXPECT_TRUE(now.IsHigherPriorityThan(far_soon)); |
23 EXPECT_TRUE(now.IsHigherPriorityThan(close_eventually)); | 28 EXPECT_TRUE(now.IsHigherPriorityThan(close_eventually)); |
24 EXPECT_TRUE(now.IsHigherPriorityThan(far_eventually)); | 29 EXPECT_TRUE(now.IsHigherPriorityThan(far_eventually)); |
25 EXPECT_TRUE(close_soon.IsHigherPriorityThan(far_soon)); | 30 EXPECT_TRUE(close_soon.IsHigherPriorityThan(far_soon)); |
26 EXPECT_TRUE(close_soon.IsHigherPriorityThan(close_eventually)); | 31 EXPECT_TRUE(close_soon.IsHigherPriorityThan(close_eventually)); |
27 EXPECT_TRUE(close_soon.IsHigherPriorityThan(far_eventually)); | 32 EXPECT_TRUE(close_soon.IsHigherPriorityThan(far_eventually)); |
28 EXPECT_TRUE(far_soon.IsHigherPriorityThan(close_eventually)); | 33 EXPECT_TRUE(far_soon.IsHigherPriorityThan(close_eventually)); |
29 EXPECT_TRUE(far_soon.IsHigherPriorityThan(far_eventually)); | 34 EXPECT_TRUE(far_soon.IsHigherPriorityThan(far_eventually)); |
30 EXPECT_TRUE(close_eventually.IsHigherPriorityThan(far_eventually)); | 35 EXPECT_TRUE(close_eventually.IsHigherPriorityThan(far_eventually)); |
31 | 36 |
32 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(close_eventually)); | 37 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(close_eventually)); |
33 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(far_soon)); | 38 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(far_soon)); |
34 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(close_soon)); | 39 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(close_soon)); |
35 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(now)); | 40 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(now)); |
36 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(non_ideal_now)); | 41 EXPECT_FALSE(far_eventually.IsHigherPriorityThan(non_ideal_now)); |
37 EXPECT_FALSE(close_eventually.IsHigherPriorityThan(far_soon)); | 42 EXPECT_FALSE(close_eventually.IsHigherPriorityThan(far_soon)); |
38 EXPECT_FALSE(close_eventually.IsHigherPriorityThan(close_soon)); | 43 EXPECT_FALSE(close_eventually.IsHigherPriorityThan(close_soon)); |
39 EXPECT_FALSE(close_eventually.IsHigherPriorityThan(now)); | 44 EXPECT_FALSE(close_eventually.IsHigherPriorityThan(now)); |
40 EXPECT_FALSE(far_soon.IsHigherPriorityThan(close_soon)); | 45 EXPECT_FALSE(far_soon.IsHigherPriorityThan(close_soon)); |
41 EXPECT_FALSE(far_soon.IsHigherPriorityThan(now)); | 46 EXPECT_FALSE(far_soon.IsHigherPriorityThan(now)); |
42 EXPECT_FALSE(close_soon.IsHigherPriorityThan(now)); | 47 EXPECT_FALSE(close_soon.IsHigherPriorityThan(now)); |
| 48 |
| 49 EXPECT_FALSE(now.IsHigherPriorityThan(occluded_now)); |
| 50 EXPECT_FALSE(occluded_now.IsHigherPriorityThan(now)); |
| 51 EXPECT_FALSE(non_ideal_now.IsHigherPriorityThan(occluded_non_ideal_now)); |
| 52 EXPECT_FALSE(occluded_non_ideal_now.IsHigherPriorityThan(non_ideal_now)); |
43 } | 53 } |
44 | 54 |
45 } // namespace cc | 55 } // namespace cc |
OLD | NEW |