| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 FROM_HERE, base::Bind(&TestUploadDataStreamHandler:: | 108 FROM_HERE, base::Bind(&TestUploadDataStreamHandler:: |
| 109 CheckReadCallbackNotInvokedOnNetworkThread, | 109 CheckReadCallbackNotInvokedOnNetworkThread, |
| 110 base::Unretained(this))); | 110 base::Unretained(this))); |
| 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(base::Bind( | 118 int res = upload_data_stream_->Init( |
| 119 &TestUploadDataStreamHandler::OnInitCompleted, base::Unretained(this))); | 119 base::Bind(&TestUploadDataStreamHandler::OnInitCompleted, |
| 120 base::Unretained(this)), |
| 121 net::BoundNetLog()); |
| 120 JNIEnv* env = base::android::AttachCurrentThread(); | 122 JNIEnv* env = base::android::AttachCurrentThread(); |
| 121 cronet::Java_TestUploadDataStreamHandler_onInitCalled( | 123 cronet::Java_TestUploadDataStreamHandler_onInitCalled( |
| 122 env, jtest_upload_data_stream_handler_.obj(), res); | 124 env, jtest_upload_data_stream_handler_.obj(), res); |
| 123 | 125 |
| 124 if (res == net::OK) { | 126 if (res == net::OK) { |
| 125 cronet::Java_TestUploadDataStreamHandler_onInitCompleted( | 127 cronet::Java_TestUploadDataStreamHandler_onInitCompleted( |
| 126 env, jtest_upload_data_stream_handler_.obj(), res); | 128 env, jtest_upload_data_stream_handler_.obj(), res); |
| 127 } | 129 } |
| 128 } | 130 } |
| 129 | 131 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler( | 189 TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler( |
| 188 std::move(upload_data_stream), env, jtest_upload_data_stream_handler); | 190 std::move(upload_data_stream), env, jtest_upload_data_stream_handler); |
| 189 return reinterpret_cast<jlong>(handler); | 191 return reinterpret_cast<jlong>(handler); |
| 190 } | 192 } |
| 191 | 193 |
| 192 bool TestUploadDataStreamHandlerRegisterJni(JNIEnv* env) { | 194 bool TestUploadDataStreamHandlerRegisterJni(JNIEnv* env) { |
| 193 return RegisterNativesImpl(env); | 195 return RegisterNativesImpl(env); |
| 194 } | 196 } |
| 195 | 197 |
| 196 } // namespace cronet | 198 } // namespace cronet |
| OLD | NEW |