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

Unified Diff: Source/wtf/DoubleBufferedDequeTest.cpp

Issue 439923006: Prioritizing input and compositor tasks in the blink scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding wtf/DoubleBufferedDeque.h to git Created 6 years, 4 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
Index: Source/wtf/DoubleBufferedDequeTest.cpp
diff --git a/Source/wtf/DoubleBufferedDequeTest.cpp b/Source/wtf/DoubleBufferedDequeTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..00a8e9476b9cd705cb335b8eb96d59fa4d522ad6
--- /dev/null
+++ b/Source/wtf/DoubleBufferedDequeTest.cpp
@@ -0,0 +1,35 @@
+// 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 "config.h"
+#include "wtf/DoubleBufferedDeque.h"
+
+#include <gtest/gtest.h>
+
+namespace {
+
+using blink::DoubleBufferedDeque;
+
+typedef testing::Test DoubleBufferedDequeTest;
+
+TEST(DoubleBufferedDequeTest, TestDoubleBuffering)
+{
+ DoubleBufferedDeque<int> queue;
+ queue.append(1);
+ queue.append(10);
+ queue.append(100);
+
+ queue.append(2);
+ EXPECT_EQ(1, queue.swapBuffers().takeFirst());
+ EXPECT_EQ(10, queue.swapBuffers().takeFirst());
+ EXPECT_EQ(100, queue.swapBuffers().takeFirst());
+
+ queue.append(3);
+ EXPECT_EQ(2, queue.swapBuffers().takeFirst());
+
+ queue.append(4);
+ EXPECT_EQ(3, queue.swapBuffers().takeFirst());
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698