Merge "Added "run all tests in the current directory" menu option."
This commit is contained in:
committed by
Android (Google) Code Review
commit
4cf63e57ac
20
tests/DumpRenderTree2/res/menu/gui_menu.xml
Normal file
20
tests/DumpRenderTree2/res/menu/gui_menu.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/run_all"
|
||||
android:title="@string/run_all_tests" />
|
||||
</menu>
|
||||
@@ -25,4 +25,6 @@ limitations under the License.
|
||||
<string name="dialog_progress_msg">Please wait...</string>
|
||||
|
||||
<string name="runner_preloading_title">Preloading tests...</string>
|
||||
|
||||
<string name="run_all_tests">Run all tests in the current directory</string>
|
||||
</resources>
|
||||
@@ -35,6 +35,9 @@ import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
@@ -205,11 +208,7 @@ public class DirListActivity extends ListActivity {
|
||||
showDir(item.getRelativePath());
|
||||
} else {
|
||||
/** Run the test */
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(DirListActivity.this, TestsListActivity.class);
|
||||
intent.setAction(Intent.ACTION_RUN);
|
||||
intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, item.getRelativePath());
|
||||
startActivity(intent);
|
||||
runAllTestsUnder(item.getRelativePath());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -236,6 +235,32 @@ public class DirListActivity extends ListActivity {
|
||||
showDir("");
|
||||
}
|
||||
|
||||
private void runAllTestsUnder(String relativePath) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(DirListActivity.this, TestsListActivity.class);
|
||||
intent.setAction(Intent.ACTION_RUN);
|
||||
intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, relativePath);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.gui_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.run_all:
|
||||
runAllTestsUnder(mCurrentDirPath);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Moves to the parent directory if one exists. Does not allow to move above
|
||||
@@ -278,13 +303,7 @@ public class DirListActivity extends ListActivity {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
removeDialog(DIALOG_RUN_ABORT_DIR);
|
||||
/** Run the tests */
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(DirListActivity.this, TestsListActivity.class);
|
||||
intent.setAction(Intent.ACTION_RUN);
|
||||
intent.putExtra(TestsListActivity.EXTRA_TEST_PATH,
|
||||
args.getString("relativePath"));
|
||||
startActivity(intent);
|
||||
runAllTestsUnder(args.getString("relativePath"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user