Skip to content
Snippets Groups Projects
Commit 118fcdde authored by chase@chromium.org's avatar chase@chromium.org
Browse files

Update page_cycler to use sessionStorage.

Patch from Ahmad Sharif <asharif@chromium.org>.

This was landed previously as r56932 and reverted in
r57445.  Previous landing showed some flakiness/failures
in the DOM automation framework.  Relanding to verify
if this is fixed or still broken.

BUG=53491
TEST=page cyclers stay green

Review URL: http://codereview.chromium.org/5955002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69492 0039d316-1c4b-4281-b951-d872f2087c98
parent 680d201e
No related branches found
No related tags found
No related merge requests found
...@@ -163,6 +163,7 @@ class PageCyclerTest : public UIPerfTest { ...@@ -163,6 +163,7 @@ class PageCyclerTest : public UIPerfTest {
PageCyclerTest() PageCyclerTest()
: print_times_only_(false) { : print_times_only_(false) {
show_window_ = true; show_window_ = true;
dom_automation_enabled_ = true;
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
num_test_iterations_ = kTestIterations; num_test_iterations_ = kTestIterations;
...@@ -246,6 +247,14 @@ class PageCyclerTest : public UIPerfTest { ...@@ -246,6 +247,14 @@ class PageCyclerTest : public UIPerfTest {
pages->assign(UTF8ToWide(cookie)); pages->assign(UTF8ToWide(cookie));
ASSERT_FALSE(pages->empty()); ASSERT_FALSE(pages->empty());
ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_timings", &cookie)); ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_timings", &cookie));
std::wstring wcookie;
ASSERT_TRUE(tab->ExecuteAndExtractString(L"",
L"window.domAutomationController.send("
L"JSON.stringify(__get_timings()));",
&wcookie));
cookie = base::SysWideToNativeMB(wcookie);
timings->assign(cookie); timings->assign(cookie);
ASSERT_FALSE(timings->empty()); ASSERT_FALSE(timings->empty());
} }
......
...@@ -26,10 +26,20 @@ function __pages() { // fetch lazily ...@@ -26,10 +26,20 @@ function __pages() { // fetch lazily
return this.data; return this.data;
} }
function __get_timings() { function __get_timings() {
return __get_cookie("__pc_timings"); if (sessionStorage == null)
return __get_cookie("__pc_timings");
else {
if (sessionStorage.getItem("__pc_timings") == null)
return "";
else
return sessionStorage["__pc_timings"];
}
} }
function __set_timings(timings) { function __set_timings(timings) {
document.cookie = "__pc_timings=" + timings + "; path=/"; if (sessionStorage == null)
document.cookie = "__pc_timings=" + timings + "; path=/";
else
sessionStorage["__pc_timings"]=timings;
} }
function __ontimeout() { function __ontimeout() {
var doc; var doc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment