diff options
author | chase@chromium.org <chase@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-29 21:39:31 +0000 |
---|---|---|
committer | chase@chromium.org <chase@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-29 21:39:31 +0000 |
commit | eb86ce771f109d0cd3b20d68027f4f3628da03e6 (patch) | |
tree | e93b78d3275f08dfb2edbd47dc7b30c3ccf68517 /chrome/test/page_cycler/page_cycler_test.cc | |
parent | 1c4ff85935600c96ac8cadeaa21c2122ba07e9a3 (diff) | |
download | chromium_src-eb86ce771f109d0cd3b20d68027f4f3628da03e6.zip chromium_src-eb86ce771f109d0cd3b20d68027f4f3628da03e6.tar.gz chromium_src-eb86ce771f109d0cd3b20d68027f4f3628da03e6.tar.bz2 |
Strip quotes from stringified cookie values.
BUG=68218
TEST=page cycler timings results are printed without quotes
TBR=phajdan.jr@chromium.org
Review URL: http://codereview.chromium.org/6092004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70279 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/page_cycler/page_cycler_test.cc')
-rw-r--r-- | chrome/test/page_cycler/page_cycler_test.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index 63d507f..7f46c7d 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -246,8 +246,8 @@ class PageCyclerTest : public UIPerfTest { ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_pages", &cookie)); pages->assign(UTF8ToWide(cookie)); ASSERT_FALSE(pages->empty()); - ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_timings", &cookie)); + // Get the timing cookie value from the DOM automation. std::wstring wcookie; ASSERT_TRUE(tab->ExecuteAndExtractString(L"", L"window.domAutomationController.send(" @@ -255,6 +255,15 @@ class PageCyclerTest : public UIPerfTest { &wcookie)); cookie = base::SysWideToNativeMB(wcookie); + // JSON.stringify() encapsulates the returned string in quotes, strip them. + std::string::size_type start_idx = cookie.find("\""); + std::string::size_type end_idx = cookie.find_last_of("\""); + if (start_idx != std::string::npos && + end_idx != std::string::npos && + start_idx < end_idx) { + cookie = cookie.substr(start_idx+1, end_idx-start_idx-1); + } + timings->assign(cookie); ASSERT_FALSE(timings->empty()); } |