From 118fcddea5943ebc56fd3d6da4285651239408de Mon Sep 17 00:00:00 2001 From: "chase@chromium.org" Date: Fri, 17 Dec 2010 01:03:33 +0000 Subject: Update page_cycler to use sessionStorage. Patch from Ahmad Sharif . 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 --- chrome/test/page_cycler/page_cycler_test.cc | 9 +++++++++ tools/page_cycler/common/head.js | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index d6952b4..43b30a9 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -163,6 +163,7 @@ class PageCyclerTest : public UIPerfTest { PageCyclerTest() : print_times_only_(false) { show_window_ = true; + dom_automation_enabled_ = true; const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); num_test_iterations_ = kTestIterations; @@ -246,6 +247,14 @@ class PageCyclerTest : public UIPerfTest { pages->assign(UTF8ToWide(cookie)); ASSERT_FALSE(pages->empty()); 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); ASSERT_FALSE(timings->empty()); } diff --git a/tools/page_cycler/common/head.js b/tools/page_cycler/common/head.js index 3cbe38f..a7fa9b5 100644 --- a/tools/page_cycler/common/head.js +++ b/tools/page_cycler/common/head.js @@ -26,10 +26,20 @@ function __pages() { // fetch lazily return this.data; } 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) { - document.cookie = "__pc_timings=" + timings + "; path=/"; + if (sessionStorage == null) + document.cookie = "__pc_timings=" + timings + "; path=/"; + else + sessionStorage["__pc_timings"]=timings; } function __ontimeout() { var doc; -- cgit v1.1