Chromium Code Reviews| Index: content/public/test/browser_test_base.h |
| diff --git a/content/public/test/browser_test_base.h b/content/public/test/browser_test_base.h |
| index 1514c65062ee50ec668b1c6f37e472e98e7c7f10..d747fcb3e96fccc838b80cc31e701cc50e11f921 100644 |
| --- a/content/public/test/browser_test_base.h |
| +++ b/content/public/test/browser_test_base.h |
| @@ -7,6 +7,7 @@ |
| #include "base/callback.h" |
| #include "base/compiler_specific.h" |
| +#include "base/memory/scoped_vector.h" |
| #include "base/threading/thread.h" |
| #include "net/test/spawned_test_server/spawned_test_server.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -28,6 +29,27 @@ namespace content { |
| class BrowserTestBase : public testing::Test { |
| public: |
| + // Class that can be used to add some features not related directly |
| + // to the testing process and do set ups needed for them in proper time. |
| + // To do this you need to derive Admixture, implement |
| + // all the methods you need there and (if needed) reload set ups and tear |
| + // downs |
| + // for things that you would usually do in those of the test, but which are |
| + // connected |
| + // to the admixture, not to the test itself. |
| + // Finally, AddAdmixture() should be called in the test's constructor for each |
| + // Admixture. |
| + class Admixture { |
| + public: |
| + Admixture() {} |
| + virtual ~Admixture() {} |
| + virtual void SetUpCommandLine(base::CommandLine* command_line) {} |
| + virtual void SetUpOnMainThread() {} |
| + virtual void SetUpInProcessBrowserTestFixture() {} |
| + virtual void TearDownOnMainThread() {} |
| + virtual void TearDownInProcessBrowserTestFixture() {} |
|
dzhioev (left Google)
2014/08/18 12:11:46
You forgot to add TearDown* calls in appropriate p
Lisa Ignatyeva
2014/08/18 12:20:41
Done.
|
| + }; |
| + |
| BrowserTestBase(); |
| virtual ~BrowserTestBase(); |
| @@ -130,6 +152,18 @@ class BrowserTestBase : public testing::Test { |
| // Returns true if the test will be using GL acceleration via OSMesa. |
| bool UsingOSMesa() const; |
| + // Adds |admixture| as an admixture for this test, passing ownership |
| + // for it to BrowserTestBase. |
| + // Should be called in constructor of the test (should be already completed |
| + // before running set ups). |
| + void AddAdmixture(Admixture* admixture); |
| + |
| + // Returns admixtures for this test. |
| + std::vector<BrowserTestBase::Admixture*> GetAdmixtures(); |
| + |
| + // Passes admixtures ownership back. |
| + void ReturnAdmixtures(ScopedVector<BrowserTestBase::Admixture> arg); |
|
dzhioev (left Google)
2014/08/18 12:11:46
Remove this declaration.
Lisa Ignatyeva
2014/08/18 12:20:41
Done.
|
| + |
| private: |
| void ProxyRunTestOnMainThreadLoop(); |
| @@ -142,6 +176,9 @@ class BrowserTestBase : public testing::Test { |
| // Host resolver used during tests. |
| scoped_refptr<net::RuleBasedHostResolverProc> rule_based_resolver_; |
| + // Holds admixtures for this test. |
| + ScopedVector<Admixture> admixtures_; |
| + |
| // Expected exit code (default is 0). |
| int expected_exit_code_; |