OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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. | |
4 | |
5 #ifndef COMPONENTS_WEB_RESTRICTIONS_BROWSER_MOCK_WEB_RESTRICTIONS_CLIENT_H_ | |
6 #define COMPONENTS_WEB_RESTRICTIONS_BROWSER_MOCK_WEB_RESTRICTIONS_CLIENT_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "jni/MockWebRestrictionsClient_jni.h" | |
10 | |
11 namespace web_restrictions { | |
12 | |
13 // This is a wrapper for the Java MockWebRestrictionsClient. | |
14 class MockWebRestrictionsClient { | |
15 public: | |
16 MockWebRestrictionsClient() | |
17 : env_(base::android::AttachCurrentThread()) { | |
18 RegisterNativesImpl(env_); | |
Bernhard Bauer
2016/02/22 12:39:17
This would register the JNI methods every time thi
aberent
2016/02/23 13:52:37
Done.
| |
19 Java_MockWebRestrictionsClient_registerAsMockForTesting(env_); | |
20 } | |
21 | |
22 ~MockWebRestrictionsClient() { | |
23 Java_MockWebRestrictionsClient_unregisterAsMockForTesting(env_); | |
24 } | |
25 | |
26 private: | |
27 JNIEnv* env_; | |
Bernhard Bauer
2016/02/22 12:39:16
It's bad form to hold on to a JNIEnv object. Just
aberent
2016/02/23 13:52:37
Done.
| |
28 }; | |
29 | |
30 } // namespace web_restrictions | |
31 #endif // COMPONENTS_WEB_RESTRICTIONS_BROWSER_MOCK_WEB_RESTRICTIONS_CLIENT_H_ | |
OLD | NEW |