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

Side by Side Diff: blimp/net/test_common.h

Issue 1825263003: Blimp: add packet-level DEFLATE compression using zlib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wez feedback Created 4 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 unified diff | Download patch
« no previous file with comments | « blimp/net/stream_socket_connection.cc ('k') | blimp/net/test_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef BLIMP_NET_TEST_COMMON_H_ 5 #ifndef BLIMP_NET_TEST_COMMON_H_
6 #define BLIMP_NET_TEST_COMMON_H_ 6 #define BLIMP_NET_TEST_COMMON_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // GMock action that writes data from a string to an IOBuffer. 63 // GMock action that writes data from a string to an IOBuffer.
64 // 64 //
65 // buf_idx (template parameter 0): 0-based index of the IOBuffer arg. 65 // buf_idx (template parameter 0): 0-based index of the IOBuffer arg.
66 // str: the string containing data to be written to the IOBuffer. 66 // str: the string containing data to be written to the IOBuffer.
67 ACTION_TEMPLATE(FillBufferFromString, 67 ACTION_TEMPLATE(FillBufferFromString,
68 HAS_1_TEMPLATE_PARAMS(int, buf_idx), 68 HAS_1_TEMPLATE_PARAMS(int, buf_idx),
69 AND_1_VALUE_PARAMS(str)) { 69 AND_1_VALUE_PARAMS(str)) {
70 memcpy(testing::get<buf_idx>(args)->data(), str.data(), str.size()); 70 memcpy(testing::get<buf_idx>(args)->data(), str.data(), str.size());
71 } 71 }
72 72
73 // Returns true if |buf| has a prefix of |str|. 73 // Returns true if |buf| is prefixed by |str|.
74 // Behavior is undefined if len(buf) < len(str). 74 bool BufferStartsWith(net::GrowableIOBuffer* buf,
75 bool BufferStartsWith(net::GrowableIOBuffer* buf, const std::string& str); 75 size_t buf_size,
76 const std::string& str);
76 77
77 // GMock action that writes data from a BlimpMessage to a GrowableIOBuffer. 78 // GMock action that writes data from a BlimpMessage to a GrowableIOBuffer.
78 // Advances the buffer's |offset| to the end of the message. 79 // Advances the buffer's |offset| to the end of the message.
79 // 80 //
80 // buf_idx (template parameter 0): 0-based index of the IOBuffer arg. 81 // buf_idx (template parameter 0): 0-based index of the IOBuffer arg.
81 // message: the blimp message containing data to be written to the IOBuffer 82 // message: the blimp message containing data to be written to the IOBuffer
82 ACTION_TEMPLATE(FillBufferFromMessage, 83 ACTION_TEMPLATE(FillBufferFromMessage,
83 HAS_1_TEMPLATE_PARAMS(int, buf_idx), 84 HAS_1_TEMPLATE_PARAMS(int, buf_idx),
84 AND_1_VALUE_PARAMS(message)) { 85 AND_1_VALUE_PARAMS(message)) {
85 message->SerializeToArray(testing::get<buf_idx>(args)->data(), 86 message->SerializeToArray(testing::get<buf_idx>(args)->data(),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const net::CompletionCallback& callback) override; 207 const net::CompletionCallback& callback) override;
207 208
208 MOCK_METHOD2(MockableProcessMessage, 209 MOCK_METHOD2(MockableProcessMessage,
209 void(const BlimpMessage& message, 210 void(const BlimpMessage& message,
210 const net::CompletionCallback& callback)); 211 const net::CompletionCallback& callback));
211 }; 212 };
212 213
213 } // namespace blimp 214 } // namespace blimp
214 215
215 #endif // BLIMP_NET_TEST_COMMON_H_ 216 #endif // BLIMP_NET_TEST_COMMON_H_
OLDNEW
« no previous file with comments | « blimp/net/stream_socket_connection.cc ('k') | blimp/net/test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698