summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-10 17:57:25 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-10 17:57:25 +0000
commitd2ee25b6cb2cd1dd4267eb2a8972ef4a951caa29 (patch)
treeb5288c14e50d57cd000c73974339d28a42958c5b /chrome/test
parent619502c167f4f5ca4d5205f7a0de87a7ee2d1caf (diff)
downloadchromium_src-d2ee25b6cb2cd1dd4267eb2a8972ef4a951caa29.zip
chromium_src-d2ee25b6cb2cd1dd4267eb2a8972ef4a951caa29.tar.gz
chromium_src-d2ee25b6cb2cd1dd4267eb2a8972ef4a951caa29.tar.bz2
Test startup of new tab page with a complex theme.
BUG= http://crbug.com/18767 TEST= none Review URL: http://codereview.chromium.org/165168 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/startup/feature_startup_test.cc29
-rw-r--r--chrome/test/startup/startup_test.cc25
-rw-r--r--chrome/test/ui/ui_test.cc19
-rw-r--r--chrome/test/ui/ui_test.h10
4 files changed, 62 insertions, 21 deletions
diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc
index 7cd044e..63bf851 100644
--- a/chrome/test/startup/feature_startup_test.cc
+++ b/chrome/test/startup/feature_startup_test.cc
@@ -19,17 +19,6 @@ using base::TimeDelta;
namespace {
-// Returns the directory name where the "typical" user data is that we use for
-// testing.
-FilePath ComputeTypicalUserDataSource() {
- FilePath source_history_file;
- EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
- &source_history_file));
- source_history_file = source_history_file.AppendASCII("profiles")
- .AppendASCII("typical_history");
- return source_history_file;
-}
-
class NewTabUIStartupTest : public UITest {
public:
NewTabUIStartupTest() {
@@ -52,9 +41,11 @@ class NewTabUIStartupTest : public UITest {
// Run the test, by bringing up a browser and timing the new tab startup.
// |want_warm| is true if we should output warm-disk timings, false if
// we should report cold timings.
- void RunStartupTest(const char* label, bool want_warm, bool important) {
+ void RunStartupTest(const char* label, bool want_warm, bool important,
+ int profile_type) {
// Install the location of the test profile file.
- set_template_user_data(ComputeTypicalUserDataSource().ToWStringHack());
+ set_template_user_data(UITest::ComputeTypicalUserDataSource(
+ profile_type).ToWStringHack());
// Disable the first run notification because it has an animation which
// masks any real performance regressions.
@@ -106,11 +97,19 @@ class NewTabUIStartupTest : public UITest {
// TODO(pamg): run these tests with a reference build?
TEST_F(NewTabUIStartupTest, PerfCold) {
- RunStartupTest("tab_cold", false /* cold */, true /* important */);
+ RunStartupTest("tab_cold", false /* cold */, true /* important */,
+ UITest::DEFAULT_THEME);
}
TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) {
- RunStartupTest("tab_warm", true /* warm */, false /* not important */);
+ RunStartupTest("tab_warm", true /* warm */, false /* not important */,
+ UITest::DEFAULT_THEME);
+}
+
+TEST_F(NewTabUIStartupTest, ComplexTheme) {
+ RunStartupTest("tab_complex_theme_cold", false /* cold */,
+ false /* not important */,
+ UITest::COMPLEX_THEME);
}
} // namespace
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index 9244932..6c21f82 100644
--- a/chrome/test/startup/startup_test.cc
+++ b/chrome/test/startup/startup_test.cc
@@ -28,7 +28,7 @@ class StartupTest : public UITest {
void TearDown() {}
void RunStartupTest(const char* graph, const char* trace,
- bool test_cold, bool important) {
+ bool test_cold, bool important, int profile_type) {
const int kNumCyclesMax = 20;
int numCycles = kNumCyclesMax;
// It's ok for unit test code to use getenv(), isn't it?
@@ -65,6 +65,12 @@ class StartupTest : public UITest {
#endif
}
+ // Sets the profile data for the run. For now, this is only used for
+ // the complex theme test.
+ if (profile_type == UITest::COMPLEX_THEME)
+ set_template_user_data(UITest::ComputeTypicalUserDataSource(
+ profile_type).ToWStringHack());
+
UITest::SetUp();
TimeTicks end_time = TimeTicks::Now();
timings[i] = end_time - browser_launch_time_;
@@ -125,32 +131,39 @@ class StartupFileTest : public StartupTest {
};
TEST_F(StartupTest, Perf) {
- RunStartupTest("warm", "t", false /* not cold */, true /* important */);
+ RunStartupTest("warm", "t", false /* not cold */, true /* important */,
+ UITest::DEFAULT_THEME);
}
// TODO(port): We need a mac reference build checked in for this.
TEST_F(StartupReferenceTest, Perf) {
RunStartupTest("warm", "t_ref", false /* not cold */,
- true /* important */);
+ true /* important */, UITest::DEFAULT_THEME);
}
// TODO(mpcomplete): Should we have reference timings for all these?
TEST_F(StartupTest, PerfCold) {
- RunStartupTest("cold", "t", true /* cold */, false /* not important */);
+ RunStartupTest("cold", "t", true /* cold */, false /* not important */,
+ UITest::DEFAULT_THEME);
}
#if defined(OS_WIN)
// TODO(port): Enable gears tests on linux/mac once gears is working.
TEST_F(StartupFileTest, PerfGears) {
RunStartupTest("warm", "gears", false /* not cold */,
- false /* not important */);
+ false /* not important */, UITest::DEFAULT_THEME);
}
TEST_F(StartupFileTest, PerfColdGears) {
RunStartupTest("cold", "gears", true /* cold */,
- false /* not important */);
+ false /* not important */, UITest::DEFAULT_THEME);
}
#endif
+TEST_F(StartupTest, PerfColdComplexTheme) {
+ RunStartupTest("warm", "t-theme", false /* warm */,
+ false /* not important */, UITest::COMPLEX_THEME);
+}
+
} // namespace
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 25ec701..69de19a 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -963,3 +963,22 @@ bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) {
}
return false;
}
+
+// static
+FilePath UITest::ComputeTypicalUserDataSource(int profile_type) {
+ FilePath source_history_file;
+ EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
+ &source_history_file));
+ if (profile_type == UITest::DEFAULT_THEME) {
+ source_history_file = source_history_file.AppendASCII("profiles")
+ .AppendASCII("typical_history");
+ } else if (profile_type == UITest::COMPLEX_THEME) {
+ source_history_file = source_history_file.AppendASCII("profiles")
+ .AppendASCII("complex_theme");
+ } else {
+ NOTREACHED();
+ }
+ return source_history_file;
+}
+
+
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 1d4374d..a512fb7 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -338,6 +338,10 @@ class UITest : public testing::Test {
log_level_ = value;
}
+ // Returns the directory name where the "typical" user data is that we use
+ // for testing.
+ static FilePath ComputeTypicalUserDataSource(int profile_type);
+
// Called by some tests that wish to have a base profile to start from. This
// "user data directory" (containing one or more profiles) will be recursively
// copied into the user data directory for the test and the files will be
@@ -404,6 +408,12 @@ class UITest : public testing::Test {
void StartHttpServer(const FilePath& root_directory);
void StopHttpServer();
+ // Profile theme type choices.
+ enum {
+ DEFAULT_THEME = 0,
+ COMPLEX_THEME = 1
+ } ProfileType;
+
private:
// Check that no processes related to Chrome exist, displaying
// the given message if any do.