summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-07 15:55:32 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-07 15:55:32 +0000
commit44986391568796028c6ecf84f4112facdaee7e22 (patch)
tree0fd78663eab1976e166343a6d1b67bb3eaff2ddc
parenta2c6a828bafded3d0070de96fccf1d36d4416076 (diff)
downloadchromium_src-44986391568796028c6ecf84f4112facdaee7e22.zip
chromium_src-44986391568796028c6ecf84f4112facdaee7e22.tar.gz
chromium_src-44986391568796028c6ecf84f4112facdaee7e22.tar.bz2
Revert change 11199 because it breaks the page cyclers
on windows. My theory is that the GURL in RunPageCycler is not correct. (Missing a "/" maybe.) Review URL: http://codereview.chromium.org/40268 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11200 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/automation/automation.scons1
-rw-r--r--chrome/test/automation/tab_proxy.cc10
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc83
-rw-r--r--chrome/test/page_cycler/page_cycler_tests.scons12
-rw-r--r--chrome/test/ui/ui_test.cc21
5 files changed, 55 insertions, 72 deletions
diff --git a/chrome/test/automation/automation.scons b/chrome/test/automation/automation.scons
index f4856c8..b43146a 100644
--- a/chrome/test/automation/automation.scons
+++ b/chrome/test/automation/automation.scons
@@ -43,6 +43,7 @@ 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 bca9c03..c5f40e1 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -114,6 +114,7 @@ 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;
@@ -123,6 +124,7 @@ 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;
@@ -191,8 +193,6 @@ 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,7 +203,6 @@ 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())
@@ -343,7 +342,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) {
- PlatformThread::Sleep(automation::kSleepTime);
+ Sleep(automation::kSleepTime);
bool succeeded = GetConstrainedWindowCount(new_count);
if (!succeeded) return false;
if (count != *new_count) return true;
@@ -438,8 +437,6 @@ 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())
@@ -458,7 +455,6 @@ 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 5899071..8f5fead 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -11,10 +11,7 @@
#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"
@@ -31,7 +28,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/.
-static const char kBaseUrl[] = "http://localhost:8000/";
+#define BASE_URL L"http://localhost:8000"
namespace {
@@ -46,20 +43,23 @@ 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,
+ void RunPageCycler(const wchar_t* name, std::wstring* pages,
std::wstring* timings, bool use_http) {
GURL test_url;
if (use_http) {
- test_url = GURL(std::string(kBaseUrl) + name + "start.html");
+ 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);
} else {
- FilePath test_path;
+ std::wstring test_path;
PathService::Get(base::DIR_EXE, &test_path);
- 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"));
+ 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_url = net::FilePathToFileURL(test_path);
}
@@ -80,15 +80,13 @@ class PageCyclerTest : public UITest {
std::string cookie;
ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_pages", &cookie));
- pages->assign(UTF8ToWide(cookie));
+ pages->swap(UTF8ToWide(cookie));
ASSERT_FALSE(pages->empty());
ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_timings", &cookie));
- timings->assign(UTF8ToWide(cookie));
+ timings->swap(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
@@ -198,23 +196,19 @@ 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 char* name, bool use_http) {
+ void RunTest(const wchar_t* 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",
@@ -235,17 +229,14 @@ class PageCyclerReferenceTest : public PageCyclerTest {
UITest::SetUp();
}
- void RunTest(const char* name, bool use_http) {
+ void RunTest(const wchar_t* 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 */);
@@ -256,83 +247,83 @@ class PageCyclerReferenceTest : public PageCyclerTest {
// file-URL tests
TEST_F(PageCyclerTest, MozFile) {
- RunTest("moz", false);
+ RunTest(L"moz", false);
}
TEST_F(PageCyclerReferenceTest, MozFile) {
- RunTest("moz", false);
+ RunTest(L"moz", false);
}
TEST_F(PageCyclerTest, Intl1File) {
- RunTest("intl1", false);
+ RunTest(L"intl1", false);
}
TEST_F(PageCyclerReferenceTest, Intl1File) {
- RunTest("intl1", false);
+ RunTest(L"intl1", false);
}
TEST_F(PageCyclerTest, Intl2File) {
- RunTest("intl2", false);
+ RunTest(L"intl2", false);
}
TEST_F(PageCyclerReferenceTest, Intl2File) {
- RunTest("intl2", false);
+ RunTest(L"intl2", false);
}
TEST_F(PageCyclerTest, DomFile) {
- RunTest("dom", false);
+ RunTest(L"dom", false);
}
TEST_F(PageCyclerReferenceTest, DomFile) {
- RunTest("dom", false);
+ RunTest(L"dom", false);
}
TEST_F(PageCyclerTest, DhtmlFile) {
- RunTest("dhtml", false);
+ RunTest(L"dhtml", false);
}
TEST_F(PageCyclerReferenceTest, DhtmlFile) {
- RunTest("dhtml", false);
+ RunTest(L"dhtml", false);
}
// http (localhost) tests
TEST_F(PageCyclerTest, MozHttp) {
- RunTest("moz", true);
+ RunTest(L"moz", true);
}
TEST_F(PageCyclerReferenceTest, MozHttp) {
- RunTest("moz", true);
+ RunTest(L"moz", true);
}
TEST_F(PageCyclerTest, Intl1Http) {
- RunTest("intl1", true);
+ RunTest(L"intl1", true);
}
TEST_F(PageCyclerReferenceTest, Intl1Http) {
- RunTest("intl1", true);
+ RunTest(L"intl1", true);
}
TEST_F(PageCyclerTest, Intl2Http) {
- RunTest("intl2", true);
+ RunTest(L"intl2", true);
}
TEST_F(PageCyclerReferenceTest, Intl2Http) {
- RunTest("intl2", true);
+ RunTest(L"intl2", true);
}
TEST_F(PageCyclerTest, DomHttp) {
- RunTest("dom", true);
+ RunTest(L"dom", true);
}
TEST_F(PageCyclerReferenceTest, DomHttp) {
- RunTest("dom", true);
+ RunTest(L"dom", true);
}
TEST_F(PageCyclerTest, BloatHttp) {
- RunTest("bloat", true);
+ RunTest(L"bloat", true);
}
TEST_F(PageCyclerReferenceTest, BloatHttp) {
- RunTest("bloat", true);
+ RunTest(L"bloat", true);
}
diff --git a/chrome/test/page_cycler/page_cycler_tests.scons b/chrome/test/page_cycler/page_cycler_tests.scons
index 984baf1..b265b25 100644
--- a/chrome/test/page_cycler/page_cycler_tests.scons
+++ b/chrome/test/page_cycler/page_cycler_tests.scons
@@ -10,7 +10,6 @@ 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',
@@ -32,8 +31,6 @@ env.Prepend(
'browser',
'browser_views',
'common',
- 'glue',
- 'WTF',
],
)
@@ -92,12 +89,9 @@ if not env.Bit('windows'):
'$CHROME_DIR/tools/build/win/precompiled_wtl.h',
)
- # 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)
+# TODO(port):
+if env.Bit('windows'):
+ 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 1861626..fdcad82 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,6 +452,10 @@ 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())
@@ -486,10 +490,6 @@ 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 BrowserProcessFilter and sort out one wstring/string issue.
+// TODO(port): Port these.
/*static*/
int UITest::GetBrowserProcessCount() {
@@ -603,7 +603,6 @@ 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));
@@ -672,7 +671,7 @@ std::string UITest::WaitUntilCookieNonEmpty(TabProxy* tab,
void UITest::WaitUntilTabCount(int tab_count) {
for (int i = 0; i < 10; ++i) {
- PlatformThread::Sleep(sleep_timeout_ms() / 10);
+ Sleep(sleep_timeout_ms() / 10);
if (GetTabCount() == tab_count)
break;
}
@@ -710,8 +709,8 @@ bool UITest::CloseBrowser(BrowserProxy* browser,
if (*application_closed) {
// Let's wait until the process dies (if it is not gone already).
- bool success = base::WaitForSingleProcess(process_, base::kNoTimeout);
- DCHECK(success);
+ int r = WaitForSingleObject(process_, INFINITE);
+ DCHECK(r != WAIT_FAILED);
}
return result;
@@ -753,6 +752,8 @@ 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,