ServiceWorker: Consolidate version manipulation functions in SWProviderContext
[chromium-blink-merge.git] / sync / test / fake_server / android / fake_server_helper_android.cc
blob725ba639cefdf8151c311e2e472f8891569a43e5
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
3 // found in the LICENSE file.
5 #include "sync/test/fake_server/android/fake_server_helper_android.h"
7 #include <jni.h>
9 #include "base/basictypes.h"
10 #include "jni/FakeServerHelper_jni.h"
11 #include "sync/internal_api/public/network_resources.h"
12 #include "sync/test/fake_server/fake_server.h"
13 #include "sync/test/fake_server/fake_server_network_resources.h"
15 FakeServerHelperAndroid::FakeServerHelperAndroid(JNIEnv* env, jobject obj) {
18 FakeServerHelperAndroid::~FakeServerHelperAndroid() { }
20 static jlong Init(JNIEnv* env, jobject obj) {
21 FakeServerHelperAndroid* fake_server_android =
22 new FakeServerHelperAndroid(env, obj);
23 return reinterpret_cast<intptr_t>(fake_server_android);
26 jlong FakeServerHelperAndroid::CreateFakeServer(JNIEnv* env, jobject obj) {
27 fake_server::FakeServer* fake_server = new fake_server::FakeServer();
28 return reinterpret_cast<intptr_t>(fake_server);
31 jlong FakeServerHelperAndroid::CreateNetworkResources(JNIEnv* env,
32 jobject obj,
33 jlong fake_server) {
34 fake_server::FakeServer* fake_server_ptr =
35 reinterpret_cast<fake_server::FakeServer*>(fake_server);
36 syncer::NetworkResources* resources =
37 new fake_server::FakeServerNetworkResources(fake_server_ptr);
38 return reinterpret_cast<intptr_t>(resources);
41 void FakeServerHelperAndroid::DeleteFakeServer(JNIEnv* env,
42 jobject obj,
43 jlong fake_server) {
44 fake_server::FakeServer* fake_server_ptr =
45 reinterpret_cast<fake_server::FakeServer*>(fake_server);
46 delete fake_server_ptr;
49 // static
50 bool FakeServerHelperAndroid::Register(JNIEnv* env) {
51 return RegisterNativesImpl(env);