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

Side by Side Diff: net/spdy/spdy_stream_spdy3_unittest.cc

Issue 10689034: SPDY - chunked upload - speech recognition doesn't work with SPDY/3 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "net/base/completion_callback.h" 6 #include "net/base/completion_callback.h"
7 #include "net/base/net_log_unittest.h" 7 #include "net/base/net_log_unittest.h"
8 #include "net/spdy/buffered_spdy_framer.h" 8 #include "net/spdy/buffered_spdy_framer.h"
9 #include "net/spdy/spdy_stream.h" 9 #include "net/spdy/spdy_stream.h"
10 #include "net/spdy/spdy_http_utils.h" 10 #include "net/spdy/spdy_http_utils.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 virtual int OnSendBody() { 41 virtual int OnSendBody() {
42 ADD_FAILURE() << "OnSendBody should not be called"; 42 ADD_FAILURE() << "OnSendBody should not be called";
43 return ERR_UNEXPECTED; 43 return ERR_UNEXPECTED;
44 } 44 }
45 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) { 45 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) {
46 ADD_FAILURE() << "OnSendBodyComplete should not be called"; 46 ADD_FAILURE() << "OnSendBodyComplete should not be called";
47 return ERR_UNEXPECTED; 47 return ERR_UNEXPECTED;
48 } 48 }
49 49
50 virtual int OnSendChunkedBody() {
51 ADD_FAILURE() << "OnSendChunkedBody should not be called";
52 return ERR_UNEXPECTED;
53 }
54 virtual int OnSendChunkedBodyComplete(int /*status*/, bool* /*eof*/) {
55 ADD_FAILURE() << "OnSendChunkedBodyComplete should not be called";
56 return ERR_UNEXPECTED;
57 }
58
50 virtual int OnResponseReceived(const SpdyHeaderBlock& response, 59 virtual int OnResponseReceived(const SpdyHeaderBlock& response,
51 base::Time response_time, 60 base::Time response_time,
52 int status) { 61 int status) {
53 EXPECT_TRUE(send_headers_completed_); 62 EXPECT_TRUE(send_headers_completed_);
54 *response_ = response; 63 *response_ = response;
55 if (buf_) { 64 if (buf_) {
56 EXPECT_EQ(ERR_IO_PENDING, 65 EXPECT_EQ(ERR_IO_PENDING,
57 stream_->WriteStreamData(buf_.get(), buf_->size(), 66 stream_->WriteStreamData(buf_.get(), buf_->size(),
58 DATA_FLAG_NONE)); 67 DATA_FLAG_NONE));
59 } 68 }
60 return status; 69 return status;
61 } 70 }
62 virtual void OnDataReceived(const char* buffer, int bytes) { 71 virtual void OnDataReceived(const char* buffer, int bytes) {
63 received_data_ += std::string(buffer, bytes); 72 received_data_ += std::string(buffer, bytes);
64 } 73 }
65 virtual void OnDataSent(int length) { 74 virtual void OnDataSent(int length) {
66 data_sent_ += length; 75 data_sent_ += length;
67 } 76 }
68 virtual void OnClose(int status) { 77 virtual void OnClose(int status) {
69 closed_ = true; 78 closed_ = true;
70 CompletionCallback callback = callback_; 79 CompletionCallback callback = callback_;
71 callback_.Reset(); 80 callback_.Reset();
72 callback.Run(OK); 81 callback.Run(OK);
73 } 82 }
74 virtual void set_chunk_callback(net::ChunkCallback *) {} 83 virtual void set_chunk_callback(net::ChunkCallback *) {}
84 virtual bool IsRequestBodyChunked() { return false; }
75 85
76 bool send_headers_completed() const { return send_headers_completed_; } 86 bool send_headers_completed() const { return send_headers_completed_; }
77 const linked_ptr<SpdyHeaderBlock>& response() const { 87 const linked_ptr<SpdyHeaderBlock>& response() const {
78 return response_; 88 return response_;
79 } 89 }
80 const std::string& received_data() const { return received_data_; } 90 const std::string& received_data() const { return received_data_; }
81 int data_sent() const { return data_sent_; } 91 int data_sent() const { return data_sent_; }
82 bool closed() const { return closed_; } 92 bool closed() const { return closed_; }
83 93
84 private: 94 private:
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 entries, 0, 444 entries, 0,
435 net::NetLog::TYPE_SPDY_STREAM_ERROR, 445 net::NetLog::TYPE_SPDY_STREAM_ERROR,
436 net::NetLog::PHASE_NONE); 446 net::NetLog::PHASE_NONE);
437 447
438 int stream_id2; 448 int stream_id2;
439 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &stream_id2)); 449 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &stream_id2));
440 EXPECT_EQ(static_cast<int>(stream_id), stream_id2); 450 EXPECT_EQ(static_cast<int>(stream_id), stream_id2);
441 } 451 }
442 452
443 } // namespace net 453 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698