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

Unified Diff: components/cronet/android/test/native_test_server.cc

Issue 2172633002: Revert of Fix CronetHttpURLConnectionTest#testServerHangsUp flake (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/test/native_test_server.cc
diff --git a/components/cronet/android/test/native_test_server.cc b/components/cronet/android/test/native_test_server.cc
index 34e868bd46794c8f96e342e883efeed9dcc70d20..60bd3a0070f05ece18867b1c09476d101c118382 100644
--- a/components/cronet/android/test/native_test_server.cc
+++ b/components/cronet/android/test/native_test_server.cc
@@ -15,12 +15,10 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/test_support_android.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "components/cronet/android/test/cronet_test_util.h"
#include "jni/NativeTestServer_jni.h"
#include "net/base/host_port_pair.h"
@@ -29,7 +27,6 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
-#include "net/test/embedded_test_server/request_handler_util.h"
#include "url/gurl.h"
namespace cronet {
@@ -41,7 +38,6 @@
const char kEchoAllHeadersPath[] = "/echo_all_headers";
const char kEchoMethodPath[] = "/echo_method";
const char kRedirectToEchoBodyPath[] = "/redirect_to_echo_body";
-const char kExabyteResponsePath[] = "/exabyte_response";
// Path that advertises the dictionary passed in query params if client
// supports Sdch encoding. E.g. /sdch/index?q=LeQxM80O will make the server
// responds with "Get-Dictionary: /sdch/dict/LeQxM80O".
@@ -52,33 +48,6 @@
const char kSdchDictPath[] = "/sdch/dict/";
net::EmbeddedTestServer* g_test_server = nullptr;
-
-// A HttpResponse that is almost never ending (with an Extabyte content-length).
-class ExabyteResponse : public net::test_server::BasicHttpResponse {
- public:
- ExabyteResponse() {}
-
- void SendResponse(
- const net::test_server::SendBytesCallback& send,
- const net::test_server::SendCompleteCallback& done) override {
- // Use 10^18 bytes (exabyte) as the content length so that the client will
- // be expecting data.
- send.Run("HTTP/1.1 200 OK\r\nContent-Length:1000000000000000000\r\n\r\n",
- base::Bind(&ExabyteResponse::SendExabyte, send));
- }
-
- private:
- // Keeps sending the word "echo" over and over again. It can go further to
- // limit the response to exactly an exabyte, but it shouldn't be necessary
- // for the purpose of testing.
- static void SendExabyte(const net::test_server::SendBytesCallback& send) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(send, "echo",
- base::Bind(&ExabyteResponse::SendExabyte, send)));
- }
-
- DISALLOW_COPY_AND_ASSIGN(ExabyteResponse);
-};
std::unique_ptr<net::test_server::RawHttpResponse> ConstructResponseBasedOnFile(
const base::FilePath& file_path) {
@@ -192,11 +161,6 @@
return std::unique_ptr<net::test_server::BasicHttpResponse>();
}
-std::unique_ptr<net::test_server::HttpResponse> HandleExabyteRequest(
- const net::test_server::HttpRequest& request) {
- return base::WrapUnique(new ExabyteResponse);
-}
-
} // namespace
jboolean StartNativeTestServer(JNIEnv* env,
@@ -214,9 +178,6 @@
g_test_server = new net::EmbeddedTestServer();
g_test_server->RegisterRequestHandler(
base::Bind(&NativeTestServerRequestHandler));
- g_test_server->RegisterDefaultHandler(
- base::Bind(&net::test_server::HandlePrefixedRequest, kExabyteResponsePath,
- base::Bind(&HandleExabyteRequest)));
g_test_server->RegisterRequestHandler(base::Bind(&SdchRequestHandler));
base::FilePath test_files_root(
base::android::ConvertJavaStringToUTF8(env, jtest_files_root));
@@ -296,14 +257,6 @@
std::string url(base::StringPrintf("http://%s:%d", kFakeSdchDomain,
g_test_server->port()));
return base::android::ConvertUTF8ToJavaString(env, url);
-}
-
-ScopedJavaLocalRef<jstring> GetExabyteResponseURL(
- JNIEnv* env,
- const JavaParamRef<jclass>& jcaller) {
- DCHECK(g_test_server);
- GURL url = g_test_server->GetURL(kExabyteResponsePath);
- return base::android::ConvertUTF8ToJavaString(env, url.spec());
}
ScopedJavaLocalRef<jstring> GetHostPort(JNIEnv* env,

Powered by Google App Engine
This is Rietveld 408576698