| 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/cronet/android/test/test_upload_data_stream_handler.h" | 5 #include "components/cronet/android/test/test_upload_data_stream_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 void TestUploadDataStreamHandler::InitOnNetworkThread() { | 113 void TestUploadDataStreamHandler::InitOnNetworkThread() { |
| 114 DCHECK(network_thread_->task_runner()->BelongsToCurrentThread()); | 114 DCHECK(network_thread_->task_runner()->BelongsToCurrentThread()); |
| 115 init_callback_invoked_ = false; | 115 init_callback_invoked_ = false; |
| 116 read_buffer_ = nullptr; | 116 read_buffer_ = nullptr; |
| 117 bytes_read_ = 0; | 117 bytes_read_ = 0; |
| 118 int res = upload_data_stream_->Init( | 118 int res = upload_data_stream_->Init( |
| 119 base::Bind(&TestUploadDataStreamHandler::OnInitCompleted, | 119 base::Bind(&TestUploadDataStreamHandler::OnInitCompleted, |
| 120 base::Unretained(this)), | 120 base::Unretained(this)), |
| 121 net::BoundNetLog()); | 121 net::NetLogWithSource()); |
| 122 JNIEnv* env = base::android::AttachCurrentThread(); | 122 JNIEnv* env = base::android::AttachCurrentThread(); |
| 123 cronet::Java_TestUploadDataStreamHandler_onInitCalled( | 123 cronet::Java_TestUploadDataStreamHandler_onInitCalled( |
| 124 env, jtest_upload_data_stream_handler_, res); | 124 env, jtest_upload_data_stream_handler_, res); |
| 125 | 125 |
| 126 if (res == net::OK) { | 126 if (res == net::OK) { |
| 127 cronet::Java_TestUploadDataStreamHandler_onInitCompleted( | 127 cronet::Java_TestUploadDataStreamHandler_onInitCompleted( |
| 128 env, jtest_upload_data_stream_handler_, res); | 128 env, jtest_upload_data_stream_handler_, res); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler( | 189 TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler( |
| 190 std::move(upload_data_stream), env, jtest_upload_data_stream_handler); | 190 std::move(upload_data_stream), env, jtest_upload_data_stream_handler); |
| 191 return reinterpret_cast<jlong>(handler); | 191 return reinterpret_cast<jlong>(handler); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool TestUploadDataStreamHandlerRegisterJni(JNIEnv* env) { | 194 bool TestUploadDataStreamHandlerRegisterJni(JNIEnv* env) { |
| 195 return RegisterNativesImpl(env); | 195 return RegisterNativesImpl(env); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace cronet | 198 } // namespace cronet |
| OLD | NEW |