Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: cc/resources/tile_priority_unittest.cc

Issue 230983004: cc: Fix TilePriority::IsHigherPriorityThan to be correct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/tile_priority.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/tile_priority_unittest.cc
diff --git a/cc/resources/tile_priority_unittest.cc b/cc/resources/tile_priority_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e134bc976426c744b46548e593fa3a094882d7c8
--- /dev/null
+++ b/cc/resources/tile_priority_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/resources/tile_priority.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace cc {
+
+TEST(TilePriorityTest, IsHigherPriorityThan) {
+ TilePriority now(HIGH_RESOLUTION, TilePriority::NOW, 0);
+ TilePriority close_soon(HIGH_RESOLUTION, TilePriority::SOON, 1);
+ TilePriority far_soon(HIGH_RESOLUTION, TilePriority::SOON, 500);
+ TilePriority close_eventually(HIGH_RESOLUTION, TilePriority::EVENTUALLY, 2);
+ TilePriority far_eventually(HIGH_RESOLUTION, TilePriority::EVENTUALLY, 1000);
+ TilePriority non_ideal_now(NON_IDEAL_RESOLUTION, TilePriority::NOW, 0);
+
+ EXPECT_FALSE(now.IsHigherPriorityThan(now));
+ EXPECT_FALSE(now.IsHigherPriorityThan(non_ideal_now));
+
+ EXPECT_TRUE(now.IsHigherPriorityThan(close_soon));
+ EXPECT_TRUE(now.IsHigherPriorityThan(far_soon));
+ EXPECT_TRUE(now.IsHigherPriorityThan(close_eventually));
+ EXPECT_TRUE(now.IsHigherPriorityThan(far_eventually));
+ EXPECT_TRUE(close_soon.IsHigherPriorityThan(far_soon));
+ EXPECT_TRUE(close_soon.IsHigherPriorityThan(close_eventually));
+ EXPECT_TRUE(close_soon.IsHigherPriorityThan(far_eventually));
+ EXPECT_TRUE(far_soon.IsHigherPriorityThan(close_eventually));
+ EXPECT_TRUE(far_soon.IsHigherPriorityThan(far_eventually));
+ EXPECT_TRUE(close_eventually.IsHigherPriorityThan(far_eventually));
+
+ EXPECT_FALSE(far_eventually.IsHigherPriorityThan(close_eventually));
+ EXPECT_FALSE(far_eventually.IsHigherPriorityThan(far_soon));
+ EXPECT_FALSE(far_eventually.IsHigherPriorityThan(close_soon));
+ EXPECT_FALSE(far_eventually.IsHigherPriorityThan(now));
+ EXPECT_FALSE(far_eventually.IsHigherPriorityThan(non_ideal_now));
+ EXPECT_FALSE(close_eventually.IsHigherPriorityThan(far_soon));
+ EXPECT_FALSE(close_eventually.IsHigherPriorityThan(close_soon));
+ EXPECT_FALSE(close_eventually.IsHigherPriorityThan(now));
+ EXPECT_FALSE(far_soon.IsHigherPriorityThan(close_soon));
+ EXPECT_FALSE(far_soon.IsHigherPriorityThan(now));
+ EXPECT_FALSE(close_soon.IsHigherPriorityThan(now));
+}
+
+} // namespace cc
« no previous file with comments | « cc/resources/tile_priority.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698