Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: components/cronet/android/test/native_test_server.cc

Issue 937513003: Add Data Saver support to Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "native_test_server.h" 5 #include "native_test_server.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return base::android::ConvertUTF8ToJavaString(env, url.spec()).Release(); 137 return base::android::ConvertUTF8ToJavaString(env, url.spec()).Release();
138 } 138 }
139 139
140 jstring GetFileURL(JNIEnv* env, jclass jcaller, jstring jfile_path) { 140 jstring GetFileURL(JNIEnv* env, jclass jcaller, jstring jfile_path) {
141 DCHECK(g_test_server); 141 DCHECK(g_test_server);
142 std::string file = base::android::ConvertJavaStringToUTF8(env, jfile_path); 142 std::string file = base::android::ConvertJavaStringToUTF8(env, jfile_path);
143 GURL url = g_test_server->GetURL(file); 143 GURL url = g_test_server->GetURL(file);
144 return base::android::ConvertUTF8ToJavaString(env, url.spec()).Release(); 144 return base::android::ConvertUTF8ToJavaString(env, url.spec()).Release();
145 } 145 }
146 146
147 jint GetPort(JNIEnv* env, jclass jcaller) {
148 DCHECK(g_test_server);
149 return static_cast<int>(g_test_server->port());
150 }
151
147 bool RegisterNativeTestServer(JNIEnv* env) { 152 bool RegisterNativeTestServer(JNIEnv* env) {
148 return RegisterNativesImpl(env); 153 return RegisterNativesImpl(env);
149 } 154 }
150 155
151 } // namespace cronet 156 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698