summaryrefslogtreecommitdiffstats
path: root/chrome/test/page_cycler
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 14:36:33 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 14:36:33 +0000
commitf6d3e11d42746c43869f9c3066ca60d585489cd0 (patch)
tree9fc0c4984d4cdd418680c6203b9262d4f9a7c60c /chrome/test/page_cycler
parent34c70c9f8f89e5293cc9c6de9742adfbba5810bf (diff)
downloadchromium_src-f6d3e11d42746c43869f9c3066ca60d585489cd0.zip
chromium_src-f6d3e11d42746c43869f9c3066ca60d585489cd0.tar.gz
chromium_src-f6d3e11d42746c43869f9c3066ca60d585489cd0.tar.bz2
Make startup_tests print results on Linux.
Switch from wstring to string where needed. Review URL: http://codereview.chromium.org/42303 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/page_cycler')
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc108
1 files changed, 55 insertions, 53 deletions
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index c56bdc6..45a769c 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -47,7 +47,7 @@ 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::wstring* timings, bool use_http) {
+ std::string* timings, bool use_http) {
GURL test_url;
if (use_http) {
test_url = GURL(std::string(kBaseUrl) + name + "/start.html");
@@ -83,13 +83,13 @@ class PageCyclerTest : public UITest {
pages->assign(UTF8ToWide(cookie));
ASSERT_FALSE(pages->empty());
ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_timings", &cookie));
- timings->assign(UTF8ToWide(cookie));
+ timings->assign(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) {
+ void PrintIOPerfInfo(const char* test_name) {
BrowserProcessFilter chrome_filter(L"");
base::NamedProcessIterator
chrome_process_itr(chrome::kBrowserProcessExecutableName,
@@ -111,55 +111,55 @@ class PageCyclerTest : public UITest {
if (process_metrics.get()->GetIOCounters(&io_counters)) {
// Print out IO performance. We assume that the values can be
// converted to size_t (they're reported as ULONGLONG, 64-bit numbers).
- std::wstring chrome_name =
- (pid == chrome_filter.browser_process_id()) ? L"_b" : L"_r";
+ std::string chrome_name =
+ (pid == chrome_filter.browser_process_id()) ? "_b" : "_r";
- PrintResult(L"read_op", chrome_name,
- L"r_op" + chrome_name + test_name,
- static_cast<size_t>(io_counters.ReadOperationCount), L"",
+ PrintResult("read_op", chrome_name,
+ "r_op" + chrome_name + test_name,
+ static_cast<size_t>(io_counters.ReadOperationCount), "",
false /* not important */);
- PrintResult(L"write_op", chrome_name,
- L"w_op" + chrome_name + test_name,
- static_cast<size_t>(io_counters.WriteOperationCount), L"",
+ PrintResult("write_op", chrome_name,
+ "w_op" + chrome_name + test_name,
+ static_cast<size_t>(io_counters.WriteOperationCount), "",
false /* not important */);
- PrintResult(L"other_op", chrome_name,
- L"o_op" + chrome_name + test_name,
- static_cast<size_t>(io_counters.OtherOperationCount), L"",
+ PrintResult("other_op", chrome_name,
+ "o_op" + chrome_name + test_name,
+ static_cast<size_t>(io_counters.OtherOperationCount), "",
false /* not important */);
size_t total = static_cast<size_t>(io_counters.ReadOperationCount +
io_counters.WriteOperationCount +
io_counters.OtherOperationCount);
- PrintResult(L"total_op", chrome_name,
- L"IO_op" + chrome_name + test_name,
- total, L"", true /* important */);
+ PrintResult("total_op", chrome_name,
+ "IO_op" + chrome_name + test_name,
+ total, "", true /* important */);
- PrintResult(L"read_byte", chrome_name,
- L"r_b" + chrome_name + test_name,
+ PrintResult("read_byte", chrome_name,
+ "r_b" + chrome_name + test_name,
static_cast<size_t>(io_counters.ReadTransferCount / 1024),
- L"kb", false /* not important */);
- PrintResult(L"write_byte", chrome_name,
- L"w_b" + chrome_name + test_name,
+ "kb", false /* not important */);
+ PrintResult("write_byte", chrome_name,
+ "w_b" + chrome_name + test_name,
static_cast<size_t>(io_counters.WriteTransferCount / 1024),
- L"kb", false /* not important */);
- PrintResult(L"other_byte", chrome_name,
- L"o_b" + chrome_name + test_name,
+ "kb", false /* not important */);
+ PrintResult("other_byte", chrome_name,
+ "o_b" + chrome_name + test_name,
static_cast<size_t>(io_counters.OtherTransferCount / 1024),
- L"kb", false /* not important */);
+ "kb", false /* not important */);
total = static_cast<size_t>((io_counters.ReadTransferCount +
io_counters.WriteTransferCount +
io_counters.OtherTransferCount) / 1024);
- PrintResult(L"total_byte", chrome_name,
- L"IO_b" + chrome_name + test_name,
- total, L"kb", true /* important */);
+ PrintResult("total_byte", chrome_name,
+ "IO_b" + chrome_name + test_name,
+ total, "kb", true /* important */);
}
}
}
- void PrintMemoryUsageInfo(const wchar_t* test_name) {
+ void PrintMemoryUsageInfo(const char* test_name) {
BrowserProcessFilter chrome_filter(L"");
base::NamedProcessIterator
chrome_process_itr(chrome::kBrowserProcessExecutableName,
@@ -175,25 +175,25 @@ class PageCyclerTest : public UITest {
if (GetMemoryInfo(pid, &peak_virtual_size, &current_virtual_size,
&peak_working_set_size, &current_working_set_size)) {
- std::wstring chrome_name =
- (pid == chrome_filter.browser_process_id()) ? L"_b" : L"_r";
+ std::string chrome_name =
+ (pid == chrome_filter.browser_process_id()) ? "_b" : "_r";
- std::wstring trace_name(test_name);
- PrintResult(L"vm_peak", chrome_name,
- L"vm_pk" + chrome_name + trace_name,
- peak_virtual_size, L"bytes",
+ std::string trace_name(test_name);
+ PrintResult("vm_peak", chrome_name,
+ "vm_pk" + chrome_name + trace_name,
+ peak_virtual_size, "bytes",
true /* important */);
- PrintResult(L"vm_final", chrome_name,
- L"vm_f" + chrome_name + trace_name,
- current_virtual_size, L"bytes",
+ PrintResult("vm_final", chrome_name,
+ "vm_f" + chrome_name + trace_name,
+ current_virtual_size, "bytes",
false /* not important */);
- PrintResult(L"ws_peak", chrome_name,
- L"ws_pk" + chrome_name + trace_name,
- peak_working_set_size, L"bytes",
+ PrintResult("ws_peak", chrome_name,
+ "ws_pk" + chrome_name + trace_name,
+ peak_working_set_size, "bytes",
true /* important */);
- PrintResult(L"ws_final", chrome_name,
- L"ws_pk" + chrome_name + trace_name,
- current_working_set_size, L"bytes",
+ PrintResult("ws_final", chrome_name,
+ "ws_pk" + chrome_name + trace_name,
+ current_working_set_size, "bytes",
false /* not important */);
}
}
@@ -205,19 +205,20 @@ class PageCyclerTest : public UITest {
// escaping. (No pound (#), question mark (?), semicolon (;), non-ASCII, or
// other funny stuff.)
void RunTest(const char* name, bool use_http) {
- std::wstring pages, timings;
+ std::wstring pages;
+ std::string 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"");
+ PrintMemoryUsageInfo("");
+ PrintIOPerfInfo("");
#endif // defined(OS_WIN)
wprintf(L"\nPages: [%ls]\n", pages.c_str());
- PrintResultList(L"times", L"", L"t", timings, L"ms",
+ PrintResultList("times", "", "t", timings, "ms",
true /* important */);
}
};
@@ -236,18 +237,19 @@ class PageCyclerReferenceTest : public PageCyclerTest {
}
void RunTest(const char* name, bool use_http) {
- std::wstring pages, timings;
+ std::wstring pages;
+ std::string 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");
+ PrintMemoryUsageInfo("_ref");
+ PrintIOPerfInfo("_ref");
#endif // defined(OS_WIN)
- PrintResultList(L"times", L"", L"t_ref", timings, L"ms",
+ PrintResultList("times", "", "t_ref", timings, "ms",
true /* important */);
}
};