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 | |
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')
-rw-r--r-- | chrome/test/automation/automation.scons | 1 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 10 | ||||
-rw-r--r-- | chrome/test/page_cycler/page_cycler_test.cc | 83 | ||||
-rw-r--r-- | chrome/test/page_cycler/page_cycler_tests.scons | 12 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 21 |
5 files changed, 72 insertions, 55 deletions
diff --git a/chrome/test/automation/automation.scons b/chrome/test/automation/automation.scons index b43146a..f4856c8 100644 --- a/chrome/test/automation/automation.scons +++ b/chrome/test/automation/automation.scons @@ -43,7 +43,6 @@ if not env.Bit('windows'): input_files.Remove( 'autocomplete_edit_proxy.cc', 'constrained_window_proxy.cc', - 'tab_proxy.cc', 'window_proxy.cc', ) diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index c5f40e1..bca9c03 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -114,7 +114,6 @@ bool TabProxy::CancelAuth() { if (!is_valid()) return false; - IPC::Message* response = NULL; int navigate_response = -1; sender_->Send(new AutomationMsg_CancelAuth(0, handle_, &navigate_response)); return navigate_response >= 0; @@ -124,7 +123,6 @@ bool TabProxy::NeedsAuth() const { if (!is_valid()) return false; - IPC::Message* response = NULL; bool needs_auth = false; sender_->Send(new AutomationMsg_NeedsAuth(0, handle_, &needs_auth)); return needs_auth; @@ -193,6 +191,8 @@ bool TabProxy::NavigateToURLAsync(const GURL& url) { return status; } +#if defined(OS_WIN) +// TODO(port): Get rid of HWND. bool TabProxy::GetHWND(HWND* hwnd) const { if (!is_valid()) return false; @@ -203,6 +203,7 @@ bool TabProxy::GetHWND(HWND* hwnd) const { return sender_->Send(new AutomationMsg_TabHWND(0, handle_, hwnd)); } +#endif // defined(OS_WIN) bool TabProxy::GetProcessID(int* process_id) const { if (!is_valid()) @@ -342,7 +343,7 @@ bool TabProxy::WaitForChildWindowCountToChange(int count, int* new_count, int wait_timeout) { int intervals = std::min(wait_timeout/automation::kSleepTime, 1); for (int i = 0; i < intervals; ++i) { - Sleep(automation::kSleepTime); + PlatformThread::Sleep(automation::kSleepTime); bool succeeded = GetConstrainedWindowCount(new_count); if (!succeeded) return false; if (count != *new_count) return true; @@ -437,6 +438,8 @@ bool TabProxy::Close(bool wait_until_closed) { return succeeded; } +#if defined(OS_WIN) +// TODO(port): Remove windowsisms. bool TabProxy::SetAccelerators(HACCEL accel_table, int accel_table_entry_count) { if (!is_valid()) @@ -455,6 +458,7 @@ bool TabProxy::ProcessUnhandledAccelerator(const MSG& msg) { new AutomationMsg_ProcessUnhandledAccelerator(0, handle_, msg)); // This message expects no response } +#endif // defined(OS_WIN) bool TabProxy::SetInitialFocus(bool reverse) { if (!is_valid()) 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/' diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index fdcad82..1861626 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -26,13 +26,13 @@ #include "chrome/common/json_value_serializer.h" #include "chrome/test/automation/automation_proxy.h" #include "chrome/test/automation/browser_proxy.h" +#include "chrome/test/automation/tab_proxy.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #if defined(OS_WIN) // TODO(port): these just need to be ported. #include "chrome/common/chrome_process_filter.h" -#include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #endif @@ -452,10 +452,6 @@ void UITest::CleanupAppProcesses() { #endif } -// TODO(port): this #if effectively cuts out half of this file on -// non-Windows platforms, and is a temporary hack to get things -// building. -#if defined(OS_WIN) TabProxy* UITest::GetActiveTab() { scoped_ptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0)); if (!window_proxy.get()) @@ -490,6 +486,10 @@ void UITest::NavigateToURL(const GURL& url) { ASSERT_FALSE(is_timeout) << url.spec(); } +// TODO(port): this #if effectively cuts out half of this file on +// non-Windows platforms, and is a temporary hack to get things +// building. +#if defined(OS_WIN) bool UITest::WaitForDownloadShelfVisible(TabProxy* tab) { const int kCycles = 20; for (int i = 0; i < kCycles; i++) { @@ -569,7 +569,7 @@ bool UITest::CrashAwareSleep(int time_out_ms) { } #if defined(OS_WIN) -// TODO(port): Port these. +// TODO(port): Port BrowserProcessFilter and sort out one wstring/string issue. /*static*/ int UITest::GetBrowserProcessCount() { @@ -603,6 +603,7 @@ DictionaryValue* UITest::GetDefaultProfilePreferences() { file_util::AppendToPath(&path, chrome::kPreferencesFilename); return LoadDictionaryValueFromPath(path); } +#endif // OS_WIN int UITest::GetTabCount() { scoped_ptr<BrowserProxy> first_window(automation()->GetBrowserWindow(0)); @@ -671,7 +672,7 @@ std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab, void UITest::WaitUntilTabCount(int tab_count) { for (int i = 0; i < 10; ++i) { - Sleep(sleep_timeout_ms() / 10); + PlatformThread::Sleep(sleep_timeout_ms() / 10); if (GetTabCount() == tab_count) break; } @@ -709,8 +710,8 @@ bool UITest::CloseBrowser(BrowserProxy* browser, if (*application_closed) { // Let's wait until the process dies (if it is not gone already). - int r = WaitForSingleObject(process_, INFINITE); - DCHECK(r != WAIT_FAILED); + bool success = base::WaitForSingleProcess(process_, base::kNoTimeout); + DCHECK(success); } return result; @@ -752,8 +753,6 @@ void UITest::WaitForFinish(const std::string &name, EXPECT_EQ(true, test_result); } -#endif // OS_WIN - void UITest::PrintResult(const std::wstring& measurement, const std::wstring& modifier, const std::wstring& trace, |