diff options
author | suzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 03:31:26 +0000 |
---|---|---|
committer | suzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-05 03:31:26 +0000 |
commit | 28dabab7b899c293a928f665fd649095a9d76de1 (patch) | |
tree | e7cb21f6aea555c76f9173f661ad82ab9a95a014 /chrome/test/in_process_browser_test.h | |
parent | a6ea126034ade23d94df94e2b105538152f6d86e (diff) | |
download | chromium_src-28dabab7b899c293a928f665fd649095a9d76de1.zip chromium_src-28dabab7b899c293a928f665fd649095a9d76de1.tar.gz chromium_src-28dabab7b899c293a928f665fd649095a9d76de1.tar.bz2 |
Add SetUpOnMainThread() method into InProcessBrowserTest
This method will be called just before calling RunTestOnMainThread(), so
that custom setup code shared among all tests can be put here. So CLs like: http://codereview.chromium.org/5982005/ can be simplified by eliminating those duplicated ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
BUG=49355
TEST=none
Review URL: http://codereview.chromium.org/2812061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/in_process_browser_test.h')
-rw-r--r-- | chrome/test/in_process_browser_test.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/chrome/test/in_process_browser_test.h b/chrome/test/in_process_browser_test.h index fc7d34f..42cadbb 100644 --- a/chrome/test/in_process_browser_test.h +++ b/chrome/test/in_process_browser_test.h @@ -38,9 +38,27 @@ class RuleBasedHostResolverProc; // is shown, invoke MessageLoop::current()->Quit() to return control back to // your test method. // . If you subclass and override SetUp, be sure and invoke -// InProcessBrowserTest::SetUp. (But see also -// SetUpInProcessBrowserTestFixture and related hook methods for a cleaner -// alternative). +// InProcessBrowserTest::SetUp. (But see also SetUpOnMainThread, +// SetUpInProcessBrowserTestFixture and other related hook methods for a +// cleaner alternative). +// +// Following three hook methods are called in sequence before calling +// BrowserMain(), thus no browser has been created yet. They are mainly for +// setting up the environment for running the browser. +// . SetUpUserDataDirectory() +// . SetUpCommandLine() +// . SetUpInProcessBrowserTestFixture() +// +// SetUpOnMainThread() is called just after creating the default browser object +// and before executing the real test code. It's mainly for setting up things +// related to the browser object and associated window, like opening a new Tab +// with a testing page loaded. +// +// CleanUpOnMainThread() is called just after executing the real test code to +// do necessary cleanup before the browser is torn down. +// +// TearDownInProcessBrowserTestFixture() is called after BrowserMain() exits to +// cleanup things setup for running the browser. // // By default InProcessBrowserTest creates a single Browser (as returned from // the CreateBrowser method). You can obviously create more as needed. @@ -83,6 +101,11 @@ class InProcessBrowserTest : public testing::Test { // Adds a selected tab at |index| to |url| with the specified |transition|. void AddTabAt(int index, const GURL& url, PageTransition::Type transition); + // Override this to add any custom setup code that needs to be done on the + // main thread after the browser is created and just before calling + // RunTestOnMainThread(). + virtual void SetUpOnMainThread() {} + // Override this rather than TestBody. virtual void RunTestOnMainThread() = 0; |