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