Commit 2ee2da82 authored by chase@chromium.org's avatar chase@chromium.org

Changed page_cycler to use sessionStorage instead of cookies for timing values.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56932 0039d316-1c4b-4281-b951-d872f2087c98
parent d4e3ac8d
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -162,6 +162,7 @@ class PageCyclerTest : public UITest { ...@@ -162,6 +162,7 @@ class PageCyclerTest : public UITest {
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_ = TEST_ITERATIONS; num_test_iterations_ = TEST_ITERATIONS;
...@@ -245,6 +246,12 @@ class PageCyclerTest : public UITest { ...@@ -245,6 +246,12 @@ class PageCyclerTest : public UITest {
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());
} }
......
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
...@@ -50,10 +50,20 @@ function __pages() { // fetch lazily ...@@ -50,10 +50,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;
...@@ -74,15 +84,16 @@ function __ontimeout() { ...@@ -74,15 +84,16 @@ function __ontimeout() {
} else { } else {
doc = "../" + __pages()[__page] + "/index.html" doc = "../" + __pages()[__page] + "/index.html"
} }
var timings = __tl; var timings = __tl;
var oldTimings = __get_timings(); var oldTimings = __get_timings();
if (oldTimings != "") { if (oldTimings != "") {
timings = oldTimings + "," + timings; timings = oldTimings + "," + timings;
} }
__set_timings(timings); __set_timings(timings);
var url = doc + "?n=" + __iterations + "&i=" + __cycle + "&p=" + __page + "&ts=" + ts + "&td=" + __td + "&tf=" + __tf; var url = doc + "?n=" + __iterations + "&i=" + __cycle + "&p=" + __page +
"&ts=" + ts + "&td=" + __td + "&tf=" + __tf;
document.location.href = url; document.location.href = url;
} }
function __onload() { function __onload() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment