summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_test_util.cc
diff options
context:
space:
mode:
authormlloyd@chromium.org <mlloyd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 19:55:43 +0000
committermlloyd@chromium.org <mlloyd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 19:55:43 +0000
commit20d005ff6abde40990a55ac2a9a7cff3e7f54417 (patch)
treeda5961946e5df7a6330ec3a9c05de289d7e9f85e /net/spdy/spdy_test_util.cc
parentfd2a308a37b399cc0364a9e027c70e9a0e1edfa1 (diff)
downloadchromium_src-20d005ff6abde40990a55ac2a9a7cff3e7f54417.zip
chromium_src-20d005ff6abde40990a55ac2a9a7cff3e7f54417.tar.gz
chromium_src-20d005ff6abde40990a55ac2a9a7cff3e7f54417.tar.bz2
Remove the last hex frames from the SPDY unit tests...
...apart from the necessary ones in spdy_framer_test.cc. BUG=None. TEST=net_unittests pass. Review URL: http://codereview.chromium.org/2870044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51551 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_test_util.cc')
-rw-r--r--net/spdy/spdy_test_util.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/spdy/spdy_test_util.cc b/net/spdy/spdy_test_util.cc
index 8247f3e..697a3a6 100644
--- a/net/spdy/spdy_test_util.cc
+++ b/net/spdy/spdy_test_util.cc
@@ -487,4 +487,22 @@ MockRead CreateMockRead(const spdy::SpdyFrame& resp, int seq) {
true, resp.data(), resp.length() + spdy::SpdyFrame::size(), seq);
}
+// Combines the given SpdyFrames into the given char array and returns
+// the total length.
+int CombineFrames(const spdy::SpdyFrame** frames, int num_frames,
+ char* buff, int buff_len) {
+ int total_len = 0;
+ for (int i = 0; i < num_frames; ++i) {
+ total_len += frames[i]->length() + spdy::SpdyFrame::size();
+ }
+ DCHECK_LE(total_len, buff_len);
+ char* ptr = buff;
+ for (int i = 0; i < num_frames; ++i) {
+ int len = frames[i]->length() + spdy::SpdyFrame::size();
+ memcpy(ptr, frames[i]->data(), len);
+ ptr += len;
+ }
+ return total_len;
+}
+
} // namespace net