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

Unified Diff: ui/base/clipboard/clipboard_unittest.cc

Issue 11038015: Android: lazy initialization for method id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moves to MethodID Created 8 years, 2 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: ui/base/clipboard/clipboard_unittest.cc
diff --git a/ui/base/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc
index e8b3d39665348fec2eda434146d67e3bf04db46f..c066a3f5b4fa3e350aec5f361ce76baedc41d378 100644
--- a/ui/base/clipboard/clipboard_unittest.cc
+++ b/ui/base/clipboard/clipboard_unittest.cc
@@ -31,6 +31,10 @@
#include "base/message_loop.h"
#endif
+#if defined(OS_ANDROID)
+using base::android::MethodID;
+#endif
joth 2012/10/04 17:59:59 nit: put this down inside the test where you use i
bulach 2012/10/04 18:58:17 Done (indeed, there was already an "using" clause
+
namespace ui {
class ClipboardTest : public PlatformTest {
@@ -657,8 +661,10 @@ TEST_F(ClipboardTest, InternalClipboardInvalidation) {
ScopedJavaLocalRef<jclass> context_class =
base::android::GetClass(env, "android/content/Context");
- jmethodID get_system_service = base::android::GetMethodID(env, context_class,
- "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;");
+ jmethodID get_system_service = MethodID::Get<
+ MethodID::METHODTYPE_NORMAL, MethodID::EXCEPTIONCHECK_YES>(
+ env, context_class.obj(), "getSystemService",
+ "(Ljava/lang/String;)Ljava/lang/Object;");
// Retrieve the system service.
ScopedJavaLocalRef<jstring> service_name(env, env->NewStringUTF("clipboard"));
@@ -669,8 +675,9 @@ TEST_F(ClipboardTest, InternalClipboardInvalidation) {
ScopedJavaLocalRef<jclass> clipboard_class =
base::android::GetClass(env, "android/text/ClipboardManager");
- jmethodID set_text = base::android::GetMethodID(env, clipboard_class,
- "setText", "(Ljava/lang/CharSequence;)V");
+ jmethodID set_text = MethodID::Get<
+ MethodID::METHODTYPE_NORMAL, MethodID::EXCEPTIONCHECK_YES>(
+ env, clipboard_class.obj(), "setText", "(Ljava/lang/CharSequence;)V");
// Will need to call toString as CharSequence is not always a String.
env->CallVoidMethod(clipboard_manager.obj(),

Powered by Google App Engine
This is Rietveld 408576698