Index: chrome/test/page_cycler/page_cycler_test.cc |
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc |
index 63d507f433f3b3a69c20b25a68942590875e083b..7f46c7d7742913d0f417707a2641f4e1e722a0d7 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); |
nsylvain
2010/12/29 21:22:14
end_idx-1 maybe?
nsylvain
2010/12/29 21:37:43
did not read correctly. LGTM
|
+ } |
+ |
timings->assign(cookie); |
ASSERT_FALSE(timings->empty()); |
} |