Home | History | Annotate | Download | only in activity
      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.camera.activity;
     18 
     19 import android.test.suitebuilder.annotation.LargeTest;
     20 
     21 import com.android.camera.CameraActivity;
     22 import com.android.camera.CameraTestDevice;
     23 import com.android.gallery3d.R;
     24 
     25 import static com.google.testing.littlemock.LittleMock.doReturn;
     26 
     27 public class CameraActivityTest extends CameraTestCase <CameraActivity> {
     28     public CameraActivityTest() {
     29         super(CameraActivity.class);
     30     }
     31 
     32     @LargeTest
     33     public void testFailToConnect() throws Exception {
     34         super.internalTestFailToConnect();
     35     }
     36 
     37     @LargeTest
     38     public void testTakePicture() throws Exception {
     39         CameraTestDevice.injectMockCamera(mCameraInfo, mOneMockCamera);
     40 
     41         getActivity();
     42         getInstrumentation().waitForIdleSync();
     43 
     44         // Press shutter button to take a picture.
     45         performClick(R.id.shutter_button);
     46         getInstrumentation().waitForIdleSync();
     47 
     48         // Force the activity to finish.
     49         getActivity().finish();
     50         getInstrumentation().waitForIdleSync();
     51     }
     52 }
     53