Bug 744094 - Shorten enum value identifiers to be less redundant. r=jmaher
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 10 Apr 2012 14:20:46 -0500
changeset 94653 6a50937c9035e143098146a78b2dbc70b155e683
parent 94652 ab09a3d4692694cbb94468a05847ce78e1498fa2
child 94654 42fde200605462d7ba9e33a8bcd110cf597ec104
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs744094
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 744094 - Shorten enum value identifiers to be less redundant. r=jmaher
build/mobile/robocop/FennecMochitestAssert.java.in
build/mobile/robocop/FennecNativeActions.java.in
build/mobile/robocop/FennecNativeDriver.java.in
build/mobile/robocop/FennecNativeElement.java.in
build/mobile/robocop/FennecTalosAssert.java.in
--- a/build/mobile/robocop/FennecMochitestAssert.java.in
+++ b/build/mobile/robocop/FennecMochitestAssert.java.in
@@ -58,22 +58,22 @@ public class FennecMochitestAssert imple
     // Measure the time it takes to run test case
     private long mStartTime = 0;
 
     public FennecMochitestAssert() {
     }
 
     /** Write information to a logfile and logcat */
     public void dumpLog(String message) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message);
     }
 
     /** Write information to a logfile and logcat */
     public void dumpLog(String message, Throwable t) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message, t);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t);
     }
 
     /** Set the filename used for dumpLog. */
     public void setLogFile(String filename) {
         FennecNativeDriver.setLogFile(filename);
 
         String message;
         if (!mLogStarted) {
--- a/build/mobile/robocop/FennecNativeActions.java.in
+++ b/build/mobile/robocop/FennecNativeActions.java.in
@@ -132,17 +132,17 @@ public class FennecNativeActions impleme
                 return this == args[0];
             }
             if(methodName.equals("clone")) {
                 return this;
             }
             if(methodName.equals("hashCode")) {
                 return 314;
             }
-            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG, 
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG, 
                 "Waking up on "+methodName);
             mEventExpecter.notifyOfEvent();
             return null;
         }
     }
 
     class GeckoEventExpecter implements EventExpecter {
         private final String mGeckoEvent;
@@ -158,43 +158,43 @@ public class FennecNativeActions impleme
             while (! mEventReceived) {
                 try {
                     this.wait();
                 } catch (InterruptedException ie) {
                     ie.printStackTrace();
                     break;
                 }
             }
-            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
                 "unblocked on expecter for " + mGeckoEvent);
         }
 
         public synchronized boolean eventReceived() {
             return mEventReceived;
         }
 
         void notifyOfEvent() {
             try {
                 mUnregisterGEL.invoke(null, mRegistrationParams);
             } catch (IllegalAccessException e) {
                 e.printStackTrace();
             } catch (InvocationTargetException e) {
                 e.printStackTrace();
             }
-            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
                 "received event " + mGeckoEvent);
             synchronized (this) {
                 mEventReceived = true;
                 this.notifyAll();
             }
         }
     }
     
     public EventExpecter expectGeckoEvent(String geckoEvent) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
             "waiting for "+geckoEvent);
         try {
             Class [] interfaces = new Class[1];
             interfaces[0] = mGel;
             Object[] finalParams = new Object[2];
             finalParams[0] = geckoEvent;
          
             GeckoEventExpecter expecter = new GeckoEventExpecter(geckoEvent, finalParams);
@@ -217,17 +217,17 @@ public class FennecNativeActions impleme
 
         DrawListenerProxy(PaintExpecter paintExpecter) {
             mPaintExpecter = paintExpecter;
         }
 
         public Object invoke(Object proxy, Method method, Object[] args) {
             String methodName = method.getName();
             if ("drawFinished".equals(methodName)) {
-                FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+                FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
                     "Received drawFinished notification");
                 mPaintExpecter.notifyOfEvent();
             } else if ("toString".equals(methodName)) {
                 return "DrawListenerProxy";
             } else if ("equals".equals(methodName)) {
                 return false;
             } else if ("hashCode".equals(methodName)) {
                 return 0;
--- a/build/mobile/robocop/FennecNativeDriver.java.in
+++ b/build/mobile/robocop/FennecNativeDriver.java.in
@@ -73,37 +73,37 @@ public class FennecNativeDriver implemen
     private static final int FRAME_TIME_THRESHOLD = 17;     // allow 17ms per frame (~60fps)
 
     // Map of IDs to element names.
     private HashMap mLocators = null;
     private Activity mActivity;
     private Solo mSolo;
 
     private static String mLogFile = null;
-    private static LogLevel mLogLevel = LogLevel.LOG_LEVEL_INFO;
+    private static LogLevel mLogLevel = LogLevel.INFO;
 
     // Objects for reflexive access of fennec classes.
     private ClassLoader mClassLoader;
     private Class mGel;
     private Class mGe;
     private Class mGas;
     private Method mRegisterGEL;
     private Method mUnregisterGEL;
     private Method mSendGE;
     private Method _startFrameRecording;
     private Method _stopFrameRecording;
     private Method _startCheckerboardRecording;
     private Method _stopCheckerboardRecording;
     private Method _getPixels;
 
     public enum LogLevel {
-        LOG_LEVEL_DEBUG(1), 
-        LOG_LEVEL_INFO(2),    
-        LOG_LEVEL_WARN(3), 
-        LOG_LEVEL_ERROR(4);
+        DEBUG(1),
+        INFO(2),
+        WARN(3),
+        ERROR(4);
 
         private int mValue;
         LogLevel(int value) {
             mValue = value;
         }
         public boolean isEnabled(LogLevel configuredLevel) {
             return mValue >= configuredLevel.getValue();
         }
@@ -361,17 +361,17 @@ public class FennecNativeDriver implemen
                 mScrollHeight = jo.getInt("y");
                 mHeight = jo.getInt("cheight");
                 // We don't want a height of 0. That means it's a bad response.
                 if (mHeight > 0) {
                     mPageHeight = jo.getInt("height");
                 }
 
             } catch( Throwable e) {
-                FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_WARN, 
+                FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN, 
                     "WARNING: ScrollReceived, but read wrong!");
             }
             return null;
         }
     }
 
     public int getScrollHeight() {
         return mScrollHeight;
@@ -488,19 +488,19 @@ public class FennecNativeDriver implemen
             }
             // PrintWriter doesn't throw IOE but sets an error flag instead,
             // so check for that
             if (pw.checkError()) {
                 Log.e("Robocop", "exception with file writer on: " + mLogFile);
             }
         }
 
-        if (level == LogLevel.LOG_LEVEL_INFO) {
+        if (level == LogLevel.INFO) {
             Log.i("Robocop", message, t);
-        } else if (level == LogLevel.LOG_LEVEL_DEBUG) {
+        } else if (level == LogLevel.DEBUG) {
             Log.d("Robocop", message, t);
-        } else if (level == LogLevel.LOG_LEVEL_WARN) {
+        } else if (level == LogLevel.WARN) {
             Log.w("Robocop", message, t);
-        } else if (level == LogLevel.LOG_LEVEL_ERROR) {
+        } else if (level == LogLevel.ERROR) {
             Log.e("Robocop", message, t);
         }
     }
 }
--- a/build/mobile/robocop/FennecNativeElement.java.in
+++ b/build/mobile/robocop/FennecNativeElement.java.in
@@ -71,17 +71,17 @@ public class FennecNativeElement impleme
     public void click() {
         final SynchronousQueue syncQueue = new SynchronousQueue();
         mActivity.runOnUiThread(
             new Runnable() {
                 public void run() {
                     View view = (View)mActivity.findViewById(mId);
                     if(view != null) {
                         if (!view.performClick()) {
-                            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_WARN,
+                            FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN,
                                 "Robocop called click on an element with no listener");
                         }
                     } else {
                         throw new RoboCopException("click: unable to find view "+mId); 
                     }
                     syncQueue.offer(new Object());
                 }
             });
--- a/build/mobile/robocop/FennecTalosAssert.java.in
+++ b/build/mobile/robocop/FennecTalosAssert.java.in
@@ -41,22 +41,22 @@ package @ANDROID_PACKAGE_NAME@;
 public class FennecTalosAssert implements Assert {
     
     public FennecTalosAssert() { }
 
     /**
      *  Write information to a logfile and logcat
      */
     public void dumpLog(String message) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message);
     }
 
     /** Write information to a logfile and logcat */
     public void dumpLog(String message, Throwable t) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message, t);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t);
     }
 
     /**
      *  Set the filename used for dumpLog.
      */
     public void setLogFile(String filename) {
         FennecNativeDriver.setLogFile(filename);
     }