Home | History | Annotate | Download | only in util
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.mms.util;
     18 
     19 import android.test.AndroidTestCase;
     20 import android.test.suitebuilder.annotation.SmallTest;
     21 import com.android.mms.ui.MessageUtils;
     22 
     23 /**
     24  * Unit tests for Video Capture utilities.
     25  *
     26  * To run the test:
     27  *    runtest --test-class=com.android.mms.util.VideoCaptureTests mms
     28  */
     29 @SmallTest
     30 public class VideoCaptureTests extends AndroidTestCase {
     31 
     32     @Override
     33     protected void setUp() throws Exception {
     34         super.setUp();
     35     }
     36 
     37     /**
     38      * Test the function that computes rounded video record times.
     39      */
     40     public void testVideoCaptureDurationLimit() {
     41         assertEquals(MessageUtils.getVideoCaptureDurationLimit(0), 0);          // 0 -> 0 secs
     42         assertEquals(MessageUtils.getVideoCaptureDurationLimit(100), 0);        // 0 -> 0 secs
     43         assertEquals(MessageUtils.getVideoCaptureDurationLimit(500000), 20);    // 28 -> 20 secs
     44         assertEquals(MessageUtils.getVideoCaptureDurationLimit(1000000), 50);   // 57 -> 50 secs
     45         assertEquals(MessageUtils.getVideoCaptureDurationLimit(10000000), 120); // 570 -> 120 secs
     46     }
     47 }
     48