diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-07 14:13:10 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-07 14:13:10 +0000 |
commit | a2c6a828bafded3d0070de96fccf1d36d4416076 (patch) | |
tree | e7682a7d722ae495f6594729578a151c44489bad /chrome/test/page_cycler | |
parent | b49b8955f5910486dd4bf3f86ef77388fc6bbc43 (diff) | |
download | chromium_src-a2c6a828bafded3d0070de96fccf1d36d4416076.zip chromium_src-a2c6a828bafded3d0070de96fccf1d36d4416076.tar.gz chromium_src-a2c6a828bafded3d0070de96fccf1d36d4416076.tar.bz2 |
Make page_cycler_tests build on Linux (doesn't run successfully yet).
Review URL: http://codereview.chromium.org/40182
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/page_cycler')
-rw-r--r-- | chrome/test/page_cycler/page_cycler_test.cc | 83 | ||||
-rw-r--r-- | chrome/test/page_cycler/page_cycler_tests.scons | 12 |
2 files changed, 55 insertions, 40 deletions
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index 8f5fead..5899071 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -11,7 +11,10 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" +#if defined(OS_WIN) +// TODO(port): Enable when chrome_process_filter.h is ported. #include "chrome/common/chrome_process_filter.h" +#endif // defined(OS_WIN) #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" @@ -28,7 +31,7 @@ // URL at which data files may be found for HTTP tests. The document root of // this URL's server should point to data/page_cycler/. -#define BASE_URL L"http://localhost:8000" +static const char kBaseUrl[] = "http://localhost:8000/"; namespace { @@ -43,23 +46,20 @@ class PageCyclerTest : public UITest { } // For HTTP tests, the name must be safe for use in a URL without escaping. - void RunPageCycler(const wchar_t* name, std::wstring* pages, + void RunPageCycler(const char* name, std::wstring* pages, std::wstring* timings, bool use_http) { GURL test_url; if (use_http) { - std::wstring test_path(BASE_URL); - file_util::AppendToPath(&test_path, name); - file_util::AppendToPath(&test_path, L"start.html"); - test_url = GURL(test_path); + test_url = GURL(std::string(kBaseUrl) + name + "start.html"); } else { - std::wstring test_path; + FilePath test_path; PathService::Get(base::DIR_EXE, &test_path); - file_util::UpOneDirectory(&test_path); - file_util::UpOneDirectory(&test_path); - file_util::AppendToPath(&test_path, L"data"); - file_util::AppendToPath(&test_path, L"page_cycler"); - file_util::AppendToPath(&test_path, name); - file_util::AppendToPath(&test_path, L"start.html"); + test_path = test_path.DirName(); + test_path = test_path.DirName(); + test_path = test_path.Append(FILE_PATH_LITERAL("data")); + test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler")); + test_path = test_path.AppendASCII(name); + test_path = test_path.Append(FILE_PATH_LITERAL("start.html")); test_url = net::FilePathToFileURL(test_path); } @@ -80,13 +80,15 @@ class PageCyclerTest : public UITest { std::string cookie; ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_pages", &cookie)); - pages->swap(UTF8ToWide(cookie)); + pages->assign(UTF8ToWide(cookie)); ASSERT_FALSE(pages->empty()); ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_timings", &cookie)); - timings->swap(UTF8ToWide(cookie)); + timings->assign(UTF8ToWide(cookie)); ASSERT_FALSE(timings->empty()); } +#if defined(OS_WIN) + // TODO(port): Code below depends on BrowserProcessFilter and has windowsisms. void PrintIOPerfInfo(const wchar_t* test_name) { BrowserProcessFilter chrome_filter(L""); base::NamedProcessIterator @@ -196,19 +198,23 @@ class PageCyclerTest : public UITest { } } } +#endif // defined(OS_WIN) // 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 wchar_t* name, bool use_http) { + void RunTest(const char* name, bool use_http) { std::wstring pages, timings; RunPageCycler(name, &pages, &timings, use_http); if (timings.empty()) return; +#if defined(OS_WIN) + // TODO(port): Enable when Print{MemoryUsage,IOPerf}Info are ported. PrintMemoryUsageInfo(L""); PrintIOPerfInfo(L""); +#endif // defined(OS_WIN) wprintf(L"\nPages: [%ls]\n", pages.c_str()); PrintResultList(L"times", L"", L"t", timings, L"ms", @@ -229,14 +235,17 @@ class PageCyclerReferenceTest : public PageCyclerTest { UITest::SetUp(); } - void RunTest(const wchar_t* name, bool use_http) { + void RunTest(const char* name, bool use_http) { std::wstring pages, timings; RunPageCycler(name, &pages, &timings, use_http); if (timings.empty()) return; +#if defined(OS_WIN) + // TODO(port): Enable when Print{MemoryUsage,IOPerf}Info are ported. PrintMemoryUsageInfo(L"_ref"); PrintIOPerfInfo(L"_ref"); +#endif // defined(OS_WIN) PrintResultList(L"times", L"", L"t_ref", timings, L"ms", true /* important */); @@ -247,83 +256,83 @@ class PageCyclerReferenceTest : public PageCyclerTest { // file-URL tests TEST_F(PageCyclerTest, MozFile) { - RunTest(L"moz", false); + RunTest("moz", false); } TEST_F(PageCyclerReferenceTest, MozFile) { - RunTest(L"moz", false); + RunTest("moz", false); } TEST_F(PageCyclerTest, Intl1File) { - RunTest(L"intl1", false); + RunTest("intl1", false); } TEST_F(PageCyclerReferenceTest, Intl1File) { - RunTest(L"intl1", false); + RunTest("intl1", false); } TEST_F(PageCyclerTest, Intl2File) { - RunTest(L"intl2", false); + RunTest("intl2", false); } TEST_F(PageCyclerReferenceTest, Intl2File) { - RunTest(L"intl2", false); + RunTest("intl2", false); } TEST_F(PageCyclerTest, DomFile) { - RunTest(L"dom", false); + RunTest("dom", false); } TEST_F(PageCyclerReferenceTest, DomFile) { - RunTest(L"dom", false); + RunTest("dom", false); } TEST_F(PageCyclerTest, DhtmlFile) { - RunTest(L"dhtml", false); + RunTest("dhtml", false); } TEST_F(PageCyclerReferenceTest, DhtmlFile) { - RunTest(L"dhtml", false); + RunTest("dhtml", false); } // http (localhost) tests TEST_F(PageCyclerTest, MozHttp) { - RunTest(L"moz", true); + RunTest("moz", true); } TEST_F(PageCyclerReferenceTest, MozHttp) { - RunTest(L"moz", true); + RunTest("moz", true); } TEST_F(PageCyclerTest, Intl1Http) { - RunTest(L"intl1", true); + RunTest("intl1", true); } TEST_F(PageCyclerReferenceTest, Intl1Http) { - RunTest(L"intl1", true); + RunTest("intl1", true); } TEST_F(PageCyclerTest, Intl2Http) { - RunTest(L"intl2", true); + RunTest("intl2", true); } TEST_F(PageCyclerReferenceTest, Intl2Http) { - RunTest(L"intl2", true); + RunTest("intl2", true); } TEST_F(PageCyclerTest, DomHttp) { - RunTest(L"dom", true); + RunTest("dom", true); } TEST_F(PageCyclerReferenceTest, DomHttp) { - RunTest(L"dom", true); + RunTest("dom", true); } TEST_F(PageCyclerTest, BloatHttp) { - RunTest(L"bloat", true); + RunTest("bloat", true); } TEST_F(PageCyclerReferenceTest, BloatHttp) { - RunTest(L"bloat", true); + RunTest("bloat", true); } diff --git a/chrome/test/page_cycler/page_cycler_tests.scons b/chrome/test/page_cycler/page_cycler_tests.scons index b265b25..984baf1 100644 --- a/chrome/test/page_cycler/page_cycler_tests.scons +++ b/chrome/test/page_cycler/page_cycler_tests.scons @@ -10,6 +10,7 @@ env.ApplySConscript([ '$BASE_DIR/using_base.scons', '$BASE_DIR/gfx/using_base_gfx.scons', '$CHROME_SRC_DIR/build/using_googleurl.scons', + '$CHROME_SRC_DIR/tools/grit/build/using_generated_resources.scons', '$GTEST_DIR/../using_gtest.scons', '$ICU38_DIR/using_icu38.scons', '$LIBPNG_DIR/using_libpng.scons', @@ -31,6 +32,8 @@ env.Prepend( 'browser', 'browser_views', 'common', + 'glue', + 'WTF', ], ) @@ -89,9 +92,12 @@ if not env.Bit('windows'): '$CHROME_DIR/tools/build/win/precompiled_wtl.h', ) -# TODO(port): -if env.Bit('windows'): - env.ChromeTestProgram('page_cycler_tests', input_files) + # TODO(port): Remove files from this list as they get ported. + input_files.Remove( + '$CHROME_DIR/test/perf/mem_usage$OBJSUFFIX', + ) + +env.ChromeTestProgram('page_cycler_tests', input_files) p = env.ChromeMSVSProject('page_cycler_tests.vcproj', dest=('$CHROME_SRC_DIR/chrome/' |