summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchase@chromium.org <chase@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-17 01:03:33 +0000
committerchase@chromium.org <chase@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-17 01:03:33 +0000
commit118fcddea5943ebc56fd3d6da4285651239408de (patch)
tree7fcad20b073da1f54c0b780969c8554369295a72
parent680d201ec4f79642cca4073145fdb86e809eb03c (diff)
downloadchromium_src-118fcddea5943ebc56fd3d6da4285651239408de.zip
chromium_src-118fcddea5943ebc56fd3d6da4285651239408de.tar.gz
chromium_src-118fcddea5943ebc56fd3d6da4285651239408de.tar.bz2
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
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc9
-rw-r--r--tools/page_cycler/common/head.js14
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;