• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 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.stress;
18 
19 import android.os.Environment;
20 import java.io.FileWriter;
21 import java.io.BufferedWriter;
22 
23 
24 /**
25  * Collection of utility functions used for the test.
26  */
27 public class TestUtil {
28     public BufferedWriter mOut;
29     public FileWriter mfstream;
30 
TestUtil()31     public TestUtil() {
32     }
33 
prepareOutputFile()34     public void prepareOutputFile() throws Exception {
35         String camera_test_output_file =
36                 Environment.getExternalStorageDirectory().toString() + "/mediaStressOut.txt";
37         mfstream = new FileWriter(camera_test_output_file, true);
38         mOut = new BufferedWriter(mfstream);
39     }
40 
closeOutputFile()41     public void closeOutputFile() throws Exception {
42         mOut.write("\n");
43         mOut.close();
44         mfstream.close();
45     }
46 
writeReportHeader(String reportTag, int iteration)47     public void writeReportHeader(String reportTag, int iteration) throws Exception {
48         mOut.write(reportTag);
49         mOut.write("No of loops :" + iteration + "\n");
50         mOut.write("loop: ");
51     }
52 
writeResult(int iteration)53     public void writeResult(int iteration) throws Exception {
54         mOut.write(" ," + iteration);
55         mOut.flush();
56     }
57 }
58