Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: chrome/test/perf/startup_test.cc

Issue 12859006: Add tests to capture traces of StartupTest.ProfilingScript1 with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Conditionalize switch Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/perf/startup_test.cc
diff --git a/chrome/test/perf/startup_test.cc b/chrome/test/perf/startup_test.cc
index d68b05ccacb093a59ccfd58b88586d01f4e41b3f..75f3154d8dccaf77d7b1165010bfe0b86fca7567 100644
--- a/chrome/test/perf/startup_test.cc
+++ b/chrome/test/perf/startup_test.cc
@@ -24,6 +24,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/perf/perf_test.h"
#include "chrome/test/ui/ui_perf_test.h"
+#include "content/public/common/content_switches.h"
#include "net/base/net_util.h"
using base::TimeDelta;
@@ -33,7 +34,7 @@ namespace {
class StartupTest : public UIPerfTest {
public:
- StartupTest() {
+ StartupTest() : tracing_enabled_(false) {
show_window_ = true;
}
virtual void SetUp() {
@@ -71,6 +72,32 @@ class StartupTest : public UIPerfTest {
collect_profiling_stats_ = true;
}
+ // Set the command line arguments to enable tracing.
+ void SetUpWithTracing(std::string trace_file_prefix) {
+ tracing_enabled_ = true;
+ trace_file_prefix_ = trace_file_prefix;
+ launch_arguments_.AppendSwitch(switches::kTraceStartup);
+ launch_arguments_.AppendSwitchASCII(switches::kTraceStartupDuration,
+ "1");
+ }
+
+ // Pause after running a test with tracing, to wait for the trace to
+ // be written.
+ void PauseForTracing() {
+ if (tracing_enabled_) {
+#if defined(OS_MACOSX)
+ sleep(1);
Zhenyao Mo 2013/03/15 02:51:47 are you sure you want 1 ms? (sleep is ms instead
ccameron 2013/03/15 07:56:21 This one behaves as seconds (I tested it) http://l
+#else
+ NOTREACHED();
+#endif
+ }
+ }
+
+ // Set the command line arguments to use force-compositing-mode.
+ void SetUpWithForceCompositingMode() {
+ launch_arguments_.AppendSwitch(switches::kForceCompositingMode);
+ }
+
// Load a complex html file on startup represented by |which_tab|.
void SetUpWithComplexFileURL(unsigned int which_tab) {
const char* const kTestPageCyclerDomains[] = {
@@ -191,7 +218,15 @@ class StartupTest : public UIPerfTest {
};
TimingInfo timings[kNumCyclesMax];
+ CommandLine launch_arguments_without_trace_file(launch_arguments_);
for (int i = 0; i < numCycles; ++i) {
+ if (tracing_enabled_) {
+ std::stringstream tracing_enabled_file;
+ tracing_enabled_file << trace_file_prefix_ << i;
+ launch_arguments_ = launch_arguments_without_trace_file;
+ launch_arguments_.AppendSwitchASCII(switches::kTraceStartupFile,
+ tracing_enabled_file.str());
+ }
if (test_cold == COLD) {
base::FilePath dir_app;
ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app));
@@ -235,6 +270,7 @@ class StartupTest : public UIPerfTest {
}
}
timings[i].end_to_end = end_time - browser_launch_time();
+ PauseForTracing();
UITest::TearDown();
if (i == 0) {
@@ -297,6 +333,8 @@ class StartupTest : public UIPerfTest {
base::FilePath profiling_file_;
bool collect_profiling_stats_;
+ bool tracing_enabled_;
+ std::string trace_file_prefix_;
};
TEST_F(StartupTest, PerfWarm) {
@@ -469,4 +507,23 @@ TEST_F(StartupTest, ProfilingScript1) {
UITestBase::DEFAULT_THEME, 1, 0);
}
+#if defined(OS_MACOSX)
+TEST_F(StartupTest, TracedProfilingScript1) {
+ SetUpWithFileURL();
+ SetUpWithProfiling();
+ SetUpWithTracing("startup_trace_sw_");
+ RunStartupTest("warm", "traced_profiling_scripts1", WARM, NOT_IMPORTANT,
+ UITestBase::DEFAULT_THEME, 1, 0);
+}
+
+TEST_F(StartupTest, TracedProfilingScript1FCM) {
+ SetUpWithFileURL();
+ SetUpWithProfiling();
+ SetUpWithForceCompositingMode();
+ SetUpWithTracing("startup_trace_fcm_");
+ RunStartupTest("warm", "traced_profiling_scripts1_fcm", WARM, NOT_IMPORTANT,
+ UITestBase::DEFAULT_THEME, 1, 0);
+}
+#endif
+
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698