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
// found in the LICENSE file.
......@@ -162,6 +162,7 @@ class PageCyclerTest : public UITest {
PageCyclerTest()
: print_times_only_(false) {
show_window_ = true;
dom_automation_enabled_ = true;
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
num_test_iterations_ = TEST_ITERATIONS;
......@@ -245,6 +246,12 @@ class PageCyclerTest : public UITest {
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());
}
......
// 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
// modification, are permitted provided that the following conditions are
......@@ -50,10 +50,20 @@ function __pages() { // fetch lazily
return this.data;
}
function __get_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) {
if (sessionStorage == null)
document.cookie = "__pc_timings=" + timings + "; path=/";
else
sessionStorage["__pc_timings"]=timings;
}
function __ontimeout() {
var doc;
......@@ -82,7 +92,8 @@ function __ontimeout() {
}
__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;
}
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