| 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 "components/sync/test/fake_server/android/fake_server_helper_android.h" | 5 #include "components/sync/test/fake_server/android/fake_server_helper_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 fake_server_ptr->ModifyEntitySpecifics( | 166 fake_server_ptr->ModifyEntitySpecifics( |
| 167 base::android::ConvertJavaStringToUTF8(env, id), entity_specifics); | 167 base::android::ConvertJavaStringToUTF8(env, id), entity_specifics); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void FakeServerHelperAndroid::DeserializeEntitySpecifics( | 170 void FakeServerHelperAndroid::DeserializeEntitySpecifics( |
| 171 JNIEnv* env, | 171 JNIEnv* env, |
| 172 jbyteArray serialized_entity_specifics, | 172 jbyteArray serialized_entity_specifics, |
| 173 sync_pb::EntitySpecifics* entity_specifics) { | 173 sync_pb::EntitySpecifics* entity_specifics) { |
| 174 int specifics_bytes_length = env->GetArrayLength(serialized_entity_specifics); | 174 int specifics_bytes_length = env->GetArrayLength(serialized_entity_specifics); |
| 175 jbyte* specifics_bytes = | 175 jbyte* specifics_bytes = |
| 176 env->GetByteArrayElements(serialized_entity_specifics, NULL); | 176 env->GetByteArrayElements(serialized_entity_specifics, nullptr); |
| 177 std::string specifics_string(reinterpret_cast<char*>(specifics_bytes), | 177 std::string specifics_string(reinterpret_cast<char*>(specifics_bytes), |
| 178 specifics_bytes_length); | 178 specifics_bytes_length); |
| 179 | 179 |
| 180 if (!entity_specifics->ParseFromString(specifics_string)) | 180 if (!entity_specifics->ParseFromString(specifics_string)) |
| 181 NOTREACHED() << "Could not deserialize EntitySpecifics"; | 181 NOTREACHED() << "Could not deserialize EntitySpecifics"; |
| 182 } | 182 } |
| 183 | 183 |
| 184 void FakeServerHelperAndroid::InjectBookmarkEntity( | 184 void FakeServerHelperAndroid::InjectBookmarkEntity( |
| 185 JNIEnv* env, | 185 JNIEnv* env, |
| 186 const JavaParamRef<jobject>& obj, | 186 const JavaParamRef<jobject>& obj, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 jlong fake_server) { | 306 jlong fake_server) { |
| 307 fake_server::FakeServer* fake_server_ptr = | 307 fake_server::FakeServer* fake_server_ptr = |
| 308 reinterpret_cast<fake_server::FakeServer*>(fake_server); | 308 reinterpret_cast<fake_server::FakeServer*>(fake_server); |
| 309 fake_server_ptr->ClearServerData(); | 309 fake_server_ptr->ClearServerData(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 // static | 312 // static |
| 313 bool FakeServerHelperAndroid::Register(JNIEnv* env) { | 313 bool FakeServerHelperAndroid::Register(JNIEnv* env) { |
| 314 return RegisterNativesImpl(env); | 314 return RegisterNativesImpl(env); |
| 315 } | 315 } |
| OLD | NEW |