| OLD | NEW | 
|    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 #include "components/domain_reliability/uploader.h" |    5 #include "components/domain_reliability/uploader.h" | 
|    6  |    6  | 
|    7 #include <stddef.h> |    7 #include <stddef.h> | 
|    8  |    8  | 
|    9 #include <memory> |    9 #include <memory> | 
|   10 #include <string> |   10 #include <string> | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   88  |   88  | 
|   89     upload_data_ = std::string(upload_buffer_->data(), upload_buffer_->size()); |   89     upload_data_ = std::string(upload_buffer_->data(), upload_buffer_->size()); | 
|   90     upload_buffer_ = nullptr; |   90     upload_buffer_ = nullptr; | 
|   91  |   91  | 
|   92     if (result_.net_error == net::OK) |   92     if (result_.net_error == net::OK) | 
|   93       NotifyHeadersComplete(); |   93       NotifyHeadersComplete(); | 
|   94     else if (result_.net_error != net::ERR_IO_PENDING) |   94     else if (result_.net_error != net::ERR_IO_PENDING) | 
|   95       NotifyStartError(net::URLRequestStatus::FromError(result_.net_error)); |   95       NotifyStartError(net::URLRequestStatus::FromError(result_.net_error)); | 
|   96   } |   96   } | 
|   97  |   97  | 
|   98   int GetResponseCode() const override { |  | 
|   99     return result_.response_code; |  | 
|  100   } |  | 
|  101  |  | 
|  102   void GetResponseInfo(net::HttpResponseInfo* info) override { |   98   void GetResponseInfo(net::HttpResponseInfo* info) override { | 
|  103     info->headers = result_.response_headers; |   99     info->headers = result_.response_headers; | 
|  104   } |  100   } | 
|  105  |  101  | 
|  106   net::UploadDataStream* upload_stream_; |  102   net::UploadDataStream* upload_stream_; | 
|  107   scoped_refptr<net::IOBufferWithSize> upload_buffer_; |  103   scoped_refptr<net::IOBufferWithSize> upload_buffer_; | 
|  108   std::string upload_data_; |  104   std::string upload_data_; | 
|  109   MockUploadResult result_; |  105   MockUploadResult result_; | 
|  110 }; |  106 }; | 
|  111  |  107  | 
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  322  |  318  | 
|  323   TestUploadCallback c; |  319   TestUploadCallback c; | 
|  324   uploader()->UploadReport("{}", 1, GURL(kUploadURL), c.callback()); |  320   uploader()->UploadReport("{}", 1, GURL(kUploadURL), c.callback()); | 
|  325   base::RunLoop().RunUntilIdle(); |  321   base::RunLoop().RunUntilIdle(); | 
|  326   EXPECT_EQ(1u, c.called_count()); |  322   EXPECT_EQ(1u, c.called_count()); | 
|  327   EXPECT_EQ(0, interceptor()->request_count()); |  323   EXPECT_EQ(0, interceptor()->request_count()); | 
|  328 } |  324 } | 
|  329  |  325  | 
|  330 }  // namespace |  326 }  // namespace | 
|  331 }  // namespace domain_reliability |  327 }  // namespace domain_reliability | 
| OLD | NEW |