summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 00:16:15 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 00:16:15 +0000
commit1cc48f14278f4bb882d633ab4776b09478e7f668 (patch)
tree94ddd4801b3a78bbdc2b12069a19ab7936583e99 /chrome/browser/tab_contents
parent551d976c7518976334d2bb2dfe978c7b28678172 (diff)
downloadchromium_src-1cc48f14278f4bb882d633ab4776b09478e7f668.zip
chromium_src-1cc48f14278f4bb882d633ab4776b09478e7f668.tar.gz
chromium_src-1cc48f14278f4bb882d633ab4776b09478e7f668.tar.bz2
Add startup tests that log start script, domcontentloaded, and onload.
TabContents sends a notification which is picked up by the browser automation controller which keeps a map of events and times. Add an automation IPC so that tests can get these values from the browser automation controller. Finally, add a feature startup test to collect these values. This is just to get some consistent timings from the buildbot. BUG=23120 Review URL: http://codereview.chromium.org/246105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 7735a14..325e6bc 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/jsmessage_box_handler.h"
#include "chrome/browser/load_from_memory_cache_details.h"
#include "chrome/browser/load_notification_details.h"
+#include "chrome/browser/metrics/metric_event_duration_details.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/omnibox_search_hint.h"
#include "chrome/browser/password_manager/password_manager.h"
@@ -1177,6 +1178,9 @@ void TabContents::LogNewTabTime(const std::string& event_name) {
return;
base::TimeDelta duration = base::TimeTicks::Now() - new_tab_start_time_;
+ MetricEventDurationDetails details(event_name,
+ static_cast<int>(duration.InMilliseconds()));
+
if (event_name == "NewTab.ScriptStart") {
UMA_HISTOGRAM_TIMES("NewTab.ScriptStart", duration);
} else if (event_name == "NewTab.DOMContentLoaded") {
@@ -1185,7 +1189,13 @@ void TabContents::LogNewTabTime(const std::string& event_name) {
UMA_HISTOGRAM_TIMES("NewTab.Onload", duration);
// The new tab page has finished loading; reset it.
new_tab_start_time_ = base::TimeTicks();
+ } else {
+ NOTREACHED();
}
+ NotificationService::current()->Notify(
+ NotificationType::METRIC_EVENT_DURATION,
+ Source<TabContents>(this),
+ Details<MetricEventDurationDetails>(&details));
}
// Notifies the RenderWidgetHost instance about the fact that the page is