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
3 // found in the LICENSE file.
5 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_ANDROID_EMBEDDED_TEST_SERVER_ANDROID_H_
6 #define NET_TEST_EMBEDDED_TEST_SERVER_ANDROID_EMBEDDED_TEST_SERVER_ANDROID_H_
10 #include "base/android/jni_weak_ref.h"
11 #include "base/android/scoped_java_ref.h"
12 #include "net/test/embedded_test_server/embedded_test_server.h"
13 #include "net/test/embedded_test_server/http_request.h"
14 #include "net/test/embedded_test_server/http_response.h"
17 namespace test_server
{
19 // The C++ side of the Java EmbeddedTestServer.
20 class EmbeddedTestServerAndroid
{
22 EmbeddedTestServerAndroid(JNIEnv
* env
, jobject obj
);
23 ~EmbeddedTestServerAndroid();
25 void Destroy(JNIEnv
* env
, jobject obj
);
27 jboolean
InitializeAndWaitUntilReady(JNIEnv
* env
, jobject jobj
);
29 jboolean
ShutdownAndWaitUntilComplete(JNIEnv
* env
, jobject jobj
);
31 base::android::ScopedJavaLocalRef
<jstring
>
32 GetURL(JNIEnv
* jenv
, jobject jobj
, jstring jrelative_url
) const;
34 void ServeFilesFromDirectory(JNIEnv
* env
,
36 jstring jdirectory_path
);
38 static bool RegisterEmbeddedTestServerAndroid(JNIEnv
* env
);
41 JavaObjectWeakGlobalRef weak_java_server_
;
43 EmbeddedTestServer test_server_
;
45 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServerAndroid
);
48 } // namespace test_server
51 #endif // NET_TEST_EMBEDDED_TEST_SERVER_ANDROID_EMBEDDED_TEST_SERVER_ANDROID_H_