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

Unified Diff: components/web_restrictions/browser/mock_web_restrictions_client.h

Issue 1684153002: Web restrictions component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test compilation errors. Created 4 years, 10 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/web_restrictions/browser/mock_web_restrictions_client.h
diff --git a/components/web_restrictions/browser/mock_web_restrictions_client.h b/components/web_restrictions/browser/mock_web_restrictions_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ed07dcffcaeb1f9d11450965d3d4f23a8cbf85e
--- /dev/null
+++ b/components/web_restrictions/browser/mock_web_restrictions_client.h
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WEB_RESTRICTIONS_BROWSER_MOCK_WEB_RESTRICTIONS_CLIENT_H_
+#define COMPONENTS_WEB_RESTRICTIONS_BROWSER_MOCK_WEB_RESTRICTIONS_CLIENT_H_
+
+#include "base/macros.h"
+#include "jni/MockWebRestrictionsClient_jni.h"
+
+namespace web_restrictions {
+
+// This is a wrapper for the Java MockWebRestrictionsClient.
+class MockWebRestrictionsClient {
+ public:
+ MockWebRestrictionsClient()
+ : env_(base::android::AttachCurrentThread()) {
+ 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.
+ Java_MockWebRestrictionsClient_registerAsMockForTesting(env_);
+ }
+
+ ~MockWebRestrictionsClient() {
+ Java_MockWebRestrictionsClient_unregisterAsMockForTesting(env_);
+ }
+
+ private:
+ 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.
+};
+
+} // namespace web_restrictions
+#endif // COMPONENTS_WEB_RESTRICTIONS_BROWSER_MOCK_WEB_RESTRICTIONS_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698