The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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.dumprendertree; |
| 18 | |
Guang Zhu | 3e8950c | 2009-06-03 12:23:09 -0700 | [diff] [blame] | 19 | import android.os.Bundle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | import android.test.InstrumentationTestRunner; |
| 21 | import android.test.InstrumentationTestSuite; |
Guang Zhu | 3e8950c | 2009-06-03 12:23:09 -0700 | [diff] [blame] | 22 | |
| 23 | import junit.framework.TestSuite; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | |
| 25 | |
| 26 | /** |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 27 | * Instrumentation Test Runner for all DumpRenderTree tests. |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 28 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | * Running all tests: |
| 30 | * |
| 31 | * adb shell am instrument \ |
| 32 | * -w com.android.dumprendertree.LayoutTestsAutoRunner |
| 33 | */ |
| 34 | |
| 35 | public class LayoutTestsAutoRunner extends InstrumentationTestRunner { |
| 36 | @Override |
| 37 | public TestSuite getAllTests() { |
| 38 | TestSuite suite = new InstrumentationTestSuite(this); |
| 39 | suite.addTestSuite(LayoutTestsAutoTest.class); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 40 | suite.addTestSuite(LoadTestsAutoTest.class); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | return suite; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public ClassLoader getLoader() { |
| 46 | return LayoutTestsAutoRunner.class.getClassLoader(); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void onCreate(Bundle icicle) { |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 51 | this.mTestPath = (String) icicle.get("path"); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | String timeout_str = (String) icicle.get("timeout"); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | if (timeout_str != null) { |
| 54 | try { |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 55 | this.mTimeoutInMillis = Integer.parseInt(timeout_str); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | } catch (Exception e) { |
| 57 | e.printStackTrace(); |
| 58 | } |
| 59 | } |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 60 | |
Guang Zhu | 3e8950c | 2009-06-03 12:23:09 -0700 | [diff] [blame] | 61 | String delay_str = (String) icicle.get("delay"); |
| 62 | if(delay_str != null) { |
| 63 | try { |
| 64 | this.mDelay = Integer.parseInt(delay_str); |
| 65 | } catch (Exception e) { |
| 66 | } |
| 67 | } |
Guang Zhu | bfa68ab | 2009-11-05 15:24:10 -0800 | [diff] [blame] | 68 | |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 69 | String r = icicle.getString("rebaseline"); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 70 | this.mRebaseline = (r != null && r.toLowerCase().equals("true")); |
Guang Zhu | bfa68ab | 2009-11-05 15:24:10 -0800 | [diff] [blame] | 71 | |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 72 | String logtime = icicle.getString("logtime"); |
Guang Zhu | 2ab6f1f | 2009-06-10 13:37:03 -0700 | [diff] [blame] | 73 | this.mLogtime = (logtime != null |
| 74 | && logtime.toLowerCase().equals("true")); |
Guang Zhu | bfa68ab | 2009-11-05 15:24:10 -0800 | [diff] [blame] | 75 | |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 76 | String drawTime = icicle.getString("drawtime"); |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 77 | this.mGetDrawTime = (drawTime != null |
| 78 | && drawTime.toLowerCase().equals("true")); |
| 79 | |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 80 | mSaveImagePath = icicle.getString("saveimage"); |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 81 | |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 82 | mJsEngine = icicle.getString("jsengine"); |
| 83 | |
| 84 | mPageCyclerSuite = icicle.getString("suite"); |
| 85 | mPageCyclerForwardHost = icicle.getString("forward"); |
| 86 | mPageCyclerIteration = icicle.getString("iteration", "5"); |
Steve Block | 12077e1 | 2010-02-25 12:50:33 +0000 | [diff] [blame] | 87 | |
Guang Zhu | bfa68ab | 2009-11-05 15:24:10 -0800 | [diff] [blame] | 88 | super.onCreate(icicle); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | } |
Guang Zhu | f6d1b3f | 2011-04-26 16:41:13 -0700 | [diff] [blame] | 90 | |
| 91 | String mPageCyclerSuite; |
| 92 | String mPageCyclerForwardHost; |
| 93 | String mPageCyclerIteration; |
| 94 | String mTestPath; |
| 95 | String mSaveImagePath; |
| 96 | int mTimeoutInMillis; |
| 97 | int mDelay; |
| 98 | boolean mRebaseline; |
| 99 | boolean mLogtime; |
| 100 | boolean mGetDrawTime; |
| 101 | String mJsEngine; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 | } |