Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: libadblockplus-android/jni/JniWebRequest.cpp

Issue 29345369: Issue 4081 - Fix failing MockWebRequestTest test for libadblockplus-android (Closed)
Left Patch Set: Full changes set (including initial changeset for this issue and codestyle/commitstyle fixes) Created July 13, 2016, 6:52 a.m.
Right Patch Set: reverting changes to .hgignore Created Sept. 13, 2016, 10:34 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « .hgignore ('k') | libadblockplus-android/jni/Utils.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 sResponse.responseText = JniGetStringField(*env, 79 sResponse.responseText = JniGetStringField(*env,
80 serverResponseClass->Get(), *response, "response"); 80 serverResponseClass->Get(), *response, "response");
81 81
82 // map headers 82 // map headers
83 jobjectArray responseHeadersArray = JniGetStringArrayField(*env, 83 jobjectArray responseHeadersArray = JniGetStringArrayField(*env,
84 serverResponseClass->Get(), *response, "headers"); 84 serverResponseClass->Get(), *response, "headers");
85 85
86 if (responseHeadersArray) 86 if (responseHeadersArray)
87 { 87 {
88 int itemsCount = env->GetArrayLength(responseHeadersArray) / 2; 88 int itemsCount = env->GetArrayLength(responseHeadersArray) / 2;
89 for (int i=0; i<itemsCount; i++) 89 for (int i = 0; i < itemsCount; i++)
Felix Dahlke 2016/09/12 14:21:11 Nit: Spaces around operators (= and < here)?
90 { 90 {
91 jstring jKey = (jstring)env->GetObjectArrayElement(responseHeadersArra y, i * 2); 91 jstring jKey = (jstring)env->GetObjectArrayElement(responseHeadersArra y, i * 2);
92 std::string stdKey = JniJavaToStdString(*env, jKey); 92 std::string stdKey = JniJavaToStdString(*env, jKey);
93 93
94 jstring jValue = (jstring)env->GetObjectArrayElement(responseHeadersAr ray, i * 2 + 1); 94 jstring jValue = (jstring)env->GetObjectArrayElement(responseHeadersAr ray, i * 2 + 1);
95 std::string stdValue = JniJavaToStdString(*env, jValue); 95 std::string stdValue = JniJavaToStdString(*env, jValue);
96 96
97 std::pair<std::string,std::string> keyValue(stdKey, stdValue); 97 std::pair<std::string,std::string> keyValue(stdKey, stdValue);
98 sResponse.responseHeaders.push_back(keyValue); 98 sResponse.responseHeaders.push_back(keyValue);
99 } 99 }
(...skipping 21 matching lines...) Expand all
121 static JNINativeMethod methods[] = 121 static JNINativeMethod methods[] =
122 { 122 {
123 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, 123 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
124 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } 124 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
125 }; 125 };
126 126
127 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest _registerNatives(JNIEnv *env, jclass clazz) 127 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest _registerNatives(JNIEnv *env, jclass clazz)
128 { 128 {
129 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 129 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
130 } 130 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld