| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/devtools/devtools_network_controller.h" | 5 #include "chrome/browser/devtools/devtools_network_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 bool HasFailed() { | 120 bool HasFailed() { |
| 121 return transaction_->failed_; | 121 return transaction_->failed_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 void CancelTransaction() { | 124 void CancelTransaction() { |
| 125 transaction_.reset(); | 125 transaction_.reset(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 int ReadUploadData() { | 128 int ReadUploadData() { |
| 129 EXPECT_EQ(net::OK, | 129 EXPECT_EQ(net::OK, transaction_->custom_upload_data_stream_->Init( |
| 130 transaction_->custom_upload_data_stream_->Init(completion_callback_)); | 130 completion_callback_, net::BoundNetLog())); |
| 131 return transaction_->custom_upload_data_stream_->Read( | 131 return transaction_->custom_upload_data_stream_->Read( |
| 132 buffer_.get(), 64, completion_callback_); | 132 buffer_.get(), 64, completion_callback_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 ~DevToolsNetworkControllerHelper() { | 135 ~DevToolsNetworkControllerHelper() { |
| 136 RemoveMockTransaction(&mock_transaction_); | 136 RemoveMockTransaction(&mock_transaction_); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TestCallback* callback() { return &callback_; } | 139 TestCallback* callback() { return &callback_; } |
| 140 DevToolsNetworkController* controller() { return &controller_; } | 140 DevToolsNetworkController* controller() { return &controller_; } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 rv = helper.ReadUploadData(); | 320 rv = helper.ReadUploadData(); |
| 321 EXPECT_EQ(rv, net::ERR_IO_PENDING); | 321 EXPECT_EQ(rv, net::ERR_IO_PENDING); |
| 322 EXPECT_EQ(callback->run_count(), 1); | 322 EXPECT_EQ(callback->run_count(), 1); |
| 323 base::RunLoop().RunUntilIdle(); | 323 base::RunLoop().RunUntilIdle(); |
| 324 EXPECT_EQ(callback->run_count(), 2); | 324 EXPECT_EQ(callback->run_count(), 2); |
| 325 EXPECT_EQ(callback->value(), static_cast<int>(arraysize(kUploadData))); | 325 EXPECT_EQ(callback->value(), static_cast<int>(arraysize(kUploadData))); |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace test | 328 } // namespace test |
| OLD | NEW |