OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 class NonChunkedUploadDataStream : public net::UploadDataStream { | 487 class NonChunkedUploadDataStream : public net::UploadDataStream { |
488 public: | 488 public: |
489 explicit NonChunkedUploadDataStream(uint64_t size) | 489 explicit NonChunkedUploadDataStream(uint64_t size) |
490 : net::UploadDataStream(false, 0), stream_(0), size_(size) {} | 490 : net::UploadDataStream(false, 0), stream_(0), size_(size) {} |
491 | 491 |
492 void AppendData(const char* data) { | 492 void AppendData(const char* data) { |
493 stream_.AppendData(data, strlen(data), false); | 493 stream_.AppendData(data, strlen(data), false); |
494 } | 494 } |
495 | 495 |
496 private: | 496 private: |
497 int InitInternal(const net::BoundNetLog& net_log) override { | 497 int InitInternal(const net::NetLogWithSource& net_log) override { |
498 SetSize(size_); | 498 SetSize(size_); |
499 stream_.Init(base::Bind(&NonChunkedUploadDataStream::OnInitCompleted, | 499 stream_.Init(base::Bind(&NonChunkedUploadDataStream::OnInitCompleted, |
500 base::Unretained(this)), | 500 base::Unretained(this)), |
501 net_log); | 501 net_log); |
502 return net::OK; | 502 return net::OK; |
503 } | 503 } |
504 | 504 |
505 int ReadInternal(net::IOBuffer* buf, int buf_len) override { | 505 int ReadInternal(net::IOBuffer* buf, int buf_len) override { |
506 return stream_.Read(buf, buf_len, | 506 return stream_.Read(buf, buf_len, |
507 base::Bind(&NonChunkedUploadDataStream::OnReadCompleted, | 507 base::Bind(&NonChunkedUploadDataStream::OnReadCompleted, |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 | 1159 |
1160 // Tests that the effective connection type is not set on non-main frame | 1160 // Tests that the effective connection type is not set on non-main frame |
1161 // requests. | 1161 // requests. |
1162 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { | 1162 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { |
1163 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, | 1163 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, |
1164 net::EFFECTIVE_CONNECTION_TYPE_3G, | 1164 net::EFFECTIVE_CONNECTION_TYPE_3G, |
1165 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); | 1165 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); |
1166 } | 1166 } |
1167 | 1167 |
1168 } // namespace content | 1168 } // namespace content |
OLD | NEW |