summaryrefslogtreecommitdiffstats
path: root/chrome/test/page_cycler
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 23:51:38 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 23:51:38 +0000
commitbabfb66def4258aa1ee5d3f2d89e3a0dc0724f54 (patch)
tree89e04f380d53769c632d9ffa98a00fb17b091b36 /chrome/test/page_cycler
parent1e8acf55bca9ea13ed940b3c197a89d2585b00d6 (diff)
downloadchromium_src-babfb66def4258aa1ee5d3f2d89e3a0dc0724f54.zip
chromium_src-babfb66def4258aa1ee5d3f2d89e3a0dc0724f54.tar.gz
chromium_src-babfb66def4258aa1ee5d3f2d89e3a0dc0724f54.tar.bz2
Add extensions content scripts to page cycler tests.
This includes two things: -A profile containing 10 different extensions, each with 1 content script. (We already had one with 1 extension). -Changes to page_cycler_tests.cc to add versions of MozFile and MorejsFile run with 1 and 10 extensions having a content script. (Only the 1-extension case will be run by default on the buildbots). BUG=14037 TEST=none Review URL: http://codereview.chromium.org/235013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/page_cycler')
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc150
1 files changed, 63 insertions, 87 deletions
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index 06d61de..d373550 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -177,7 +177,6 @@ class PageCyclerTest : public UITest {
// For HTTP tests, the name must be safe for use in a URL without escaping.
void RunPageCycler(const char* name, std::wstring* pages,
std::string* timings, bool use_http) {
-
// Make sure the test data is checked out
FilePath test_path;
PathService::Get(base::DIR_SOURCE_ROOT, &test_path);
@@ -373,27 +372,30 @@ class PageCyclerTest : public UITest {
}
#endif // !defined(OS_MACOSX)
-
}
// When use_http is true, the test name passed here will be used directly in
// the path to the test data, so it must be safe for use in a URL without
// escaping. (No pound (#), question mark (?), semicolon (;), non-ASCII, or
// other funny stuff.)
- void RunTest(const char* name, bool use_http) {
+ void RunTestWithSuffix(const char* name, bool use_http, const char* suffix) {
std::wstring pages;
std::string timings;
RunPageCycler(name, &pages, &timings, use_http);
if (timings.empty())
return;
- PrintMemoryUsageInfo("");
- PrintIOPerfInfo("");
-
+ PrintMemoryUsageInfo(suffix);
+ PrintIOPerfInfo(suffix);
+ std::string trace_name = "t" + std::string(suffix);
wprintf(L"\nPages: [%ls]\n", pages.c_str());
- PrintResultList("times", "", "t", timings, "ms",
+ PrintResultList("times", "", trace_name, timings, "ms",
true /* important */);
}
+
+ void RunTest(const char* name, bool use_http) {
+ RunTestWithSuffix(name, use_http, "");
+ }
};
class PageCyclerReferenceTest : public PageCyclerTest {
@@ -434,94 +436,68 @@ class PageCyclerReferenceTest : public PageCyclerTest {
}
};
-// file-URL tests
-TEST_F(PageCyclerTest, MozFile) {
- RunTest("moz", false);
-}
-
-TEST_F(PageCyclerReferenceTest, MozFile) {
- RunTest("moz", false);
-}
-
-TEST_F(PageCyclerTest, Intl1File) {
- RunTest("intl1", false);
-}
-
-TEST_F(PageCyclerReferenceTest, Intl1File) {
- RunTest("intl1", false);
-}
-
-TEST_F(PageCyclerTest, Intl2File) {
- RunTest("intl2", false);
-}
-
-TEST_F(PageCyclerReferenceTest, Intl2File) {
- RunTest("intl2", false);
-}
-
-TEST_F(PageCyclerTest, DomFile) {
- RunTest("dom", false);
-}
-
-TEST_F(PageCyclerReferenceTest, DomFile) {
- RunTest("dom", false);
-}
+class PageCyclerExtensionTest : public PageCyclerTest {
+ public:
+ void SetUp() {}
+ void RunTest(const char* extension_profile, const char* output_suffix,
+ const char* name, bool use_http) {
+ // Set up the extension profile directory.
+ ASSERT_TRUE(extension_profile != NULL);
+ FilePath data_dir;
+ PathService::Get(chrome::DIR_TEST_DATA, &data_dir);
+ data_dir = data_dir.AppendASCII("extensions").AppendASCII("profiles").
+ AppendASCII(extension_profile);
+ ASSERT_TRUE(file_util::DirectoryExists(data_dir));
+ set_template_user_data(data_dir.ToWStringHack());
-TEST_F(PageCyclerTest, DhtmlFile) {
- RunTest("dhtml", false);
-}
+ // Now run the test.
+ PageCyclerTest::SetUp();
+ PageCyclerTest::RunTestWithSuffix(name, use_http, output_suffix);
+ }
+};
-TEST_F(PageCyclerReferenceTest, DhtmlFile) {
- RunTest("dhtml", false);
+// This macro simplifies setting up regular and reference build tests.
+#define PAGE_CYCLER_TESTS(test, name, use_http) \
+TEST_F(PageCyclerTest, name) { \
+ RunTest(test, use_http); \
+} \
+TEST_F(PageCyclerReferenceTest, name) { \
+ RunTest(test, use_http); \
}
-TEST_F(PageCyclerTest, MorejsFile) {
- RunTest("morejs", false);
+// These are shorthand for File vs. Http tests.
+#define PAGE_CYCLER_FILE_TESTS(test, name)\
+ PAGE_CYCLER_TESTS(test, name, false)
+#define PAGE_CYCLER_HTTP_TESTS(test, name)\
+ PAGE_CYCLER_TESTS(test, name, true)
+
+// This macro lets us define tests with 1 and 10 extensions with 1 content
+// script each. The name for the 10-extension case is changed so as not
+// to run by default on the buildbots.
+#define PAGE_CYCLER_EXTENSIONS_FILE_TESTS(test, name) \
+TEST_F(PageCyclerExtensionTest, name) { \
+ RunTest("content_scripts1", "_extcs1", test, false); \
+} \
+TEST_F(PageCyclerExtensionTest, name##10) { \
+ RunTest("content_scripts10", "_extcs10", test, false); \
}
-TEST_F(PageCyclerReferenceTest, MorejsFile) {
- RunTest("morejs", false);
-}
+// file-URL tests
+PAGE_CYCLER_FILE_TESTS("moz", MozFile);
+PAGE_CYCLER_EXTENSIONS_FILE_TESTS("moz", MozFile);
+PAGE_CYCLER_FILE_TESTS("intl1", Intl1File);
+PAGE_CYCLER_FILE_TESTS("intl2", Intl2File);
+PAGE_CYCLER_FILE_TESTS("dom", DomFile);
+PAGE_CYCLER_FILE_TESTS("dhtml", DhtmlFile);
+PAGE_CYCLER_FILE_TESTS("morejs", MorejsFile);
+PAGE_CYCLER_EXTENSIONS_FILE_TESTS("morejs", MorejsFile);
// http (localhost) tests
-TEST_F(PageCyclerTest, MozHttp) {
- RunTest("moz", true);
-}
-
-TEST_F(PageCyclerReferenceTest, MozHttp) {
- RunTest("moz", true);
-}
-
-TEST_F(PageCyclerTest, Intl1Http) {
- RunTest("intl1", true);
-}
-
-TEST_F(PageCyclerReferenceTest, Intl1Http) {
- RunTest("intl1", true);
-}
-
-TEST_F(PageCyclerTest, Intl2Http) {
- RunTest("intl2", true);
-}
-
-TEST_F(PageCyclerReferenceTest, Intl2Http) {
- RunTest("intl2", true);
-}
-
-TEST_F(PageCyclerTest, DomHttp) {
- RunTest("dom", true);
-}
-
-TEST_F(PageCyclerReferenceTest, DomHttp) {
- RunTest("dom", true);
-}
+PAGE_CYCLER_HTTP_TESTS("moz", MozHttp);
+PAGE_CYCLER_HTTP_TESTS("intl1", Intl1Http);
+PAGE_CYCLER_HTTP_TESTS("intl2", Intl2Http);
+PAGE_CYCLER_HTTP_TESTS("dom", DomHttp);
+PAGE_CYCLER_HTTP_TESTS("bloat", BloatHttp);
-TEST_F(PageCyclerTest, BloatHttp) {
- RunTest("bloat", true);
-}
-
-TEST_F(PageCyclerReferenceTest, BloatHttp) {
- RunTest("bloat", true);
-}
} // namespace