summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_session_unittest.cc
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-06 21:44:32 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-06 21:44:32 +0000
commitdab9c7d4a7c5d4c5157043ee4db2d792b8a2f3b6 (patch)
tree2a91eee8aaf55502ed8e3a9b2b5f9e5909237a5d /net/spdy/spdy_session_unittest.cc
parentfc524909b7165d44b8b4fc92d7ba59ae7f8cb2df (diff)
downloadchromium_src-dab9c7d4a7c5d4c5157043ee4db2d792b8a2f3b6.zip
chromium_src-dab9c7d4a7c5d4c5157043ee4db2d792b8a2f3b6.tar.gz
chromium_src-dab9c7d4a7c5d4c5157043ee4db2d792b8a2f3b6.tar.bz2
Rename all files from flip* to spdy*.
I haven't yet renamed the classes. BUG=30747 TEST=none Review URL: http://codereview.chromium.org/582001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_session_unittest.cc')
-rw-r--r--net/spdy/spdy_session_unittest.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
new file mode 100644
index 0000000..57d6c2d
--- /dev/null
+++ b/net/spdy/spdy_session_unittest.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2009 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 "net/spdy/spdy_io_buffer.h"
+
+#include "net/base/test_completion_callback.h"
+#include "net/socket/socket_test_util.h"
+#include "net/spdy/spdy_session.h"
+#include "net/spdy/spdy_stream.h"
+#include "testing/platform_test.h"
+
+namespace net {
+
+class FlipSessionTest : public PlatformTest {
+ public:
+};
+
+// Test the FlipIOBuffer class.
+TEST_F(FlipSessionTest, FlipIOBuffer) {
+ std::priority_queue<FlipIOBuffer> queue_;
+ const size_t kQueueSize = 100;
+
+ // Insert 100 items; pri 100 to 1.
+ for (size_t index = 0; index < kQueueSize; ++index) {
+ FlipIOBuffer buffer(new IOBuffer(), 0, kQueueSize - index, NULL);
+ queue_.push(buffer);
+ }
+
+ // Insert several priority 0 items last.
+ const size_t kNumDuplicates = 12;
+ IOBufferWithSize* buffers[kNumDuplicates];
+ for (size_t index = 0; index < kNumDuplicates; ++index) {
+ buffers[index] = new IOBufferWithSize(index+1);
+ queue_.push(FlipIOBuffer(buffers[index], buffers[index]->size(), 0, NULL));
+ }
+
+ EXPECT_EQ(kQueueSize + kNumDuplicates, queue_.size());
+
+ // Verify the P0 items come out in FIFO order.
+ for (size_t index = 0; index < kNumDuplicates; ++index) {
+ FlipIOBuffer buffer = queue_.top();
+ EXPECT_EQ(0, buffer.priority());
+ EXPECT_EQ(index + 1, buffer.size());
+ queue_.pop();
+ }
+
+ int priority = 1;
+ while (queue_.size()) {
+ FlipIOBuffer buffer = queue_.top();
+ EXPECT_EQ(priority++, buffer.priority());
+ queue_.pop();
+ }
+}
+
+} // namespace net